]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/tooltip/TerminalTooltipProvider.java
Let the request processor handle the exceptions
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / tooltip / TerminalTooltipProvider.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.g2d.tooltip;
13
14 import java.awt.Color;
15 import java.awt.Frame;
16
17 import javax.swing.BorderFactory;
18 import javax.swing.BoxLayout;
19 import javax.swing.JLabel;
20 import javax.swing.JPanel;
21
22 import org.simantics.g2d.element.IElement;
23
24 /**
25  * 
26  * @author Marko Luukkainen <marko.luukkainen@vtt.fi>
27  *
28  */
29 public class TerminalTooltipProvider extends AWTTooltipProvider {
30
31     public static TerminalTooltipProvider INSTANCE = new TerminalTooltipProvider();
32
33
34
35     @Override
36     public void constructPopup(Frame frame, IElement element) {
37         frame.setLayout(new BoxLayout(frame, BoxLayout.X_AXIS));
38         JPanel panel = new JPanel();
39         panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
40         Color c = new Color(255, 255, 220);
41         panel.setBackground(c);
42         panel.setBorder(BorderFactory.createLineBorder(Color.black));
43         JLabel label = new JLabel((String)element.getHint(TerminalTooltipParticipant.KEY_TOOLTIP_TEXT));
44         panel.add(label);
45         frame.add(panel);
46     }
47
48 }