]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.selectionview/src/org/simantics/selectionview/IPropertyTab.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.selectionview / src / org / simantics / selectionview / IPropertyTab.java
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
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.selectionview;\r
13 \r
14 import org.eclipse.jface.viewers.ISelection;\r
15 import org.eclipse.jface.viewers.ISelectionProvider;\r
16 import org.eclipse.jface.viewers.IStructuredSelection;\r
17 import org.eclipse.swt.widgets.Composite;\r
18 import org.eclipse.swt.widgets.Control;\r
19 import org.simantics.db.management.ISessionContext;\r
20 \r
21 /**\r
22  * @author Tuukka Lehtonen\r
23  * \r
24  * @see PropertyTabAdapter\r
25  * @see PropertyTabContributorImpl\r
26  */\r
27 public interface IPropertyTab {\r
28 \r
29     /**\r
30      * Creates the SWT control for this page under the given parent\r
31      * control.\r
32      * <p>\r
33      * Clients should not call this method (the workbench calls this method when\r
34      * it needs to, which may be never).\r
35      * </p>\r
36      *\r
37      * @param parent the parent control\r
38      */\r
39     void createControl(Composite parent, ISessionContext context);\r
40 \r
41     /**\r
42      * Notifies that the container of the tab has been disposed.\r
43      * \r
44      * <p>\r
45      * Note, this means that any Dispose-listeners attached to SWT controls\r
46      * created for this tab have been invoked before this already.\r
47      * </p>\r
48      * <p>\r
49      * Also note that there is no guarantee that\r
50      * {@link #createControl(Composite, ISessionContext)} has been called before\r
51      * this method so the control may never have been created.\r
52      * </p>\r
53      */\r
54     void dispose();\r
55 \r
56     /**\r
57      * @return <code>true</code> if this tab has been disposed either through\r
58      *         {@link #dispose()} or internally by the UI toolkit\r
59      */\r
60     boolean isDisposed();\r
61 \r
62     /**\r
63      * @return the main UI control created by this tab\r
64      */\r
65     Control getControl();\r
66 \r
67     /**\r
68      * Must be invoked from the SWT UI thread.\r
69      * \r
70      * @param selection the new selection\r
71      * @param force <code>true</code> to force the resetting of the new input\r
72      *        even if it is the same as the previous one.\r
73      */\r
74     void setInput(ISessionContext context, ISelection selection, boolean force);\r
75 \r
76     /**\r
77      * Returns the selection provider for this property tab. It shall provide\r
78      * the currently active selection for this tab. If the tab does not wish to\r
79      * provide its selection to external parties, <code>null</code> may be\r
80      * returned. The selections must be instances of\r
81      * {@link IStructuredSelection}.\r
82      * \r
83      * @return structured selection provider or <code>null</code> if no\r
84      *         selection is provided\r
85      */\r
86     ISelectionProvider getSelectionProvider();\r
87 \r
88     /**\r
89      * Requests this property tab to transfer UI focus to itself.\r
90      */\r
91     void requestFocus();\r
92 \r
93 }