1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in 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
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.ui.workbench;
\r
14 import org.eclipse.swt.widgets.Composite;
\r
15 import org.eclipse.ui.forms.widgets.FormToolkit;
\r
16 import org.eclipse.ui.forms.widgets.ScrolledForm;
\r
20 * This class acts as a base class for Eclipse forms-based form-editors in a
\r
21 * using the ProCore semantic triple data model.
\r
23 * Extend SinglePageTypeEditor or MultiPageFormView to create your own editor,
\r
26 * @author Antti Villberg
\r
27 * @author Tuukka Lehtonen
\r
29 public abstract class ResourceFormViewPart extends ResourceInputViewPart {
\r
31 protected FormToolkit toolkit;
\r
33 //----------------------------------------------------------------------
\r
36 public FormToolkit getToolkit() {
\r
41 //----------------------------------------------------------------------
\r
44 public void reflow(boolean flushCache) {
\r
45 //System.out.println("FormTypeEditorBase.reflow(" + flushCache + ")");
\r
46 getActiveForm().reflow(flushCache);
\r
50 //----------------------------------------------------------------------
\r
51 // Event handlers & initialisation
\r
54 public void createPartControl(Composite parent) {
\r
55 this.toolkit = new FormToolkit(parent.getDisplay());
\r
56 super.createPartControl(parent);
\r
60 public void dispose() {
\r
61 if (toolkit != null) {
\r
68 public void setFocus() {
\r
69 //System.out.println("FormTypeEditorBase.setFocus(): Input = " + getInput());
\r
70 ScrolledForm form = getActiveForm();
\r
77 //----------------------------------------------------------------------
\r
78 // Implement these yourself:
\r
80 public abstract ScrolledForm getActiveForm();
\r
82 protected abstract String getFormText();
\r