blob: ecbcb72da74d18845e87105eb756c3c47bc36e48 (
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
110
111
112
113
114
|
/*******************************************************************************
* Copyright (c) 2006 IBM Corporation.
* 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 - Jeff Briggs, Henry Hughes, Ryan Morse
*******************************************************************************/
package org.eclipse.linuxtools.systemtap.graphingapi.ui.wizards.dataset;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.linuxtools.internal.systemtap.graphingapi.ui.Localization;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
/**
* @deprecated The means of creating/editing graph configurations has
* deviated significantly from this implementation.
* TODO remove in 3.0
*/
@Deprecated
public class SelectDataSetWizardPage extends WizardPage {
public SelectDataSetWizardPage() {
super("selectDataSetType"); //$NON-NLS-1$
setTitle(Localization.getString("SelectDataSetWizardPage.SelectDataSetType")); //$NON-NLS-1$
dataSetID = ""; //$NON-NLS-1$
btnDataSets = null;
}
@Override
public void createControl(Composite parent) {
wizard = (DataSetWizard)super.getWizard();
Composite comp = new Composite(parent, SWT.NULL);
GridData layoutData = new GridData(GridData.FILL_BOTH);
layoutData.grabExcessHorizontalSpace = true;
layoutData.horizontalAlignment = SWT.FILL;
GridLayout gridLayout = new GridLayout(2, false);
comp.setLayout(gridLayout);
String[] ids = DataSetFactory.getIDs();
btnDataSets = new Button[ids.length];
Label lblDesc;
for(int i=0; i<btnDataSets.length; i++) {
btnDataSets[i] = new Button(comp, SWT.RADIO);
btnDataSets[i].setText(DataSetFactory.getName(ids[i]));
btnDataSets[i].addSelectionListener(buttonListener);
btnDataSets[i].setData(ids[i]);
lblDesc = new Label(comp, SWT.WRAP);
lblDesc.setText(DataSetFactory.getDescription(btnDataSets[i].getData().toString()));
Label separator = new Label(comp, SWT.HORIZONTAL | SWT.SEPARATOR);
GridData separatorData = new GridData(GridData.FILL_HORIZONTAL);
separatorData.horizontalSpan=2;
separator.setLayoutData(separatorData);
}
setControl(comp);
}
@Override
public boolean canFlipToNextPage() {
return !dataSetID.isEmpty();
}
@Override
public IWizardPage getNextPage() {
return DataSetFactory.getParsingWizardPage(dataSetID);
}
@Override
public void dispose() {
super.dispose();
if(null != btnDataSets) {
for(int i=0; i<btnDataSets.length; i++) {
btnDataSets[i].removeSelectionListener(buttonListener);
btnDataSets[i].dispose();
btnDataSets[i] = null;
}
}
btnDataSets = null;
}
private SelectionListener buttonListener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if(e.widget instanceof Button) {
Button target = (Button)e.widget;
for(Button button: btnDataSets) {
if(target == button) {
dataSetID = button.getData().toString();
wizard.getContainer().updateButtons();
}
}
}
}
};
private Button[] btnDataSets;
private String dataSetID;
private DataSetWizard wizard;
}
|