1 | /* |
---|
2 | * This file is part of Modelica Development Tooling. |
---|
3 | * |
---|
4 | * Copyright (c) 2006, Adrian Pop, adrpo@ida.liu.se |
---|
5 | * |
---|
6 | * created Februrary 19, 2006 |
---|
7 | */ |
---|
8 | |
---|
9 | package org.modelica.mdt.ui.view; |
---|
10 | |
---|
11 | import org.eclipse.jface.text.IDocument; |
---|
12 | import org.eclipse.swt.widgets.Composite; |
---|
13 | import org.eclipse.ui.part.*; |
---|
14 | import org.modelica.mdt.ui.UIPlugin; |
---|
15 | import org.modelica.mdt.ui.console.ModelicaTextConsole; |
---|
16 | import org.modelica.mdt.ui.console.ModelicaTextConsoleViewer; |
---|
17 | |
---|
18 | /** |
---|
19 | * @author Adrian Pop |
---|
20 | * The ModelicaConsole is used to display the Modelica compiler's output |
---|
21 | * @see ViewPart |
---|
22 | */ |
---|
23 | public class ModelicaConsoleView extends ViewPart |
---|
24 | { |
---|
25 | |
---|
26 | private ModelicaTextConsoleViewer viewer = null; |
---|
27 | private ModelicaTextConsole console = null; |
---|
28 | public static final String ID = "org.modelica.mdt.ui.view.ModelicaConsoleView"; |
---|
29 | |
---|
30 | /** |
---|
31 | * The constructor. |
---|
32 | */ |
---|
33 | public ModelicaConsoleView() |
---|
34 | { |
---|
35 | console = UIPlugin.getDefault().getModelicaTextConsole(); |
---|
36 | } |
---|
37 | |
---|
38 | public IDocument getDocument() |
---|
39 | { |
---|
40 | return console.getDocument(); |
---|
41 | } |
---|
42 | public ModelicaTextConsole getConsole() |
---|
43 | { |
---|
44 | return console; |
---|
45 | } |
---|
46 | |
---|
47 | public ModelicaTextConsoleViewer getViewer(Composite parent) |
---|
48 | { |
---|
49 | viewer = new ModelicaTextConsoleViewer(parent, console); |
---|
50 | return viewer; |
---|
51 | } |
---|
52 | |
---|
53 | /** |
---|
54 | * Insert the method's description here. |
---|
55 | * @see ViewPart#createPartControl |
---|
56 | */ |
---|
57 | public void createPartControl(Composite parent) |
---|
58 | { |
---|
59 | viewer = getViewer(parent); |
---|
60 | viewer.setDocument(getDocument()); |
---|
61 | viewer.setEditable(true); |
---|
62 | } |
---|
63 | |
---|
64 | /** |
---|
65 | * Passing the focus request to the viewer's control. |
---|
66 | */ |
---|
67 | public void setFocus() |
---|
68 | { |
---|
69 | viewer.getControl().setFocus(); |
---|
70 | } |
---|
71 | |
---|
72 | } |
---|
73 | |
---|