-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.ui.workbench;\r
-\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.ui.forms.widgets.FormToolkit;\r
-import org.eclipse.ui.forms.widgets.ScrolledForm;\r
-\r
-\r
-/**\r
- * This class acts as a base class for Eclipse forms-based form-editors in a\r
- * using the ProCore semantic triple data model.\r
- * \r
- * Extend SinglePageTypeEditor or MultiPageFormView to create your own editor,\r
- * not this one.\r
- * \r
- * @author Antti Villberg\r
- * @author Tuukka Lehtonen\r
- */\r
-public abstract class ResourceFormViewPart extends ResourceInputViewPart {\r
-\r
- protected FormToolkit toolkit;\r
-\r
- //----------------------------------------------------------------------\r
- // Getters\r
- \r
- public FormToolkit getToolkit() {\r
- return toolkit;\r
- }\r
- \r
- \r
- //----------------------------------------------------------------------\r
- // Event utilities\r
-\r
- public void reflow(boolean flushCache) {\r
- //System.out.println("FormTypeEditorBase.reflow(" + flushCache + ")");\r
- getActiveForm().reflow(flushCache);\r
- }\r
- \r
- \r
- //----------------------------------------------------------------------\r
- // Event handlers & initialisation\r
-\r
- @Override\r
- public void createPartControl(Composite parent) {\r
- this.toolkit = new FormToolkit(parent.getDisplay());\r
- super.createPartControl(parent);\r
- }\r
-\r
- @Override\r
- public void dispose() {\r
- if (toolkit != null) {\r
- toolkit.dispose();\r
- }\r
- super.dispose();\r
- }\r
- \r
- @Override\r
- public void setFocus() {\r
- //System.out.println("FormTypeEditorBase.setFocus(): Input = " + getInput());\r
- ScrolledForm form = getActiveForm();\r
- if (form != null) {\r
- form.setFocus();\r
- }\r
- }\r
-\r
- \r
- //----------------------------------------------------------------------\r
- // Implement these yourself:\r
- \r
- public abstract ScrolledForm getActiveForm();\r
-\r
- protected abstract String getFormText();\r
- \r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.ui.workbench;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+
+
+/**
+ * This class acts as a base class for Eclipse forms-based form-editors in a
+ * using the ProCore semantic triple data model.
+ *
+ * Extend SinglePageTypeEditor or MultiPageFormView to create your own editor,
+ * not this one.
+ *
+ * @author Antti Villberg
+ * @author Tuukka Lehtonen
+ */
+public abstract class ResourceFormViewPart extends ResourceInputViewPart {
+
+ protected FormToolkit toolkit;
+
+ //----------------------------------------------------------------------
+ // Getters
+
+ public FormToolkit getToolkit() {
+ return toolkit;
+ }
+
+
+ //----------------------------------------------------------------------
+ // Event utilities
+
+ public void reflow(boolean flushCache) {
+ //System.out.println("FormTypeEditorBase.reflow(" + flushCache + ")");
+ getActiveForm().reflow(flushCache);
+ }
+
+
+ //----------------------------------------------------------------------
+ // Event handlers & initialisation
+
+ @Override
+ public void createPartControl(Composite parent) {
+ this.toolkit = new FormToolkit(parent.getDisplay());
+ super.createPartControl(parent);
+ }
+
+ @Override
+ public void dispose() {
+ if (toolkit != null) {
+ toolkit.dispose();
+ }
+ super.dispose();
+ }
+
+ @Override
+ public void setFocus() {
+ //System.out.println("FormTypeEditorBase.setFocus(): Input = " + getInput());
+ ScrolledForm form = getActiveForm();
+ if (form != null) {
+ form.setFocus();
+ }
+ }
+
+
+ //----------------------------------------------------------------------
+ // Implement these yourself:
+
+ public abstract ScrolledForm getActiveForm();
+
+ protected abstract String getFormText();
+
+}