KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > intro > impl > parts > EmptyStandbyContentPart


1 /*******************************************************************************
2  * Copyright (c) 2004, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.intro.impl.parts;
12
13
14 import org.eclipse.swt.SWT;
15 import org.eclipse.swt.layout.GridData;
16 import org.eclipse.swt.layout.GridLayout;
17 import org.eclipse.swt.widgets.Composite;
18 import org.eclipse.swt.widgets.Control;
19 import org.eclipse.swt.widgets.Label;
20 import org.eclipse.swt.widgets.Text;
21 import org.eclipse.ui.IMemento;
22 import org.eclipse.ui.forms.widgets.FormToolkit;
23 import org.eclipse.ui.internal.intro.impl.Messages;
24 import org.eclipse.ui.internal.intro.impl.swt.PageStyleManager;
25 import org.eclipse.ui.intro.IIntroPart;
26 import org.eclipse.ui.intro.config.IStandbyContentPart;
27
28
29
30 public class EmptyStandbyContentPart implements IStandbyContentPart {
31
32     private Composite contentComposite;
33     private Text contentText;
34
35     /*
36      * (non-Javadoc)
37      *
38      * @see org.eclipse.ui.intro.config.IStandbyContentPart#createPartControl(org.eclipse.swt.widgets.Composite,
39      * org.eclipse.ui.forms.widgets.FormToolkit)
40      */

41     public void createPartControl(Composite parent, FormToolkit toolkit) {
42         contentComposite = toolkit.createComposite(parent);
43         contentComposite.setLayout(new GridLayout());
44         // Util.highlight(contentComposite, SWT.COLOR_YELLOW);
45

46         String JavaDoc text = Messages.EmptyStandbyContentPart_text;
47         Label label = toolkit.createLabel(contentComposite, text, SWT.WRAP);
48         label.setFont(PageStyleManager.getBannerFont());
49         GridData gd = new GridData(GridData.FILL_HORIZONTAL);
50         label.setLayoutData(gd);
51
52         contentText = toolkit.createText(contentComposite, " ", SWT.MULTI //$NON-NLS-1$
53
| SWT.WRAP);
54         GridData textGd = new GridData(GridData.FILL_BOTH);
55         contentText.setLayoutData(textGd);
56     }
57
58     /*
59      * (non-Javadoc)
60      *
61      * @see org.eclipse.ui.intro.config.IStandbyContentPart#getControl()
62      */

63     public Control getControl() {
64         return contentComposite;
65     }
66
67
68     public void setMessage(String JavaDoc message) {
69         if (message != null) {
70             contentText.setText(message);
71             contentComposite.layout();
72         }
73     }
74
75
76     /*
77      * (non-Javadoc)
78      *
79      * @see org.eclipse.ui.intro.config.IStandbyContentPart#init(org.eclipse.ui.intro.IIntroPart)
80      */

81     public void init(IIntroPart introPart, IMemento memento) {
82         // no-op
83
}
84
85     /*
86      * (non-Javadoc)
87      *
88      * @see org.eclipse.ui.intro.config.IStandbyContentPart#setInput(java.lang.Object)
89      */

90     public void setInput(Object JavaDoc input) {
91         if (input != null)
92             setMessage((String JavaDoc) input);
93         else
94             setMessage(""); //$NON-NLS-1$
95
}
96
97     /*
98      * (non-Javadoc)
99      *
100      * @see org.eclipse.ui.intro.config.IStandbyContentPart#setFocus()
101      */

102     public void setFocus() {
103         // no-op
104
}
105
106     /*
107      * (non-Javadoc)
108      *
109      * @see org.eclipse.ui.intro.config.IStandbyContentPart#dispose()
110      */

111     public void dispose() {
112         // no-op
113
}
114
115     public void saveState(IMemento memento) {
116         // no-op
117
}
118
119 }
120
Popular Tags