11/*******************************************************************************
2- * Copyright (c) 2005, 2023 IBM Corporation and others.
2+ * Copyright (c) 2005, 2025 IBM Corporation and others.
33 *
44 * This program and the accompanying materials are made available under the
55 * terms of the Eclipse Public License 2.0 which is available at
2929import org .eclipse .draw2d .XYLayout ;
3030import org .eclipse .draw2d .geometry .Dimension ;
3131import org .eclipse .draw2d .geometry .Rectangle ;
32+ import org .eclipse .draw2d .internal .FileImageDataProvider ;
3233import org .eclipse .draw2d .parts .Thumbnail ;
3334
3435/**
3839 */
3940
4041public class ZoomExample {
41-
42+ private static final Image IMG_CLASS = FileImageDataProvider .createImage (UMLClassFigure .class ,
43+ "images/class_obj.svg" ); //$NON-NLS-1$
44+ private static final Image IMG_FIELD_PRIVATE = FileImageDataProvider .createImage (UMLClassFigure .class ,
45+ "images/field_private_obj.svg" ); //$NON-NLS-1$
46+ private static final Image IMG_METHOD_PUBLIC = FileImageDataProvider .createImage (UMLClassFigure .class ,
47+ "images/methpub_obj.svg" ); //$NON-NLS-1$
4248 private static Figure contents ;
4349
4450 public static void main (String [] args ) {
45- Display d = new Display ();
46- final Shell shell = new Shell ( d );
51+ final Shell shell = new Shell ();
52+ final Display d = shell . getDisplay ( );
4753 shell .setSize (800 , 800 );
4854 LightweightSystem lws = new LightweightSystem (shell );
4955
@@ -77,20 +83,10 @@ public static void main(String[] args) {
7783
7884 lws .setContents (fig );
7985
80- // overviewShell = new Shell(shell, SWT.TITLE| SWT.RESIZE | SWT.NO_REDRAW_RESIZE
81- // | SWT.NO_BACKGROUND);
82- // overviewShell.setText("Overview Shell");
83- // overviewShell.setLayout(new FillLayout());
84- // LightweightSystem overviewLWS = new LightweightSystem(overviewShell);
85- // overviewLWS.setContents(createThumbnail(getContents()));
86- // overviewShell.setSize(200, 200);
87-
8886 shell .open ();
89- // overviewShell.open();
9087 while (!shell .isDisposed ()) {
9188 while (!d .readAndDispatch ()) {
9289 d .sleep ();
93- // overviewShell.dispose();
9490 }
9591 }
9692 }
@@ -115,39 +111,29 @@ private static Figure createContents() {
115111 contents .setLayoutManager (layout );
116112
117113 Font classFont = new Font (null , "Arial" , 12 , SWT .BOLD ); //$NON-NLS-1$
118- Label classLabel1 = new Label ("Table" , //$NON-NLS-1$
119- new Image (null , ZoomExample .class .getResourceAsStream ("images/class_obj.gif" ))); //$NON-NLS-1$
114+ Label classLabel1 = new Label ("Table" , IMG_CLASS ); //$NON-NLS-1$
120115 classLabel1 .setFont (classFont );
121116
122- Label classLabel2 = new Label ("Column" , //$NON-NLS-1$
123- new Image (null , ZoomExample .class .getResourceAsStream ("images/class_obj.gif" ))); //$NON-NLS-1$
117+ Label classLabel2 = new Label ("Column" , IMG_CLASS );//$NON-NLS-1$
124118 classLabel2 .setFont (classFont );
125119
126120 final UMLClassFigure classFigure = new UMLClassFigure (classLabel1 );
127121 final UMLClassFigure classFigure2 = new UMLClassFigure (classLabel2 );
128122
129- Label attribute1 = new Label ("columns: Column[]" , //$NON-NLS-1$
130- new Image (null , UMLClassFigure .class .getResourceAsStream ("images/field_private_obj.gif" ))); //$NON-NLS-1$
131- Label attribute2 = new Label ("rows: Row[]" , //$NON-NLS-1$
132- new Image (null , UMLClassFigure .class .getResourceAsStream ("images/field_private_obj.gif" ))); //$NON-NLS-1$
133- Label attribute3 = new Label ("columnID: int" , //$NON-NLS-1$
134- new Image (null , UMLClassFigure .class .getResourceAsStream ("images/field_private_obj.gif" ))); //$NON-NLS-1$
135- Label attribute4 = new Label ("items: List" , //$NON-NLS-1$
136- new Image (null , UMLClassFigure .class .getResourceAsStream ("images/field_private_obj.gif" ))); //$NON-NLS-1$
123+ Label attribute1 = new Label ("columns: Column[]" , IMG_FIELD_PRIVATE ); //$NON-NLS-1$
124+ Label attribute2 = new Label ("rows: Row[]" , IMG_FIELD_PRIVATE ); //$NON-NLS-1$
125+ Label attribute3 = new Label ("columnID: int" , IMG_FIELD_PRIVATE );//$NON-NLS-1$
126+ Label attribute4 = new Label ("items: List" , IMG_FIELD_PRIVATE );//$NON-NLS-1$
137127
138128 classFigure .getAttributesCompartment ().add (attribute1 );
139129 classFigure .getAttributesCompartment ().add (attribute2 );
140130 classFigure2 .getAttributesCompartment ().add (attribute3 );
141131 classFigure2 .getAttributesCompartment ().add (attribute4 );
142132
143- Label method1 = new Label ("getColumns(): Column[]" , //$NON-NLS-1$
144- new Image (null , UMLClassFigure .class .getResourceAsStream ("images/methpub_obj.gif" ))); //$NON-NLS-1$
145- Label method2 = new Label ("getRows(): Row[]" , //$NON-NLS-1$
146- new Image (null , UMLClassFigure .class .getResourceAsStream ("images/methpub_obj.gif" ))); //$NON-NLS-1$
147- Label method3 = new Label ("getColumnID(): int" , //$NON-NLS-1$
148- new Image (null , UMLClassFigure .class .getResourceAsStream ("images/methpub_obj.gif" ))); //$NON-NLS-1$
149- Label method4 = new Label ("getItems(): List" , //$NON-NLS-1$
150- new Image (null , UMLClassFigure .class .getResourceAsStream ("images/methpub_obj.gif" ))); //$NON-NLS-1$
133+ Label method1 = new Label ("getColumns(): Column[]" , IMG_METHOD_PUBLIC ); //$NON-NLS-1$
134+ Label method2 = new Label ("getRows(): Row[]" , IMG_METHOD_PUBLIC ); //$NON-NLS-1$
135+ Label method3 = new Label ("getColumnID(): int" , IMG_METHOD_PUBLIC ); //$NON-NLS-1$
136+ Label method4 = new Label ("getItems(): List" , IMG_METHOD_PUBLIC ); //$NON-NLS-1$
151137
152138 classFigure .getMethodsCompartment ().add (method1 );
153139 classFigure .getMethodsCompartment ().add (method2 );
0 commit comments