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