|
9 | 9 | import org.eclipse.draw2d.MarginBorder;
|
10 | 10 | import org.eclipse.draw2d.Viewport;
|
11 | 11 | import org.eclipse.draw2d.parts.ScrollableThumbnail;
|
12 |
| -import org.eclipse.gef.EditPart; |
13 | 12 | import org.eclipse.gef.LayerConstants;
|
14 | 13 | import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
|
15 | 14 | import org.eclipse.help.HelpSystem;
|
|
36 | 35 | */
|
37 | 36 | public class OverviewOutlinePage extends Page implements IContentOutlinePage, IContextProvider {
|
38 | 37 |
|
39 |
| - private Canvas fCanvas; |
40 |
| - private ScrollableThumbnail fThumbnail; |
41 |
| - private ScalableFreeformRootEditPart fEditPart; |
| 38 | + private ScalableFreeformRootEditPart editPart; |
| 39 | + private Canvas canvas; |
| 40 | + private ScrollableThumbnail thumbnail; |
42 | 41 |
|
43 | 42 | public static String HELP_ID = "com.archimatetool.help.outlineViewHelp"; //$NON-NLS-1$
|
44 | 43 |
|
45 | 44 | /**
|
46 |
| - * Creates a new OverviewOutlinePage instance. |
47 |
| - * @param abstractDiagramEditor |
| 45 | + * Creates a new OverviewOutlinePage instance for editPart |
48 | 46 | */
|
49 |
| - public OverviewOutlinePage(IDiagramModelEditor editor) { |
50 |
| - fEditPart = (ScalableFreeformRootEditPart)editor.getAdapter(EditPart.class); |
| 47 | + public OverviewOutlinePage(ScalableFreeformRootEditPart editPart) { |
| 48 | + this.editPart = editPart; |
51 | 49 | }
|
52 | 50 |
|
53 | 51 | @Override
|
54 | 52 | public void createControl(Composite parent) {
|
55 |
| - if(fEditPart == null) { |
56 |
| - return; |
57 |
| - } |
58 |
| - |
59 |
| - // create canvas and lws |
60 |
| - fCanvas = new Canvas(parent, SWT.NONE); |
61 |
| - LightweightSystem lws = new LightweightSystem(fCanvas); |
| 53 | + // Create Canvas and LWS |
| 54 | + canvas = new Canvas(parent, SWT.NONE); |
| 55 | + LightweightSystem lws = new LightweightSystem(canvas); |
62 | 56 |
|
63 |
| - fThumbnail = new ScrollableThumbnail((Viewport)fEditPart.getFigure()); |
64 |
| - fThumbnail.setUseScaledGraphics(false); |
65 |
| - fThumbnail.setSource(fEditPart.getLayer(LayerConstants.PRINTABLE_LAYERS)); |
66 |
| - fThumbnail.setBorder(new MarginBorder(3)); |
67 |
| - lws.setContents(fThumbnail); |
| 57 | + // Thumbnail is contents of LWS |
| 58 | + thumbnail = new ScrollableThumbnail((Viewport)editPart.getFigure()); |
| 59 | + thumbnail.setUseScaledGraphics(false); |
| 60 | + thumbnail.setSource(editPart.getLayer(LayerConstants.PRINTABLE_LAYERS)); |
| 61 | + thumbnail.setBorder(new MarginBorder(3)); |
| 62 | + lws.setContents(thumbnail); |
68 | 63 |
|
69 | 64 | // Help
|
70 |
| - PlatformUI.getWorkbench().getHelpSystem().setHelp(fCanvas, HELP_ID); |
| 65 | + PlatformUI.getWorkbench().getHelpSystem().setHelp(canvas, HELP_ID); |
71 | 66 | }
|
72 | 67 |
|
73 | 68 | @Override
|
74 | 69 | public void dispose() {
|
75 |
| - if(fThumbnail != null) { |
76 |
| - fThumbnail.deactivate(); |
77 |
| - fThumbnail = null; |
| 70 | + if(thumbnail != null) { |
| 71 | + thumbnail.deactivate(); |
| 72 | + thumbnail = null; |
78 | 73 | }
|
79 | 74 | super.dispose();
|
80 | 75 | }
|
81 | 76 |
|
82 | 77 | @Override
|
83 | 78 | public Control getControl() {
|
84 |
| - return fCanvas; |
| 79 | + return canvas; |
85 | 80 | }
|
86 | 81 |
|
87 | 82 | @Override
|
|
0 commit comments