diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/Messages.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/Messages.java new file mode 100644 index 000000000..98336a2f4 --- /dev/null +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/Messages.java @@ -0,0 +1,123 @@ +/******************************************************************************* + * Copyright (c) 2024 Patrick Ziegler and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Patrick Ziegler - initial API and implementation + *******************************************************************************/ + +package org.eclipse.zest.examples; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = Messages.class.getPackageName() + ".messages"; //$NON-NLS-1$ + // Used in multiple snippets + public static String Paper; + public static String Rock; + public static String Scissors; + public static String Information; + public static String Warning; + public static String Error; + public static String Root; + // + public static String AnimationSnippet_Animate; + public static String AnimationSnippet_Title; + public static String CustomLayout_Title; + public static String GraphSnippet1_Title; + public static String GraphSnippet10_Title; + public static String GraphSnippet10_ChangeCurve; + public static String GraphSnippet11_Title; + public static String GraphSnippet11_Node1; + public static String GraphSnippet11_Node2; + public static String GraphSnippet12_Title; + public static String GraphSnippet12_PDE; + public static String GraphSnippet12_Zest; + public static String GraphSnippet12_PDEVizTool; + public static String GraphSnippet13_Title; + public static String GraphSnippet13_Tooltip_Name; + public static String GraphSnippet13_Tooltip_Location; + public static String GraphSnippet13_USA; + public static String GraphSnippet13_Canada; + public static String GraphSnippet13_Node1; + public static String GraphSnippet13_Node2; + public static String GraphSnippet14_Title; + public static String GraphSnippet14_RevealAll; + public static String GraphSnippet2_Title; + public static String GraphSnippet3_Title; + public static String GraphSnippet4_Title; + public static String GraphSnippet4_Tooltip1; + public static String GraphSnippet4_Tooltip2; + public static String GraphSnippet5_Title; + public static String GraphSnippet5_Information; + public static String GraphSnippet5_Warning; + public static String GraphSnippet5_Error; + public static String GraphSnippet6_Title; + public static String GraphSnippet7_Title; + public static String GraphSnippet7_SystemOut; + public static String GraphSnippet8_Title; + public static String GraphSnippet8_Node1; + public static String GraphSnippet8_Node2; + public static String GraphSnippet8_Node3; + public static String GraphSnippet8_Node4; + public static String GraphSnippet8_Node5; + public static String GraphSnippet8_Node6; + public static String GraphSnippet8_Node7; + public static String GraphSnippet9_Title; + public static String GraphSnippet9_Connection; + public static String HelloWorld_Title; + public static String HelloWorld_Node1; + public static String HelloWorld_Node2; + public static String LayoutExample_Title; + public static String LayoutExample_Node1; + public static String LayoutExample_Node2; + public static String ManhattanLayoutGraphSnippet_Title; + public static String ManhattanLayoutGraphSnippet_ChangeRouter; + public static String NestedGraphSnippet_Title; + public static String NestedGraphSnippet_Container1; + public static String NestedGraphSnippet_Container2; + public static String NestedGraphSnippet_Container3; + public static String NestedGraphSnippet_Node1; + public static String NestedGraphSnippet_Node2; + public static String NestedGraphSnippet_Node3; + public static String NestedGraphSnippet_Node4; + public static String NestedGraphSnippet_Node5; + public static String NestedGraphSnippet2_Title; + public static String NestedGraphSnippet2_Connection; + public static String NestedGraphSnippet2_Container1; + public static String NestedGraphSnippet2_Container2; + public static String NestedGraphSnippet2_Container3; + public static String NestedGraphSnippet2_Container4; + public static String NestedGraphSnippet2_Container5; + public static String NestedGraphSnippet2_Container6; + public static String NestedGraphSnippet2_Container7; + public static String NestedGraphSnippet2_Node1; + public static String NestedGraphSnippet2_Node2; + public static String NestedGraphSnippet2_Node3; + public static String NestedGraphSnippet2_Node4; + public static String NestedGraphSnippet2_Node5; + public static String PaintSnippet_Title; + public static String PaintSnippet_TakeScreenshot; + public static String PaintSnippet_Popup_Title; + public static String ZoomSnippet_Title; + public static String ZoomSnippet_Container1; + public static String ZoomSnippet_Container2; + public static String ZoomSnippet_Container3; + public static String ZoomSnippet_Node1; + public static String ZoomSnippet_Node2; + public static String ZoomSnippet_Node3; + public static String ZoomSnippet_Node4; + public static String ZoomSnippet_Node5; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/messages.properties b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/messages.properties new file mode 100644 index 000000000..a3654b0f6 --- /dev/null +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/messages.properties @@ -0,0 +1,94 @@ +Paper=Paper +Rock=Rock +Scissors=Scissors +Information=Information +Warning=Warning +Error=Error +Root=Root +AnimationSnippet_Animate=Animate +AnimationSnippet_Title=Animation Example +CustomLayout_Title=Custom Layout Example +GraphSnippet1_Title=GraphSnippet1 +GraphSnippet10_Title=GraphSnippet10 +GraphSnippet10_ChangeCurve=Change Curve +GraphSnippet11_Title=GraphSnippet11 +GraphSnippet11_Node1=Node 1 +GraphSnippet11_Node2=Node 2 +GraphSnippet12_Title=GraphSnippet12 +GraphSnippet12_PDE=PDE +GraphSnippet12_Zest=Zest +GraphSnippet12_PDEVizTool=PDE Viz Tool +GraphSnippet13_Title=GraphSnippet13 +GraphSnippet13_Tooltip_Name=Name: Chris Aniszczyk +GraphSnippet13_Tooltip_Location=Location: Austin, Texas +GraphSnippet13_USA=USA +GraphSnippet13_Canada=Canada +GraphSnippet13_Node1=Ian B. +GraphSnippet13_Node2=Chris A. +GraphSnippet14_Title=GraphSnippet14 +GraphSnippet14_RevealAll=Reveal All +GraphSnippet2_Title=GraphSnippet2 +GraphSnippet3_Title=GraphSnippet3 +GraphSnippet4_Title=GraphSnippet4 +GraphSnippet4_Tooltip1=Information to Warning +GraphSnippet4_Tooltip2=Warning to Error +GraphSnippet5_Title=GraphSnippet5 +GraphSnippet5_Information=org.eclipse.Information +GraphSnippet5_Warning=org.eclipse.Warning +GraphSnippet5_Error=org.eclipse.Error +GraphSnippet6_Title=GraphSnippet6 +GraphSnippet7_Title=GraphSnippet7 +GraphSnippet7_SystemOut={0} is at ({1}, {2}) +GraphSnippet8_Title=GraphSnippet8 +GraphSnippet8_Node1=B +GraphSnippet8_Node2=C +GraphSnippet8_Node3=D +GraphSnippet8_Node4=E +GraphSnippet8_Node5=F +GraphSnippet8_Node6=G +GraphSnippet8_Node7=H +GraphSnippet9_Title=GraphSnippet9 +GraphSnippet9_Connection=A to A +HelloWorld_Title=Hello, World +HelloWorld_Node1=Hello +HelloWorld_Node2=World +LayoutExample_Title=LayoutExample +LayoutExample_Node1=1 - {0} +LayoutExample_Node2=2 - {0} +ManhattanLayoutGraphSnippet_Title=ManhattanLayout GraphSnippet +ManhattanLayoutGraphSnippet_ChangeRouter=Change Router +NestedGraphSnippet_Title=NestedGraphSnippet1 +NestedGraphSnippet_Container1=SomeClass.java +NestedGraphSnippet_Container2=SomeNestedClass.java +NestedGraphSnippet_Container3=DefaultAction.java +NestedGraphSnippet_Node1=SomeClass.java +NestedGraphSnippet_Node2=SomeNestedClass.java +NestedGraphSnippet_Node3=DefaultAction.java +NestedGraphSnippet_Node4=LastAction(Hero).java +NestedGraphSnippet_Node5=LastAction(Hero).java +NestedGraphSnippet2_Title=NestedGraphSnippet2 +NestedGraphSnippet2_Connection=Network (bandwidth:1) +NestedGraphSnippet2_Container1=Machine 1 (prop:1) +NestedGraphSnippet2_Container2=Machine 2 +NestedGraphSnippet2_Container3=Machine 3 +NestedGraphSnippet2_Container4=Host 1 +NestedGraphSnippet2_Container5=Host 2 +NestedGraphSnippet2_Container6=Host 3 +NestedGraphSnippet2_Container7=Host 4 +NestedGraphSnippet2_Node1=JSP Object +NestedGraphSnippet2_Node2=JSP Object 2 +NestedGraphSnippet2_Node3=JSP Object 3 +NestedGraphSnippet2_Node4=JSP Object 4 +NestedGraphSnippet2_Node5=JSP Object 5 +PaintSnippet_Title=PaintSnippet +PaintSnippet_TakeScreenshot=Take Screenshot +PaintSnippet_Popup_Title=Image +ZoomSnippet_Title=ZoomSnippet +ZoomSnippet_Container1=SomeClass.java +ZoomSnippet_Container2=SomeNestedClass.java +ZoomSnippet_Container3=DefaultAction.java +ZoomSnippet_Node1=SomeClass.java +ZoomSnippet_Node2=SomeNestedClass.java +ZoomSnippet_Node3=DefaultAction.java +ZoomSnippet_Node4=LastAction(Hero).java +ZoomSnippet_Node5=LastAction(Hero).java diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/AnimationSnippet.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/AnimationSnippet.java index 7a8cc14e5..e39b43283 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/AnimationSnippet.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/AnimationSnippet.java @@ -11,6 +11,7 @@ import org.eclipse.zest.core.widgets.Graph; import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; +import org.eclipse.zest.examples.Messages; import org.eclipse.draw2d.Animation; @@ -29,17 +30,17 @@ public static void main(String[] args) { final Shell shell = new Shell(); Display d = shell.getDisplay(); - shell.setText("Animation Example"); + shell.setText(Messages.AnimationSnippet_Title); shell.setLayout(new FillLayout(SWT.VERTICAL)); shell.setSize(400, 400); Button b = new Button(shell, SWT.PUSH); - b.setText("Animate"); + b.setText(Messages.AnimationSnippet_Animate); g = new Graph(shell, SWT.NONE); - final GraphNode n = new GraphNode(g, SWT.NONE, "Paper"); - final GraphNode n2 = new GraphNode(g, SWT.NONE, "Rock"); + final GraphNode n = new GraphNode(g, SWT.NONE, Messages.Paper); + final GraphNode n2 = new GraphNode(g, SWT.NONE, Messages.Rock); b.addSelectionListener(new SelectionListener() { @Override diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/CustomLayout.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/CustomLayout.java index 518fdaf1c..2eb8641c7 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/CustomLayout.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/CustomLayout.java @@ -8,6 +8,7 @@ import org.eclipse.zest.core.widgets.Graph; import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithm; import org.eclipse.zest.layouts.interfaces.EntityLayout; @@ -25,15 +26,15 @@ public class CustomLayout { public static void main(String[] args) { Shell shell = new Shell(); Display d = shell.getDisplay(); - shell.setText("Custom Layout Example"); + shell.setText(Messages.CustomLayout_Title); shell.setLayout(new FillLayout()); shell.setSize(400, 400); g = new Graph(shell, SWT.NONE); - GraphNode n = new GraphNode(g, SWT.NONE, "Paper"); - GraphNode n2 = new GraphNode(g, SWT.NONE, "Rock"); - GraphNode n3 = new GraphNode(g, SWT.NONE, "Scissors"); + GraphNode n = new GraphNode(g, SWT.NONE, Messages.Paper); + GraphNode n2 = new GraphNode(g, SWT.NONE, Messages.Rock); + GraphNode n3 = new GraphNode(g, SWT.NONE, Messages.Scissors); new GraphConnection(g, SWT.NONE, n, n2); new GraphConnection(g, SWT.NONE, n2, n3); new GraphConnection(g, SWT.NONE, n3, n); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet1.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet1.java index 49201d0a2..85ebaf0c4 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet1.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet1.java @@ -23,6 +23,7 @@ import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; import org.eclipse.zest.core.widgets.internal.NodeSearchDialog; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; /** @@ -42,15 +43,15 @@ public class GraphSnippet1 { public static void main(String[] args) { Shell shell = new Shell(); Display d = shell.getDisplay(); - shell.setText("GraphSnippet1"); + shell.setText(Messages.GraphSnippet1_Title); shell.setLayout(new FillLayout()); shell.setSize(400, 400); g = new Graph(shell, SWT.NONE); - GraphNode n = new GraphNode(g, SWT.NONE, "Paper"); - GraphNode n2 = new GraphNode(g, SWT.NONE, "Rock"); - GraphNode n3 = new GraphNode(g, SWT.NONE, "Scissors"); + GraphNode n = new GraphNode(g, SWT.NONE, Messages.Paper); + GraphNode n2 = new GraphNode(g, SWT.NONE, Messages.Rock); + GraphNode n3 = new GraphNode(g, SWT.NONE, Messages.Scissors); new GraphConnection(g, SWT.NONE, n, n2); new GraphConnection(g, SWT.NONE, n2, n3); new GraphConnection(g, SWT.NONE, n3, n); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet10.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet10.java index 8c91fe699..071bb65a9 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet10.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet10.java @@ -23,6 +23,7 @@ import org.eclipse.zest.core.widgets.Graph; import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; /** @@ -39,17 +40,17 @@ public class GraphSnippet10 { public static void main(String[] args) { Shell shell = new Shell(); Display d = shell.getDisplay(); - shell.setText("GraphSnippet1"); + shell.setText(Messages.GraphSnippet10_Title); shell.setLayout(new FillLayout()); shell.setSize(400, 400); g = new Graph(shell, SWT.NONE); - GraphNode n = new GraphNode(g, SWT.NONE, "Paper"); + GraphNode n = new GraphNode(g, SWT.NONE, Messages.Paper); n.setBorderColor(org.eclipse.draw2d.ColorConstants.yellow); n.setBorderWidth(3); - GraphNode n2 = new GraphNode(g, SWT.NONE, "Rock"); - GraphNode n3 = new GraphNode(g, SWT.NONE, "Scissors"); + GraphNode n2 = new GraphNode(g, SWT.NONE, Messages.Rock); + GraphNode n3 = new GraphNode(g, SWT.NONE, Messages.Scissors); final GraphConnection connection = new GraphConnection(g, SWT.NONE, n, n2); connection.setLineWidth(3); new GraphConnection(g, SWT.NONE, n2, n3); @@ -57,7 +58,7 @@ public static void main(String[] args) { g.setLayoutAlgorithm(new SpringLayoutAlgorithm(), true); Button button = new Button(shell, SWT.PUSH); - button.setText("Change Curve"); + button.setText(Messages.GraphSnippet10_ChangeCurve); button.addSelectionListener(new SelectionAdapter() { int count = 0; diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet11.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet11.java index bc02594e7..952262db9 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet11.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet11.java @@ -21,6 +21,7 @@ import org.eclipse.zest.core.widgets.Graph; import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; import org.eclipse.draw2d.ColorConstants; @@ -45,13 +46,13 @@ public static void createConnection(Graph g, GraphNode n1, GraphNode n2, Color c public static void main(String[] args) { Shell shell = new Shell(); Display d = shell.getDisplay(); - shell.setText("GraphSnippet11"); //$NON-NLS-1$ + shell.setText(Messages.GraphSnippet11_Title); shell.setLayout(new FillLayout()); shell.setSize(400, 400); g = new Graph(shell, SWT.NONE); - GraphNode n = new GraphNode(g, SWT.NONE, "Node 1"); //$NON-NLS-1$ - GraphNode n2 = new GraphNode(g, SWT.NONE, "Node 2"); //$NON-NLS-1$ + GraphNode n = new GraphNode(g, SWT.NONE, Messages.GraphSnippet11_Node1); + GraphNode n2 = new GraphNode(g, SWT.NONE, Messages.GraphSnippet11_Node2); createConnection(g, n, n2, ColorConstants.darkGreen, 20); createConnection(g, n, n2, ColorConstants.darkGreen, -20); createConnection(g, n, n2, ColorConstants.darkBlue, 40); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet12.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet12.java index 998e1c3cc..4fb6e7a92 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet12.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet12.java @@ -26,6 +26,7 @@ import org.eclipse.zest.core.widgets.Graph; import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; import org.eclipse.draw2d.ColorConstants; @@ -103,7 +104,7 @@ public static IFigure createPersonFigure(Image headImage) { public static void main(String[] args) { Shell shell = new Shell(); final Display d = shell.getDisplay(); - shell.setText("GraphSnippet11"); + shell.setText(Messages.GraphSnippet12_Title); shell.setLayout(new FillLayout()); shell.setSize(400, 400); @@ -140,13 +141,13 @@ public void widgetDefaultSelected(SelectionEvent e) { } }); - Image zx = new Image(d, GraphSnippet12.class.getResourceAsStream("/zx.png")); - Image ibull = new Image(d, GraphSnippet12.class.getResourceAsStream("/ibull.jpg")); + Image zx = new Image(d, GraphSnippet12.class.getResourceAsStream("/zx.png")); //$NON-NLS-1$ + Image ibull = new Image(d, GraphSnippet12.class.getResourceAsStream("/ibull.jpg")); //$NON-NLS-1$ CGraphNode n = new CGraphNode(g, SWT.NONE, createPersonFigure(zx)); CGraphNode n2 = new CGraphNode(g, SWT.NONE, createPersonFigure(ibull)); - GraphNode n3 = new GraphNode(g, SWT.NONE, "PDE"); - GraphNode n4 = new GraphNode(g, SWT.NONE, "Zest"); - GraphNode n5 = new GraphNode(g, SWT.NONE, "PDE Viz tool"); + GraphNode n3 = new GraphNode(g, SWT.NONE, Messages.GraphSnippet12_PDE); + GraphNode n4 = new GraphNode(g, SWT.NONE, Messages.GraphSnippet12_Zest); + GraphNode n5 = new GraphNode(g, SWT.NONE, Messages.GraphSnippet12_PDEVizTool); new GraphConnection(g, SWT.NONE, n, n2); new GraphConnection(g, SWT.NONE, n, n3); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet13.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet13.java index e6e551a35..c1432b7be 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet13.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet13.java @@ -28,6 +28,7 @@ import org.eclipse.zest.core.widgets.GraphContainer; import org.eclipse.zest.core.widgets.GraphNode; import org.eclipse.zest.core.widgets.ZestStyles; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; import org.eclipse.draw2d.ColorConstants; @@ -108,7 +109,7 @@ public static IFigure createPersonFigure(Image headImage) { public static void main(String[] args) { Shell shell = new Shell(); final Display d = shell.getDisplay(); - shell.setText("GraphSnippet11"); + shell.setText(Messages.GraphSnippet13_Title); shell.setLayout(new FillLayout()); shell.setSize(400, 400); @@ -145,7 +146,7 @@ public void widgetDefaultSelected(SelectionEvent e) { } }); - Image zx = new Image(d, GraphSnippet13.class.getResourceAsStream("/zxsnow.png")); + Image zx = new Image(d, GraphSnippet13.class.getResourceAsStream("/zxsnow.png")); //$NON-NLS-1$ IFigure tooltip = new Figure(); tooltip.setBorder(new MarginBorder(5, 5, 5, 5)); FlowLayout layout = new FlowLayout(false); @@ -153,18 +154,18 @@ public void widgetDefaultSelected(SelectionEvent e) { layout.setMinorAlignment(3); tooltip.setLayoutManager(new FlowLayout(false)); tooltip.add(new ImageFigure(zx)); - tooltip.add(new Label("Name: " + "Chris Aniszczyk")); - tooltip.add(new Label("Location: " + "Austin, Texas")); + tooltip.add(new Label(Messages.GraphSnippet13_Tooltip_Name)); + tooltip.add(new Label(Messages.GraphSnippet13_Tooltip_Location)); - Image ibull = new Image(d, GraphSnippet13.class.getResourceAsStream("/ibull.jpg")); + Image ibull = new Image(d, GraphSnippet13.class.getResourceAsStream("/ibull.jpg")); //$NON-NLS-1$ GraphContainer c1 = new GraphContainer(g, SWT.NONE); - c1.setText("Canada"); + c1.setText(Messages.GraphSnippet13_Canada); GraphContainer c2 = new GraphContainer(g, SWT.NONE); - c2.setText("USA"); + c2.setText(Messages.GraphSnippet13_USA); - GraphNode n1 = new GraphNode(c1, SWT.NONE, "Ian B."); + GraphNode n1 = new GraphNode(c1, SWT.NONE, Messages.GraphSnippet13_Node1); n1.setSize(200, 100); - GraphNode n2 = new GraphNode(c2, SWT.NONE, "Chris A."); + GraphNode n2 = new GraphNode(c2, SWT.NONE, Messages.GraphSnippet13_Node2); n2.setTooltip(tooltip); GraphConnection connection = new GraphConnection(g, ZestStyles.CONNECTIONS_DIRECTED, n1, n2); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet14.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet14.java index c9151d43d..cb8b5d9e6 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet14.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet14.java @@ -19,6 +19,7 @@ import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; import org.eclipse.zest.core.widgets.HideNodeHelper; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; import org.eclipse.draw2d.Button; @@ -40,15 +41,15 @@ public class GraphSnippet14 { public static void main(String[] args) { Shell shell = new Shell(); Display d = shell.getDisplay(); - shell.setText("GraphSnippet14"); + shell.setText(Messages.GraphSnippet14_Title); shell.setLayout(new FillLayout()); shell.setSize(400, 400); g = new Graph(shell, SWT.NONE, true); // enable hide nodes - GraphNode n = new GraphNode(g, SWT.NONE, "Paper"); - GraphNode n2 = new GraphNode(g, SWT.NONE, "Rock"); - GraphNode n3 = new GraphNode(g, SWT.NONE, "Scissors"); + GraphNode n = new GraphNode(g, SWT.NONE, Messages.Paper); + GraphNode n2 = new GraphNode(g, SWT.NONE, Messages.Rock); + GraphNode n3 = new GraphNode(g, SWT.NONE, Messages.Scissors); new GraphConnection(g, SWT.NONE, n, n2); new GraphConnection(g, SWT.NONE, n2, n3); new GraphConnection(g, SWT.NONE, n3, n); @@ -56,7 +57,7 @@ public static void main(String[] args) { // example: hide-nodes reveal-all button if (g.getHideNodesEnabled()) { - Button revealAllButton = new Button("Reveal All"); + Button revealAllButton = new Button(Messages.GraphSnippet14_RevealAll); revealAllButton.setBounds(new Rectangle(new Point(0, 0), revealAllButton.getPreferredSize())); revealAllButton.addActionListener(event -> { for (GraphNode node : g.getNodes()) { diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet2.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet2.java index bdfcacfcb..34cd0f67d 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet2.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet2.java @@ -23,6 +23,7 @@ import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; import org.eclipse.zest.core.widgets.ZestStyles; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; /** @@ -38,6 +39,7 @@ public class GraphSnippet2 { public static void main(String[] args) { Shell shell = new Shell(); + shell.setText(Messages.GraphSnippet2_Title); Display d = shell.getDisplay(); Image image1 = Display.getDefault().getSystemImage(SWT.ICON_INFORMATION); Image image2 = Display.getDefault().getSystemImage(SWT.ICON_WARNING); @@ -47,9 +49,9 @@ public static void main(String[] args) { g = new Graph(shell, SWT.NONE); g.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED); - GraphNode n1 = new GraphNode(g, SWT.NONE, "Information", image1); - GraphNode n2 = new GraphNode(g, SWT.NONE, "Warning", image2); - GraphNode n3 = new GraphNode(g, SWT.NONE, "Error", image3); + GraphNode n1 = new GraphNode(g, SWT.NONE, Messages.Information, image1); + GraphNode n2 = new GraphNode(g, SWT.NONE, Messages.Warning, image2); + GraphNode n3 = new GraphNode(g, SWT.NONE, Messages.Error, image3); new GraphConnection(g, SWT.NONE, n1, n2); new GraphConnection(g, SWT.NONE, n2, n3); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet3.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet3.java index 3c4c52d76..02027c0a9 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet3.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet3.java @@ -25,6 +25,7 @@ import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; import org.eclipse.zest.core.widgets.ZestStyles; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; /** @@ -39,6 +40,7 @@ public class GraphSnippet3 { public static void main(String[] args) { Shell shell = new Shell(); + shell.setText(Messages.GraphSnippet3_Title); Display d = shell.getDisplay(); Image image1 = Display.getDefault().getSystemImage(SWT.ICON_INFORMATION); Image image2 = Display.getDefault().getSystemImage(SWT.ICON_WARNING); @@ -55,9 +57,9 @@ public void widgetSelected(SelectionEvent e) { }); g.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED); - GraphNode n1 = new GraphNode(g, SWT.NONE, "Information", image1); - GraphNode n2 = new GraphNode(g, SWT.NONE, "Warning", image2); - GraphNode n3 = new GraphNode(g, SWT.NONE, "Error", image3); + GraphNode n1 = new GraphNode(g, SWT.NONE, Messages.Information, image1); + GraphNode n2 = new GraphNode(g, SWT.NONE, Messages.Warning, image2); + GraphNode n3 = new GraphNode(g, SWT.NONE, Messages.Error, image3); new GraphConnection(g, SWT.NONE, n1, n2); new GraphConnection(g, SWT.NONE, n2, n3); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet4.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet4.java index 9828b7aa8..0e630c5b4 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet4.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet4.java @@ -24,6 +24,7 @@ import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; import org.eclipse.zest.core.widgets.ZestStyles; +import org.eclipse.zest.examples.Messages; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.Label; @@ -64,7 +65,7 @@ public static Image mergeImages(Image image1, Image image2) { public static void main(String[] args) { Shell shell = new Shell(); Display d = shell.getDisplay(); - shell.setText("Graph Snippet 4"); + shell.setText(Messages.GraphSnippet4_Title); Image image1 = Display.getDefault().getSystemImage(SWT.ICON_INFORMATION); Image image2 = Display.getDefault().getSystemImage(SWT.ICON_WARNING); Image image3 = Display.getDefault().getSystemImage(SWT.ICON_ERROR); @@ -73,17 +74,17 @@ public static void main(String[] args) { g = new Graph(shell, SWT.NONE); g.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED); - GraphNode n1 = new GraphNode(g, SWT.NONE, "Information", image1); - GraphNode n2 = new GraphNode(g, SWT.NONE, "Warning", image2); - GraphNode n3 = new GraphNode(g, SWT.NONE, "Error", image3); + GraphNode n1 = new GraphNode(g, SWT.NONE, Messages.Information, image1); + GraphNode n2 = new GraphNode(g, SWT.NONE, Messages.Warning, image2); + GraphNode n3 = new GraphNode(g, SWT.NONE, Messages.Error, image3); GraphConnection connection1 = new GraphConnection(g, SWT.NONE, n1, n2); GraphConnection connection2 = new GraphConnection(g, SWT.NONE, n2, n3); Image information2warningImage = mergeImages(image1, image2); Image warning2error = mergeImages(image2, image3); - IFigure tooltip1 = new Label("Information to Warning", information2warningImage); - IFigure tooltip2 = new Label("Warning to Error", warning2error); + IFigure tooltip1 = new Label(Messages.GraphSnippet4_Tooltip1, information2warningImage); + IFigure tooltip2 = new Label(Messages.GraphSnippet4_Tooltip2, warning2error); connection1.setTooltip(tooltip1); connection2.setTooltip(tooltip2); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet5.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet5.java index 172098f55..5a86c2338 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet5.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet5.java @@ -36,6 +36,7 @@ import org.eclipse.zest.core.widgets.GraphItem; import org.eclipse.zest.core.widgets.GraphNode; import org.eclipse.zest.core.widgets.ZestStyles; +import org.eclipse.zest.examples.Messages; import org.eclipse.draw2d.ColorConstants; @@ -65,7 +66,7 @@ public static void main(String[] args) { final Font font = new Font(d, fontData); - shell.setText("Graph Snippet 5"); + shell.setText(Messages.GraphSnippet5_Title); Image image1 = Display.getDefault().getSystemImage(SWT.ICON_INFORMATION); Image image2 = Display.getDefault().getSystemImage(SWT.ICON_WARNING); Image image3 = Display.getDefault().getSystemImage(SWT.ICON_ERROR); @@ -74,9 +75,9 @@ public static void main(String[] args) { g = new Graph(shell, SWT.NONE); g.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED); - GraphNode n1 = new GraphNode(g, SWT.NONE, "org.eclipse.Information", image1); - GraphNode n2 = new GraphNode(g, SWT.NONE, "org.eclipse.Warning", image2); - GraphNode n3 = new GraphNode(g, SWT.NONE, "org.eclipse.Error", image3); + GraphNode n1 = new GraphNode(g, SWT.NONE, Messages.GraphSnippet5_Information, image1); + GraphNode n2 = new GraphNode(g, SWT.NONE, Messages.GraphSnippet5_Warning, image2); + GraphNode n3 = new GraphNode(g, SWT.NONE, Messages.GraphSnippet5_Error, image3); figureListing.put(n1.getText().toLowerCase(), n1); figureListing.put(n2.getText().toLowerCase(), n2); figureListing.put(n3.getText().toLowerCase(), n3); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet6.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet6.java index 70153a88b..ea57453c4 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet6.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet6.java @@ -23,6 +23,7 @@ import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; import org.eclipse.zest.core.widgets.ZestStyles; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.GridLayoutAlgorithm; /** @@ -41,7 +42,7 @@ public class GraphSnippet6 { public static void main(String[] args) { Shell shell = new Shell(); Display d = shell.getDisplay(); - shell.setText("GraphSnippet6"); + shell.setText(Messages.GraphSnippet6_Title); Image image1 = Display.getDefault().getSystemImage(SWT.ICON_INFORMATION); Image image2 = Display.getDefault().getSystemImage(SWT.ICON_WARNING); Image image3 = Display.getDefault().getSystemImage(SWT.ICON_ERROR); @@ -51,10 +52,12 @@ public static void main(String[] args) { g = new Graph(shell, SWT.NONE); g.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED); for (int i = 0; i < 80; i++) { - GraphNode n1 = new GraphNode(g, ZestStyles.NODES_HIDE_TEXT | ZestStyles.NODES_FISHEYE, "Information", + GraphNode n1 = new GraphNode(g, ZestStyles.NODES_HIDE_TEXT | ZestStyles.NODES_FISHEYE, Messages.Information, image1); - GraphNode n2 = new GraphNode(g, ZestStyles.NODES_HIDE_TEXT | ZestStyles.NODES_FISHEYE, "Warning", image2); - GraphNode n3 = new GraphNode(g, ZestStyles.NODES_HIDE_TEXT | ZestStyles.NODES_FISHEYE, "Error", image3); + GraphNode n2 = new GraphNode(g, ZestStyles.NODES_HIDE_TEXT | ZestStyles.NODES_FISHEYE, Messages.Warning, + image2); + GraphNode n3 = new GraphNode(g, ZestStyles.NODES_HIDE_TEXT | ZestStyles.NODES_FISHEYE, Messages.Error, + image3); new GraphConnection(g, SWT.NONE, n1, n2); new GraphConnection(g, SWT.NONE, n2, n3); new GraphConnection(g, SWT.NONE, n3, n3); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet7.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet7.java index 9828393a3..c72699bb7 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet7.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet7.java @@ -22,6 +22,7 @@ import org.eclipse.zest.core.widgets.Graph; import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; /** @@ -40,15 +41,15 @@ public class GraphSnippet7 { public static void main(String[] args) { Shell shell = new Shell(); Display d = shell.getDisplay(); - shell.setText("GraphSnippet7"); + shell.setText(Messages.GraphSnippet7_Title); shell.setLayout(new FillLayout()); shell.setSize(400, 400); g = new Graph(shell, SWT.NONE); - GraphNode n = new GraphNode(g, SWT.NONE, "Paper"); - GraphNode n2 = new GraphNode(g, SWT.NONE, "Rock"); - GraphNode n3 = new GraphNode(g, SWT.NONE, "Scissors"); + GraphNode n = new GraphNode(g, SWT.NONE, Messages.Paper); + GraphNode n2 = new GraphNode(g, SWT.NONE, Messages.Rock); + GraphNode n3 = new GraphNode(g, SWT.NONE, Messages.Scissors); new GraphConnection(g, SWT.NONE, n, n2); new GraphConnection(g, SWT.NONE, n2, n3); new GraphConnection(g, SWT.NONE, n3, n); @@ -61,7 +62,7 @@ public void mouseMove(MouseEvent e) { // Get the figure at the current mouse location Object o = g.getFigureAt(e.x, e.y); if (o != null) { - System.out.println(o + " is at: (" + e.x + "," + e.y + ")"); + System.out.println(Messages.bind(Messages.GraphSnippet7_SystemOut, new Object[] { o, e.x, e.y })); } } diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet8.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet8.java index 089411d76..cd5c45ebc 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet8.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet8.java @@ -22,6 +22,7 @@ import org.eclipse.zest.core.widgets.GraphNode; import org.eclipse.zest.core.widgets.LayoutFilter; import org.eclipse.zest.core.widgets.ZestStyles; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm; import org.eclipse.draw2d.ColorConstants; @@ -42,20 +43,20 @@ public class GraphSnippet8 { public static void main(String[] args) { Shell shell = new Shell(); Display display = shell.getDisplay(); - shell.setText("GraphSnippet8"); //$NON-NLS-1$ + shell.setText(Messages.GraphSnippet8_Title); shell.setLayout(new FillLayout()); shell.setSize(400, 400); graph = new Graph(shell, SWT.NONE); - GraphNode a = new GraphNode(graph, SWT.NONE, "Root"); //$NON-NLS-1$ - GraphNode b = new GraphNode(graph, SWT.NONE, "B"); //$NON-NLS-1$ - GraphNode c = new GraphNode(graph, SWT.NONE, "C"); //$NON-NLS-1$ - GraphNode d = new GraphNode(graph, SWT.NONE, "D"); //$NON-NLS-1$ - GraphNode e = new GraphNode(graph, SWT.NONE, "E"); //$NON-NLS-1$ - GraphNode f = new GraphNode(graph, SWT.NONE, "F"); //$NON-NLS-1$ - GraphNode g = new GraphNode(graph, SWT.NONE, "G"); //$NON-NLS-1$ - GraphNode h = new GraphNode(graph, SWT.NONE, "H"); //$NON-NLS-1$ + GraphNode a = new GraphNode(graph, SWT.NONE, Messages.Root); + GraphNode b = new GraphNode(graph, SWT.NONE, Messages.GraphSnippet8_Node1); + GraphNode c = new GraphNode(graph, SWT.NONE, Messages.GraphSnippet8_Node2); + GraphNode d = new GraphNode(graph, SWT.NONE, Messages.GraphSnippet8_Node3); + GraphNode e = new GraphNode(graph, SWT.NONE, Messages.GraphSnippet8_Node4); + GraphNode f = new GraphNode(graph, SWT.NONE, Messages.GraphSnippet8_Node5); + GraphNode g = new GraphNode(graph, SWT.NONE, Messages.GraphSnippet8_Node6); + GraphNode h = new GraphNode(graph, SWT.NONE, Messages.GraphSnippet8_Node7); GraphConnection connection = new GraphConnection(graph, SWT.NONE, a, b); connection.setData(Boolean.FALSE); connection = new GraphConnection(graph, SWT.NONE, a, c); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet9.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet9.java index 0b6e37007..1dd77c37e 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet9.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/GraphSnippet9.java @@ -21,6 +21,7 @@ import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; import org.eclipse.zest.core.widgets.ZestStyles; +import org.eclipse.zest.examples.Messages; /** * This snippet demonstrates a self loop with a label. @@ -37,15 +38,15 @@ public class GraphSnippet9 { public static void main(String[] args) { Shell shell = new Shell(); Display display = shell.getDisplay(); - shell.setText("GraphSnippet9"); + shell.setText(Messages.GraphSnippet9_Title); shell.setLayout(new FillLayout()); shell.setSize(400, 400); graph = new Graph(shell, SWT.NONE); - GraphNode a = new GraphNode(graph, ZestStyles.CONNECTIONS_DIRECTED, "Root"); + GraphNode a = new GraphNode(graph, ZestStyles.CONNECTIONS_DIRECTED, Messages.Root); GraphConnection connection = new GraphConnection(graph, SWT.NONE, a, a); - connection.setText("A to A"); + connection.setText(Messages.GraphSnippet9_Connection); a.setLocation(100, 100); shell.open(); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/HelloWorld.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/HelloWorld.java index ab8162be9..85725430e 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/HelloWorld.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/HelloWorld.java @@ -20,6 +20,7 @@ import org.eclipse.zest.core.widgets.Graph; import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; /** @@ -37,13 +38,13 @@ public class HelloWorld { public static void main(String[] args) { Shell shell = new Shell(); Display d = shell.getDisplay(); - shell.setText("Hello, World"); + shell.setText(Messages.HelloWorld_Title); shell.setLayout(new FillLayout()); shell.setSize(400, 400); g = new Graph(shell, SWT.NONE); - GraphNode hello = new GraphNode(g, SWT.NONE, "Hello"); - GraphNode world = new GraphNode(g, SWT.NONE, "World"); + GraphNode hello = new GraphNode(g, SWT.NONE, Messages.HelloWorld_Node1); + GraphNode world = new GraphNode(g, SWT.NONE, Messages.HelloWorld_Node2); new GraphConnection(g, SWT.NONE, hello, world); g.setLayoutAlgorithm(new SpringLayoutAlgorithm(), true); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/LayoutExample.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/LayoutExample.java index 7ea901a08..ccd02001a 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/LayoutExample.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/LayoutExample.java @@ -20,6 +20,7 @@ import org.eclipse.zest.core.widgets.Graph; import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; /** @@ -40,16 +41,16 @@ public static void main(String[] args) { // Create the shell Shell shell = new Shell(); Display d = shell.getDisplay(); - shell.setText("GraphSnippet1"); + shell.setText(Messages.LayoutExample_Title); shell.setLayout(new FillLayout()); shell.setSize(400, 400); g = new Graph(shell, SWT.NONE); - GraphNode root = new GraphNode(g, SWT.NONE, "Root"); + GraphNode root = new GraphNode(g, SWT.NONE, Messages.Root); for (int i = 0; i < 3; i++) { - GraphNode n = new GraphNode(g, SWT.NONE, "1 - " + i); + GraphNode n = new GraphNode(g, SWT.NONE, Messages.bind(Messages.LayoutExample_Node1, i)); for (int j = 0; j < 3; j++) { - GraphNode n2 = new GraphNode(g, SWT.NONE, "2 - " + j); + GraphNode n2 = new GraphNode(g, SWT.NONE, Messages.bind(Messages.LayoutExample_Node2, j)); new GraphConnection(g, SWT.NONE, n, n2); } new GraphConnection(g, SWT.NONE, root, n); @@ -58,7 +59,7 @@ public static void main(String[] args) { SpringLayoutAlgorithm springLayoutAlgorithm = new SpringLayoutAlgorithm(); for (GraphConnection connection : g.getConnections()) { - if (connection.getSource().getText().equals("Root")) { + if (connection.getSource().getText().equals(Messages.Root)) { connection.setWeight(1.0); } else { connection.setWeight(-1.0); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/ManhattanLayoutGraphSnippet.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/ManhattanLayoutGraphSnippet.java index 128bdb0b2..9ef5225bf 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/ManhattanLayoutGraphSnippet.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/ManhattanLayoutGraphSnippet.java @@ -25,6 +25,7 @@ import org.eclipse.zest.core.widgets.Graph; import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; import org.eclipse.draw2d.ConnectionRouter; @@ -47,18 +48,18 @@ public static void main(String[] args) { // Create the shell final Display d = new Display(); final Shell shell = new Shell(d); - shell.setText("GraphSnippet1"); + shell.setText(Messages.ManhattanLayoutGraphSnippet_Title); shell.setLayout(new FillLayout()); shell.setSize(400, 400); Button b = new Button(shell, SWT.PUSH); - b.setText("Change Router"); + b.setText(Messages.ManhattanLayoutGraphSnippet_ChangeRouter); final Graph g = new Graph(shell, SWT.NONE); - GraphNode n = new GraphNode(g, SWT.NONE, "Paper"); - GraphNode n2 = new GraphNode(g, SWT.NONE, "Rock"); - GraphNode n3 = new GraphNode(g, SWT.NONE, "Scissors"); + GraphNode n = new GraphNode(g, SWT.NONE, Messages.Paper); + GraphNode n2 = new GraphNode(g, SWT.NONE, Messages.Rock); + GraphNode n3 = new GraphNode(g, SWT.NONE, Messages.Scissors); new GraphConnection(g, SWT.NONE, n, n2); new GraphConnection(g, SWT.NONE, n2, n3); new GraphConnection(g, SWT.NONE, n3, n); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/NestedGraphSnippet.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/NestedGraphSnippet.java index 3ffa6a9b3..16635db43 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/NestedGraphSnippet.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/NestedGraphSnippet.java @@ -23,6 +23,7 @@ import org.eclipse.zest.core.widgets.GraphContainer; import org.eclipse.zest.core.widgets.GraphNode; import org.eclipse.zest.core.widgets.ZestStyles; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.LayoutAlgorithm; import org.eclipse.zest.layouts.algorithms.CompositeLayoutAlgorithm; import org.eclipse.zest.layouts.algorithms.GridLayoutAlgorithm; @@ -36,18 +37,18 @@ public class NestedGraphSnippet { private static Image classImage; public static void createContainer(Graph g) { - GraphContainer a = new GraphContainer(g, SWT.NONE, "SomeClass.java", classImage); + GraphContainer a = new GraphContainer(g, SWT.NONE, Messages.NestedGraphSnippet_Container1, classImage); int r = (int) ((Math.random() * 3) + 1); r = 2; populateContainer(a, g, r, true); for (int i = 0; i < 4; i++) { - GraphContainer b = new GraphContainer(g, SWT.NONE, "SomeNestedClass.java", classImage); + GraphContainer b = new GraphContainer(g, SWT.NONE, Messages.NestedGraphSnippet_Container2, classImage); r = (int) ((Math.random() * 3) + 1); r = 2; populateContainer(b, g, r, false); new GraphConnection(g, SWT.NONE, a, b); for (int j = 0; j < 4; j++) { - GraphContainer c = new GraphContainer(g, SWT.NONE, "DefaultAction.java", classImage); + GraphContainer c = new GraphContainer(g, SWT.NONE, Messages.NestedGraphSnippet_Container3, classImage); r = (int) ((Math.random() * 3) + 1); r = 2; populateContainer(c, g, r, true); @@ -57,25 +58,25 @@ public static void createContainer(Graph g) { } public static void populateContainer(GraphContainer c, Graph g, int number, boolean radial) { - GraphNode a = new GraphNode(c, ZestStyles.NODES_FISHEYE | ZestStyles.NODES_HIDE_TEXT, "SomeClass.java", - classImage); + GraphNode a = new GraphNode(c, ZestStyles.NODES_FISHEYE | ZestStyles.NODES_HIDE_TEXT, + Messages.NestedGraphSnippet_Node1, classImage); for (int i = 0; i < 4; i++) { GraphNode b = new GraphNode(c, ZestStyles.NODES_FISHEYE | ZestStyles.NODES_HIDE_TEXT, - "SomeNestedClass.java", classImage); + Messages.NestedGraphSnippet_Node2, classImage); new GraphConnection(g, SWT.NONE, a, b); for (int j = 0; j < 4; j++) { GraphNode d = new GraphNode(c, ZestStyles.NODES_FISHEYE | ZestStyles.NODES_HIDE_TEXT, - "DefaultAction.java", classImage); + Messages.NestedGraphSnippet_Node3, classImage); new GraphConnection(g, SWT.NONE, b, d); if (number > 2) { for (int k = 0; k < 4; k++) { GraphNode e = new GraphNode(c, ZestStyles.NODES_FISHEYE | ZestStyles.NODES_HIDE_TEXT, - "LastAction(Hero).java", classImage); + Messages.NestedGraphSnippet_Node4, classImage); new GraphConnection(g, SWT.NONE, d, e); if (number > 3) { for (int l = 0; l < 4; l++) { GraphNode f = new GraphNode(c, ZestStyles.NODES_FISHEYE | ZestStyles.NODES_HIDE_TEXT, - "LastAction(Hero).java", classImage); + Messages.NestedGraphSnippet_Node5, classImage); new GraphConnection(g, SWT.NONE, e, f); } } @@ -102,12 +103,12 @@ public static void populateContainer(GraphContainer c, Graph g, int number, bool */ public static void main(String[] args) { // Create the shell - image1 = new Image(Display.getDefault(), NestedGraphSnippet.class.getResourceAsStream("package_obj.gif")); - classImage = new Image(Display.getDefault(), NestedGraphSnippet.class.getResourceAsStream("class_obj.gif")); + image1 = new Image(Display.getDefault(), NestedGraphSnippet.class.getResourceAsStream("package_obj.gif")); //$NON-NLS-1$ + classImage = new Image(Display.getDefault(), NestedGraphSnippet.class.getResourceAsStream("class_obj.gif")); //$NON-NLS-1$ Shell shell = new Shell(); Display d = shell.getDisplay(); - shell.setText("GraphSnippet1"); + shell.setText(Messages.NestedGraphSnippet_Title); shell.setLayout(new FillLayout()); shell.setSize(500, 800); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/NestedGraphSnippet2.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/NestedGraphSnippet2.java index ff0f883bf..f9f8684a2 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/NestedGraphSnippet2.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/NestedGraphSnippet2.java @@ -22,6 +22,7 @@ import org.eclipse.zest.core.widgets.GraphContainer; import org.eclipse.zest.core.widgets.GraphNode; import org.eclipse.zest.core.widgets.ZestStyles; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.GridLayoutAlgorithm; import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; @@ -32,7 +33,7 @@ public static void main(String[] args) { // Create the shell Shell shell = new Shell(); Display d = shell.getDisplay(); - shell.setText("GraphSnippet1"); + shell.setText(Messages.NestedGraphSnippet2_Title); shell.setLayout(new FillLayout()); shell.setSize(400, 400); @@ -40,34 +41,34 @@ public static void main(String[] args) { /* Machines */ GraphContainer machine1 = new GraphContainer(g, SWT.NONE); - machine1.setText("Machine 1 (prop:1)"); + machine1.setText(Messages.NestedGraphSnippet2_Container1); GraphContainer machine2 = new GraphContainer(g, SWT.NONE); - machine2.setText("Machine 2"); + machine2.setText(Messages.NestedGraphSnippet2_Container2); GraphContainer machine3 = new GraphContainer(g, SWT.NONE); - machine3.setText("Machine 3"); + machine3.setText(Messages.NestedGraphSnippet2_Container3); /* Network */ GraphConnection networkConnection = new GraphConnection(g, ZestStyles.CONNECTIONS_DIRECTED, machine1, machine2); - networkConnection.setText("Network (bandwidth:1) "); + networkConnection.setText(Messages.NestedGraphSnippet2_Connection); new GraphConnection(g, SWT.NONE, machine2, machine3); /* Containers */ GraphContainer container1 = new GraphContainer(machine1, SWT.NONE); - container1.setText("Host 1"); + container1.setText(Messages.NestedGraphSnippet2_Container4); GraphContainer container2 = new GraphContainer(machine1, SWT.NONE); - container2.setText("Host 2"); + container2.setText(Messages.NestedGraphSnippet2_Container5); GraphContainer container3 = new GraphContainer(machine2, SWT.NONE); - container3.setText("Host 3"); + container3.setText(Messages.NestedGraphSnippet2_Container6); GraphContainer container4 = new GraphContainer(machine3, SWT.NONE); - container4.setText("Host 4"); + container4.setText(Messages.NestedGraphSnippet2_Container7); /* Objects */ - GraphNode object1 = new GraphNode(container1, ZestStyles.NODES_FISHEYE, "JSP Object"); - GraphNode object2 = new GraphNode(container1, ZestStyles.NODES_FISHEYE, "JSP Object 2"); - GraphNode object3 = new GraphNode(container2, ZestStyles.NODES_FISHEYE, "JSP Object 3"); - GraphNode object4 = new GraphNode(container3, ZestStyles.NODES_FISHEYE, "JSP Object 4"); - GraphNode object5 = new GraphNode(container4, ZestStyles.NODES_FISHEYE, "JSP Object 5"); + GraphNode object1 = new GraphNode(container1, ZestStyles.NODES_FISHEYE, Messages.NestedGraphSnippet2_Node1); + GraphNode object2 = new GraphNode(container1, ZestStyles.NODES_FISHEYE, Messages.NestedGraphSnippet2_Node2); + GraphNode object3 = new GraphNode(container2, ZestStyles.NODES_FISHEYE, Messages.NestedGraphSnippet2_Node3); + GraphNode object4 = new GraphNode(container3, ZestStyles.NODES_FISHEYE, Messages.NestedGraphSnippet2_Node4); + GraphNode object5 = new GraphNode(container4, ZestStyles.NODES_FISHEYE, Messages.NestedGraphSnippet2_Node5); /* Connections */ new GraphConnection(g, ZestStyles.CONNECTIONS_DIRECTED, object1, object2); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/PaintSnippet.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/PaintSnippet.java index c9f1681f0..cb18f456a 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/PaintSnippet.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/PaintSnippet.java @@ -27,6 +27,7 @@ import org.eclipse.zest.core.widgets.Graph; import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphNode; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm; import org.eclipse.draw2d.SWTGraphics; @@ -52,18 +53,18 @@ public static void main(String[] args) { // Create the shell final Shell shell = new Shell(); final Display d = shell.getDisplay(); - shell.setText("GraphSnippet1"); + shell.setText(Messages.PaintSnippet_Title); shell.setLayout(new FillLayout()); shell.setSize(400, 400); Button b = new Button(shell, SWT.PUSH); - b.setText("Take Screenshot"); + b.setText(Messages.PaintSnippet_TakeScreenshot); g = new Graph(shell, SWT.NONE); - GraphNode n = new GraphNode(g, SWT.NONE, "Paper"); - GraphNode n2 = new GraphNode(g, SWT.NONE, "Rock"); - GraphNode n3 = new GraphNode(g, SWT.NONE, "Scissors"); + GraphNode n = new GraphNode(g, SWT.NONE, Messages.Paper); + GraphNode n2 = new GraphNode(g, SWT.NONE, Messages.Rock); + GraphNode n3 = new GraphNode(g, SWT.NONE, Messages.Scissors); new GraphConnection(g, SWT.NONE, n, n2); new GraphConnection(g, SWT.NONE, n2, n3); new GraphConnection(g, SWT.NONE, n3, n); @@ -88,7 +89,7 @@ public void widgetSelected(SelectionEvent e) { gc.dispose(); Shell popup = new Shell(shell); - popup.setText("Image"); + popup.setText(Messages.PaintSnippet_Popup_Title); popup.addListener(SWT.Close, e1 -> image.dispose()); Canvas canvas = new Canvas(popup, SWT.NONE); diff --git a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/ZoomSnippet.java b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/ZoomSnippet.java index 6c2611099..2370699f7 100644 --- a/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/ZoomSnippet.java +++ b/org.eclipse.zest.examples/src/org/eclipse/zest/examples/swt/ZoomSnippet.java @@ -26,6 +26,7 @@ import org.eclipse.zest.core.widgets.GraphItem; import org.eclipse.zest.core.widgets.GraphNode; import org.eclipse.zest.core.widgets.ZestStyles; +import org.eclipse.zest.examples.Messages; import org.eclipse.zest.layouts.LayoutAlgorithm; import org.eclipse.zest.layouts.algorithms.CompositeLayoutAlgorithm; import org.eclipse.zest.layouts.algorithms.GridLayoutAlgorithm; @@ -39,18 +40,18 @@ public class ZoomSnippet { private static Image classImage; public static void createContainer(Graph g) { - GraphContainer a = new GraphContainer(g, SWT.NONE, "SomeClass.java", classImage); + GraphContainer a = new GraphContainer(g, SWT.NONE, Messages.ZoomSnippet_Container1, classImage); int r = (int) ((Math.random() * 3) + 1); r = 2; populateContainer(a, g, r, true); for (int i = 0; i < 4; i++) { - GraphContainer b = new GraphContainer(g, SWT.NONE, "SomeNestedClass.java", classImage); + GraphContainer b = new GraphContainer(g, SWT.NONE, Messages.ZoomSnippet_Container2, classImage); r = (int) ((Math.random() * 3) + 1); r = 2; populateContainer(b, g, r, false); new GraphConnection(g, SWT.NONE, a, b); for (int j = 0; j < 4; j++) { - GraphContainer c = new GraphContainer(g, SWT.NONE, "DefaultAction.java", classImage); + GraphContainer c = new GraphContainer(g, SWT.NONE, Messages.ZoomSnippet_Container3, classImage); r = (int) ((Math.random() * 3) + 1); r = 2; populateContainer(c, g, r, true); @@ -60,25 +61,25 @@ public static void createContainer(Graph g) { } public static void populateContainer(GraphContainer c, Graph g, int number, boolean radial) { - GraphNode a = new GraphNode(c, ZestStyles.NODES_FISHEYE | ZestStyles.NODES_HIDE_TEXT, "SomeClass.java", - classImage); + GraphNode a = new GraphNode(c, ZestStyles.NODES_FISHEYE | ZestStyles.NODES_HIDE_TEXT, + Messages.ZoomSnippet_Node1, classImage); for (int i = 0; i < 4; i++) { GraphNode b = new GraphNode(c, ZestStyles.NODES_FISHEYE | ZestStyles.NODES_HIDE_TEXT, - "SomeNestedClass.java", classImage); + Messages.ZoomSnippet_Node2, classImage); new GraphConnection(g, SWT.NONE, a, b); for (int j = 0; j < 4; j++) { GraphNode d = new GraphNode(c, ZestStyles.NODES_FISHEYE | ZestStyles.NODES_HIDE_TEXT, - "DefaultAction.java", classImage); + Messages.ZoomSnippet_Node3, classImage); new GraphConnection(g, SWT.NONE, b, d); if (number > 2) { for (int k = 0; k < 4; k++) { GraphNode e = new GraphNode(c, ZestStyles.NODES_FISHEYE | ZestStyles.NODES_HIDE_TEXT, - "LastAction(Hero).java", classImage); + Messages.ZoomSnippet_Node4, classImage); new GraphConnection(g, SWT.NONE, d, e); if (number > 3) { for (int l = 0; l < 4; l++) { GraphNode f = new GraphNode(c, ZestStyles.NODES_FISHEYE | ZestStyles.NODES_HIDE_TEXT, - "LastAction(Hero).java", classImage); + Messages.ZoomSnippet_Node5, classImage); new GraphConnection(g, SWT.NONE, e, f); } } @@ -105,12 +106,12 @@ public static void populateContainer(GraphContainer c, Graph g, int number, bool */ public static void main(String[] args) { // Create the shell - image1 = new Image(Display.getDefault(), ZoomSnippet.class.getResourceAsStream("package_obj.gif")); - classImage = new Image(Display.getDefault(), ZoomSnippet.class.getResourceAsStream("class_obj.gif")); + image1 = new Image(Display.getDefault(), ZoomSnippet.class.getResourceAsStream("package_obj.gif")); //$NON-NLS-1$ + classImage = new Image(Display.getDefault(), ZoomSnippet.class.getResourceAsStream("class_obj.gif")); //$NON-NLS-1$ Shell shell = new Shell(); Display d = shell.getDisplay(); - shell.setText("GraphSnippet1"); + shell.setText(Messages.ZoomSnippet_Title); shell.setLayout(new FillLayout()); shell.setSize(500, 800);