]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.views.swt.client/src/org/simantics/views/swt/client/impl/SWTText.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.views.swt.client / src / org / simantics / views / swt / client / impl / SWTText.java
1 package org.simantics.views.swt.client.impl;
2
3 import org.eclipse.swt.graphics.Point;
4 import org.eclipse.swt.widgets.Composite;
5 import org.eclipse.swt.widgets.Text;
6 import org.simantics.views.swt.client.base.SingleSWTViewNode;
7
8 public class SWTText extends SingleSWTViewNode<Text> {
9         
10         private static final long serialVersionUID = 7932335224632082902L;
11         
12         @Override
13         public void createControls(Composite parent) {
14                 
15                 control = new Text(parent, style);
16                 control.setEnabled(false);
17                 setProperties();
18                 
19         }
20         
21         @Override
22         public void synchronizeText(String text) {
23                 if(text != null) {
24                         control.setText(text);
25                         control.setEnabled(true);
26                         control.getParent().layout();
27                 } else {
28                         control.setText("");
29                         control.setEnabled(false);
30                         control.getParent().layout();
31                 }
32         }
33         
34         public String readText() {
35                 return control.getText();
36         }
37         
38         public Point readSelection() {
39                 return control.getSelection();
40         }
41
42 }