Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2013-08-12 03:58:06 -0400
committerTobias Schwarz2013-08-12 03:59:35 -0400
commit208f29245431c2df5a60b9279bcaebaeb75f3b3a (patch)
tree1ef74cb2c3d1843fb3cd4c2c7b4e56fe7738b10d /target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf
parent1f482cb64df904d101e8fa2f5a13484c413bac1e (diff)
downloadorg.eclipse.tcf-208f29245431c2df5a60b9279bcaebaeb75f3b3a.tar.gz
org.eclipse.tcf-208f29245431c2df5a60b9279bcaebaeb75f3b3a.tar.xz
org.eclipse.tcf-208f29245431c2df5a60b9279bcaebaeb75f3b3a.zip
Target Explorer: add possibility to get peermodel thread save
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/BaseTitledSection.java38
1 files changed, 37 insertions, 1 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/BaseTitledSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/BaseTitledSection.java
index 7d3e43e44..d620a9c7f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/BaseTitledSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/BaseTitledSection.java
@@ -22,6 +22,7 @@ import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
@@ -70,7 +71,7 @@ public abstract class BaseTitledSection extends AbstractPropertySection implemen
if (provider != null) {
this.provider = provider;
- IPeerModel peerNode = this.provider.getPeerModel();
+ IPeerModel peerNode = getPeerModel(provider);
this.viewerInput = (IPropertyChangeProvider) peerNode.getAdapter(IPropertyChangeProvider.class);
if (this.viewerInput != null) {
this.viewerInput.addPropertyChangeListener(this);
@@ -83,6 +84,17 @@ public abstract class BaseTitledSection extends AbstractPropertySection implemen
}
/**
+ * Get the peer model from the provider.
+ * Needs to be overwritten in case of save thread access.
+ * @param provider
+ * @return
+ */
+ protected IPeerModel getPeerModel(IPeerModelProvider provider) {
+ Assert.isNotNull(provider);
+ return provider.getPeerModel();
+ }
+
+ /**
* Update the input node.
*
* @param input The input node.
@@ -162,6 +174,30 @@ public abstract class BaseTitledSection extends AbstractPropertySection implemen
}
/**
+ * Create a checkbox with the specified label
+ * relative to the specified control.
+ *
+ * @param control The control relative to.
+ * @param label The text of the label.
+ * @return The new checkbox created.
+ */
+ protected Button createCheckbox(Control control, String label) {
+ Button check = getWidgetFactory().createButton(composite, label, SWT.CHECK);
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
+ data.right = new FormAttachment(100, 0);
+ if (control == null) {
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ }
+ else {
+ data.top = new FormAttachment(control, ITabbedPropertyConstants.VSPACE);
+ }
+ check.setLayoutData(data);
+ check.setEnabled(false);
+ return check;
+ }
+
+ /**
* Create a wrap text field and a label with the specified label
* relative to the specified control.
*

Back to the top