]> gerrit.simantics Code Review - simantics/sysdyn.git/blob
5164aa97f1e4208816a0f8828c7b49769d77a20f
[simantics/sysdyn.git] /
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
3  * Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.sysdyn.ui.properties;\r
13 \r
14 import org.eclipse.jface.layout.GridDataFactory;\r
15 import org.eclipse.jface.layout.GridLayoutFactory;\r
16 import org.eclipse.swt.SWT;\r
17 import org.eclipse.swt.widgets.Composite;\r
18 import org.eclipse.ui.IWorkbenchSite;\r
19 import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory;\r
20 import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;\r
21 import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
22 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
23 import org.simantics.db.management.ISessionContext;\r
24 import org.simantics.layer0.Layer0;\r
25 import org.simantics.sysdyn.ui.properties.widgets.factories.FunctionLibraryNameInputValidator;\r
26 \r
27 public class FunctionLibraryTab extends LabelPropertyTabContributor {\r
28 \r
29         @Override\r
30         public void createControls(Composite body, IWorkbenchSite site,\r
31                         ISessionContext context, WidgetSupport support) {\r
32                 Composite composite = new Composite(body, SWT.NONE);\r
33                 GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
34                 GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(composite);\r
35 \r
36 \r
37                 TrackedText nameText = new TrackedText(composite, support, SWT.BORDER);\r
38                 nameText.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasName));\r
39                 nameText.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasName));\r
40         nameText.setInputValidator(new FunctionLibraryNameInputValidator(support));\r
41                 GridDataFactory.fillDefaults().grab(true, false).applyTo(nameText.getWidget());\r
42 \r
43 \r
44                 TrackedText information = new TrackedText(composite, support, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);\r
45                 information.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasDescription));\r
46                 information.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasDescription));\r
47                 GridDataFactory.fillDefaults().grab(true, true).applyTo(information.getWidget());\r
48         }\r
49 \r
50 }\r