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