~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/SelectDataSetWizardPage.java

  • Committer: Package Import Robot
  • Author(s): tony mancill
  • Date: 2013-05-13 21:43:22 UTC
  • mfrom: (1.2.1) (2.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130513214322-6frgd9du1n0w2uo7
Tags: 1.2.1-1
* Team upload.
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
import org.eclipse.jface.wizard.WizardPage;
16
16
import org.eclipse.linuxtools.internal.systemtap.ui.graphingapi.ui.Localization;
17
17
import org.eclipse.swt.SWT;
 
18
import org.eclipse.swt.events.SelectionAdapter;
18
19
import org.eclipse.swt.events.SelectionEvent;
19
20
import org.eclipse.swt.events.SelectionListener;
20
 
import org.eclipse.swt.layout.FormAttachment;
21
 
import org.eclipse.swt.layout.FormData;
22
 
import org.eclipse.swt.layout.FormLayout;
 
21
import org.eclipse.swt.layout.GridData;
 
22
import org.eclipse.swt.layout.GridLayout;
23
23
import org.eclipse.swt.widgets.Button;
24
24
import org.eclipse.swt.widgets.Composite;
25
25
import org.eclipse.swt.widgets.Label;
26
 
import org.eclipse.ui.forms.widgets.ColumnLayout;
27
26
 
28
27
 
29
28
 
30
29
public class SelectDataSetWizardPage extends WizardPage {
31
30
        public SelectDataSetWizardPage() {
32
 
                super("selectDataSetType");
33
 
                setTitle(Localization.getString("SelectDataSetWizardPage.SelectDataSetType"));
34
 
                dataSetID = "";
 
31
                super("selectDataSetType"); //$NON-NLS-1$
 
32
                setTitle(Localization.getString("SelectDataSetWizardPage.SelectDataSetType")); //$NON-NLS-1$
 
33
                dataSetID = ""; //$NON-NLS-1$
35
34
                btnDataSets = null;
36
35
        }
37
36
        
39
38
                wizard = (DataSetWizard)super.getWizard();
40
39
                
41
40
                Composite comp = new Composite(parent, SWT.NULL);
42
 
                comp.setLayout(new FormLayout());
43
 
                FormData data1 = new FormData();
44
 
                data1.left = new FormAttachment(0, 0);
45
 
                data1.top = new FormAttachment(0, 0);
46
 
                data1.right = new FormAttachment(40, 0);
47
 
                data1.bottom = new FormAttachment(100, 0);
 
41
                GridData layoutData = new GridData(GridData.FILL_BOTH);
 
42
                layoutData.grabExcessHorizontalSpace = true;
 
43
                layoutData.horizontalAlignment = SWT.FILL;
 
44
                GridLayout gridLayout = new GridLayout(2, false);
 
45
                comp.setLayout(gridLayout);
48
46
 
49
 
                Composite cmpFilterOpts = new Composite(comp, SWT.NONE);
50
 
                cmpFilterOpts.setLayoutData(data1);
51
 
                ColumnLayout colLayout = new ColumnLayout();
52
 
                colLayout.maxNumColumns = 1;
53
 
                cmpFilterOpts.setLayout(colLayout);
54
 
                
55
47
                String[] ids = DataSetFactory.getIDs();
56
48
                btnDataSets = new Button[ids.length];
 
49
                Label lblDesc;
57
50
                for(int i=0; i<btnDataSets.length; i++) {
58
 
                        btnDataSets[i] = new Button(cmpFilterOpts, SWT.NONE);
 
51
                        btnDataSets[i] = new Button(comp, SWT.RADIO);
59
52
                        btnDataSets[i].setText(DataSetFactory.getName(ids[i]));
60
53
                        btnDataSets[i].addSelectionListener(buttonListener);
61
54
                        btnDataSets[i].setData(ids[i]);
 
55
                        lblDesc = new Label(comp, SWT.WRAP);
 
56
                        lblDesc.setText(DataSetFactory.getDescription(btnDataSets[i].getData().toString()));
 
57
                        Label separator = new Label(comp, SWT.HORIZONTAL | SWT.SEPARATOR);
 
58
                        GridData separatorData = new GridData(GridData.FILL_HORIZONTAL);
 
59
                        separatorData.horizontalSpan=2;
 
60
                    separator.setLayoutData(separatorData);
62
61
                }
63
62
                
64
 
                FormData data2 = new FormData();
65
 
                data2.left = new FormAttachment(cmpFilterOpts);
66
 
                data2.top = new FormAttachment(0, 0);
67
 
                data2.right = new FormAttachment(100, 0);
68
 
                data2.bottom = new FormAttachment(100, 0);
69
 
                
70
 
                lblDesc = new Label(comp, SWT.WRAP);
71
 
                lblDesc.setLayoutData(data2);
72
 
                
73
63
                setControl(comp);
74
64
        }
75
65
        
 
66
        @Override
76
67
        public boolean canFlipToNextPage() {
77
 
                return (dataSetID.length() > 0);
 
68
                return !dataSetID.isEmpty();
78
69
        }
79
70
        
 
71
        @Override
80
72
        public IWizardPage getNextPage() {
81
73
                return DataSetFactory.getParsingWizardPage(dataSetID);
82
74
        }
83
75
 
 
76
        @Override
84
77
        public void dispose() {
85
78
                super.dispose();
86
79
                if(null != btnDataSets)
90
83
                                btnDataSets[i] = null;
91
84
                        }
92
85
                btnDataSets = null;
93
 
                lblDesc = null;
94
86
        }
95
87
 
96
 
        private SelectionListener buttonListener = new SelectionListener() {
97
 
                public void widgetDefaultSelected(SelectionEvent e) {}
98
 
                
 
88
        private SelectionListener buttonListener = new SelectionAdapter() {
 
89
                @Override
99
90
                public void widgetSelected(SelectionEvent e) {
100
91
                        if(e.widget instanceof Button) {
101
92
                                Button target = (Button)e.widget;
103
94
                                for(int i=0; i<btnDataSets.length; i++) {
104
95
                                        if(target == btnDataSets[i]) {
105
96
                                                dataSetID = btnDataSets[i].getData().toString();
106
 
                                                lblDesc.setText(DataSetFactory.getName(dataSetID) + "\n\n" +
107
 
                                                                                DataSetFactory.getDescription(dataSetID));
108
97
                                                wizard.getContainer().updateButtons();
109
98
                                        }
110
99
                                }
113
102
        };
114
103
        
115
104
        private Button[] btnDataSets;
116
 
        private Label lblDesc;
117
105
        private String dataSetID;
118
106
        private DataSetWizard wizard;
119
107
}