]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.selectionview/src/org/simantics/selectionview/TabChangeEvent.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.selectionview / src / org / simantics / selectionview / TabChangeEvent.java
1 package org.simantics.selectionview;
2
3
4 /**
5  * @author Tuukka Lehtonen
6  */
7 public class TabChangeEvent {
8
9     private final IPropertyTab oldTab;
10     private final String       oldTabLabel;
11     private final IPropertyTab newTab;
12     private final String       newTabLabel;
13
14     /**
15      * @param oldTab
16      * @param oldTabLabel
17      * @param newTab
18      * @param newTabLabel
19      */
20     public TabChangeEvent(IPropertyTab oldTab, String oldTabLabel, IPropertyTab newTab, String newTabLabel) {
21         this.oldTab = oldTab;
22         this.oldTabLabel = oldTabLabel;
23         this.newTab = newTab;
24         this.newTabLabel = newTabLabel;
25     }
26
27     /**
28      * @return <code>null</code> if no tab is currently selected or no tabs
29      *         exist
30      */
31     public IPropertyTab getNewTab() {
32         return newTab;
33     }
34
35     /**
36      * @return <code>null</code> if no tab is currently selected or no tabs
37      *         exist
38      */
39     public String getNewTabLabel() {
40         return newTabLabel;
41     }
42
43     /**
44      * @return <code>null</code> if no tab was previously selected
45      */
46     public IPropertyTab getOldTab() {
47         return oldTab;
48     }
49
50     /**
51      * @return <code>null</code> if no tab was previously selected
52      */
53     public String getOldTabLabel() {
54         return oldTabLabel;
55     }
56
57     @Override
58     public String toString() {
59         return getClass().getSimpleName() + "(" + oldTabLabel + " - " + oldTab + " => " + newTabLabel + " - " + newTab + ")";
60     }
61
62 }