Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-02-16 16:23:59 +0000
committerUwe Stieber2012-02-16 16:23:59 +0000
commit0809f72580fd3293e949f9454cf0ab21343d2cd3 (patch)
treeda7d8f8e589db4c8230773292c9d782a632780b8 /target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src
parent8daa2b2006de61d0be9af0fe0be8f03cda501d7e (diff)
downloadorg.eclipse.tcf-0809f72580fd3293e949f9454cf0ab21343d2cd3.tar.gz
org.eclipse.tcf-0809f72580fd3293e949f9454cf0ab21343d2cd3.tar.xz
org.eclipse.tcf-0809f72580fd3293e949f9454cf0ab21343d2cd3.zip
Target Explorer: Continue launch context selector work
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractSection.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractSection.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractSection.java
index 375e1453e..24263c38d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.forms/src/org/eclipse/tcf/te/ui/forms/parts/AbstractSection.java
@@ -14,11 +14,17 @@ import java.lang.reflect.Field;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.tcf.te.ui.forms.FormLayoutFactory;
import org.eclipse.tcf.te.ui.jface.interfaces.IValidatable;
import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
@@ -111,6 +117,56 @@ public abstract class AbstractSection extends SectionPart implements IAdaptable,
return emptySpace;
}
+ /**
+ * Convenience method to create a section toolbar.
+ *
+ * @param section The section. Must not be <code>null</code>.
+ * @param toolkit The form toolkit or <code>null</code>.
+ */
+ protected void createSectionToolbar(Section section, FormToolkit toolkit) {
+ Assert.isNotNull(section);
+
+ // Create the toolbar manager and the toolbar control
+ ToolBarManager tlbMgr = new ToolBarManager(SWT.FLAT);
+ ToolBar tlb = tlbMgr.createControl(section);
+
+ // If the user moves over the toolbar area, change the cursor to become a hand
+ final Cursor cursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
+ tlb.setCursor(cursor);
+
+ // Cursor needs to be explicitly disposed
+ tlb.addDisposeListener(new DisposeListener() {
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ if (cursor.isDisposed() == false) {
+ cursor.dispose();
+ }
+ }
+ });
+
+ // Create the toolbar items
+ createSectionToolbarItems(section, toolkit, tlbMgr);
+
+ // Update the toolbar manager
+ tlbMgr.update(true);
+ // Associate the toolbar control with the section
+ section.setTextClient(tlb);
+ }
+
+ /**
+ * Convenience method to create section toolbar items.
+ * <p>
+ * This method is called from {@link #createSectionToolbar(Section, FormToolkit)}.
+ *
+ * @param section The section. Must not be <code>null</code>.
+ * @param toolkit The form toolkit or <code>null</code>.
+ * @param tlbMgr The toolbar manager. Must not be <code>null</code>.
+ */
+ protected void createSectionToolbarItems(Section section, FormToolkit toolkit, ToolBarManager tlbMgr) {
+ Assert.isNotNull(section);
+ Assert.isNotNull(tlbMgr);
+ }
+
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/

Back to the top