blob: 662145028468bc57f382737b07562900d0b3b749 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
/*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Sebastian Davids <sdavids@gmx.de> - Fix for bug 19346 - Dialog font should be
* activated and used by other components.
* Lubomir Marinov <lubomir.marinov@gmail.com> - Fix for bug 182122 -[Dialogs]
* CheckedTreeSelectionDialog#createSelectionButtons(Composite) fails to
* align the selection buttons to the right
*******************************************************************************/
package org.eclipse.linuxtools.systemtap.local.launch;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog;
/**
* A class to select elements out of a tree structure.
*
* @since 2.0
*/
public class RuledTreeSelectionDialog extends CheckedTreeSelectionDialog {
public RuledTreeSelectionDialog(Shell parent, ILabelProvider labelProvider,
ITreeContentProvider contentProvider) {
super(parent, labelProvider, contentProvider);
// TODO Auto-generated constructor stub
}
/*
* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
Label line = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL
| SWT.BOLD);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
line.setLayoutData(gridData);
GridLayout lay = (GridLayout) composite.getLayout();
lay.marginHeight=0;
composite.setLayout(lay);
return composite;
}
/*
* @see Dialog#createButtonBar(Composite)
*/
@Override
protected Control createButtonBar(Composite parent) {
Font font = parent.getFont();
Composite composite = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.marginWidth = 0;
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
composite.setFont(font);
/*
* Create the rest of the button bar, but tell it not to
* create a help button (we've already created it).
*/
boolean helpAvailable = isHelpAvailable();
setHelpAvailable(false);
Composite c = (Composite) super.createButtonBar(composite);
GridLayout lay = (GridLayout) c.getLayout();
lay.marginHeight=0;
c.setLayout(lay);
composite.setLayout(layout);
setHelpAvailable(helpAvailable);
return composite;
}
@Override
protected Label createMessageArea(Composite composite) {
Label label = new Label(composite, SWT.NONE);
if (this.getMessage() != null) {
label.setText(this.getMessage());
}
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.verticalIndent=10;
label.setLayoutData(gd);
label.setFont(composite.getFont());
return label;
}
}
|