Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferrazzutti2013-06-03 17:45:09 +0000
committerSami Wagiaalla2013-06-14 14:13:24 +0000
commitb991db9d4412be76a4e1f3f92a0701e1e1cb27cd (patch)
tree7002521111c7d658fcf53defdf382a6d1453fa81
parent0ff3cd546076ba2050fe9233a3eeb32b842c1d7e (diff)
downloadorg.eclipse.linuxtools-b991db9d4412be76a4e1f3f92a0701e1e1cb27cd.tar.gz
org.eclipse.linuxtools-b991db9d4412be76a4e1f3f92a0701e1e1cb27cd.tar.xz
org.eclipse.linuxtools-b991db9d4412be76a4e1f3f92a0701e1e1cb27cd.zip
Systemtap: 1-page graph configuration wizard.
Move the contents of the Select Graph page and Select Series page into a single-page Create/Edit Graph wizard. TODO: Fix improper sizing of wizard window. Change-Id: Ibdfcd551f958d9b55a0486b6b7875d59cfd5be67 Reviewed-on: https://git.eclipse.org/r/13656 Tested-by: Hudson CI Reviewed-by: Sami Wagiaalla <swagiaal@redhat.com> IP-Clean: Sami Wagiaalla <swagiaal@redhat.com> Tested-by: Sami Wagiaalla <swagiaal@redhat.com>
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/internal/systemtap/graphingapi/ui/localization.properties32
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectGraphAndSeriesWizard.java (renamed from systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectGraphWizard.java)27
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectGraphAndSeriesWizardPage.java (renamed from systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectSeriesWizardPage.java)241
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectGraphWizardPage.java98
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/GraphDisplaySet.java4
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptGraphOptionsTab.java6
6 files changed, 144 insertions, 264 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/internal/systemtap/graphingapi/ui/localization.properties b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/internal/systemtap/graphingapi/ui/localization.properties
index 355c2e15da..eaa55481e8 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/internal/systemtap/graphingapi/ui/localization.properties
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/internal/systemtap/graphingapi/ui/localization.properties
@@ -131,19 +131,19 @@ GraphFactory.ScatterDescription=This is a simple plot of one series of data vs a
GraphFactory.MeterDescription=This is a meter chart.
-SelectGraphWizard.CreateGraph=Create Graph
-SelectGraphWizard.EditGraph=Edit Graph
-
-SelectGraphWizardPage.SelectGraph=Select Graph
-
-SelectSeriesWizardPage.Title=Title:
-SelectSeriesWizardPage.XSeries=X Series:
-SelectSeriesWizardPage.RowID=Row ID
-SelectSeriesWizardPage.YSeries=Y Series
-SelectSeriesWizardPage.SelectSeries=Select Series
-SelectSeriesWizardPage.TitleNotSet=Title not set
-SelectSeriesWizardPage.KeyFilter=Key filter:
-SelectSeriesWizardPage.KeyNotSet=Key not set
-SelectSeriesWizardPage.NA=NA
-SelectSeriesWizardPage.UseHistoricalData=Use historical data?
-SelectSeriesWizardPage.SeriesNotSelected=Series not selected, or share the same selection
+SelectGraphAndSeriesWizard.CreateGraph=Create Graph
+SelectGraphAndSeriesWizard.EditGraph=Edit Graph
+
+SelectGraphAndSeriesWizardPage.SelectGraphAndSeries=Select Graph and Series
+
+SelectGraphAndSeriesWizardPage.Graph=Graph Type:
+SelectGraphAndSeriesWizardPage.Title=Title:
+SelectGraphAndSeriesWizardPage.XSeries=X Series:
+SelectGraphAndSeriesWizardPage.RowID=Row ID
+SelectGraphAndSeriesWizardPage.YSeries=Y Series
+SelectGraphAndSeriesWizardPage.TitleNotSet=Title not set
+SelectGraphAndSeriesWizardPage.KeyFilter=Key filter:
+SelectGraphAndSeriesWizardPage.KeyNotSet=Key not set
+SelectGraphAndSeriesWizardPage.NA=NA
+SelectGraphAndSeriesWizardPage.UseHistoricalData=Use historical data?
+SelectGraphAndSeriesWizardPage.SeriesNotSelected=Series not selected, or share the same selection
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectGraphWizard.java b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectGraphAndSeriesWizard.java
index 92a8e448d2..cc079c1920 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectGraphWizard.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectGraphAndSeriesWizard.java
@@ -21,8 +21,8 @@ import org.eclipse.ui.IWorkbench;
-public class SelectGraphWizard extends Wizard implements INewWizard {
- public SelectGraphWizard(IDataSet data, GraphData gdata) {
+public class SelectGraphAndSeriesWizard extends Wizard implements INewWizard {
+ public SelectGraphAndSeriesWizard(IDataSet data, GraphData gdata) {
model = new GraphModel(data);
edit = (gdata != null);
if (edit) {
@@ -40,17 +40,14 @@ public class SelectGraphWizard extends Wizard implements INewWizard {
@Override
public void addPages() {
- setWindowTitle(Localization.getString(!edit ? "SelectGraphWizard.CreateGraph" : "SelectGraphWizard.EditGraph")); //$NON-NLS-1$//$NON-NLS-2$
- selectGraphPage = new SelectGraphWizardPage();
- addPage(selectGraphPage);
- selectSeriesPage = new SelectSeriesWizardPage();
- addPage(selectSeriesPage);
+ setWindowTitle(Localization.getString(!edit ? "SelectGraphAndSeriesWizard.CreateGraph" : "SelectGraphAndSeriesWizard.EditGraph")); //$NON-NLS-1$//$NON-NLS-2$
+ selectGraphandSeriesPage = new SelectGraphAndSeriesWizardPage();
+ addPage(selectGraphandSeriesPage);
}
@Override
public boolean canFinish() {
- if (this.getContainer().getCurrentPage() == selectSeriesPage &&
- selectSeriesPage.isPageComplete())
+ if (selectGraphandSeriesPage.isPageComplete())
return true;
return false;
}
@@ -74,17 +71,7 @@ public class SelectGraphWizard extends Wizard implements INewWizard {
return edit;
}
- @Override
- public void dispose() {
- if(null != selectGraphPage)
- selectGraphPage.dispose();
- if(null != selectSeriesPage)
- selectSeriesPage.dispose();
- super.dispose();
- }
-
- public SelectGraphWizardPage selectGraphPage;
- public SelectSeriesWizardPage selectSeriesPage;
+ public SelectGraphAndSeriesWizardPage selectGraphandSeriesPage;
public GraphModel model;
private boolean edit;
} \ No newline at end of file
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectSeriesWizardPage.java b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectGraphAndSeriesWizardPage.java
index 5f14b65a43..f5fecce0da 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectSeriesWizardPage.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectGraphAndSeriesWizardPage.java
@@ -18,43 +18,74 @@ import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.widgets.ColumnLayout;
-
-
-
-public class SelectSeriesWizardPage extends WizardPage {
- public SelectSeriesWizardPage() {
- super("selectSeries"); //$NON-NLS-1$
- setTitle(Localization.getString("SelectSeriesWizardPage.SelectSeries")); //$NON-NLS-1$
+public class SelectGraphAndSeriesWizardPage extends WizardPage implements Listener {
+ public SelectGraphAndSeriesWizardPage() {
+ super("selectGraphAndSeries"); //$NON-NLS-1$
+ setTitle(Localization.getString("SelectGraphAndSeriesWizardPage.SelectGraphAndSeries")); //$NON-NLS-1$
}
@Override
public void createControl(Composite parent) {
- edit = ((SelectGraphWizard)super.getWizard()).isEditing();
- model = ((SelectGraphWizard)super.getWizard()).model;
+ wizard = (SelectGraphAndSeriesWizard)getWizard();
+ model = wizard.model;
+ edit = wizard.isEditing();
//Set the layout data
Composite comp = new Composite(parent, SWT.NULL);
- comp.setLayout(new FormLayout());
- FormData data1 = new FormData();
- data1.left = new FormAttachment(0, 0);
- data1.top = new FormAttachment(0, 0);
- data1.right = new FormAttachment(40, 0);
- data1.bottom = new FormAttachment(100, 0);
-
- //Add the title wigets
- Label lblTitle = new Label(comp, SWT.NONE);
- lblTitle.setText(Localization.getString("SelectSeriesWizardPage.Title")); //$NON-NLS-1$
- txtTitle = new Text(comp, SWT.BORDER);
+ comp.setLayout(new GridLayout());
+ comp.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Group cmpGraphOptsGraph = new Group(comp, SWT.SHADOW_ETCHED_IN);
+ cmpGraphOptsGraph.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ RowLayout rowLayout = new RowLayout();
+ rowLayout.type = SWT.HORIZONTAL;
+ rowLayout.spacing = 10;
+ cmpGraphOptsGraph.setLayout(rowLayout);
+ cmpGraphOptsGraph.setText(Localization.getString("SelectGraphAndSeriesWizardPage.Graph")); //$NON-NLS-1$
+
+ String[] graphIDs = GraphFactory.getAvailableGraphs(wizard.model.getDataSet());
+ btnGraphs = new Button[graphIDs.length];
+ for(int i=0; i<btnGraphs.length; i++) {
+ btnGraphs[i] = new Button(cmpGraphOptsGraph, SWT.RADIO);
+ btnGraphs[i].setImage(GraphFactory.getGraphImage(graphIDs[i]));
+ btnGraphs[i].addListener(SWT.Selection, this);
+ btnGraphs[i].setData(graphIDs[i]);
+ btnGraphs[i].setToolTipText(GraphFactory.getGraphName(btnGraphs[i].getData().toString()) + "\n\n" + //$NON-NLS-1$
+ GraphFactory.getGraphDescription(btnGraphs[i].getData().toString()));
+ if (wizard.isEditing() && graphIDs[i].equals(wizard.model.getGraphID())) {
+ btnGraphs[i].setSelection(true);
+ }
+ }
+
+ //Add the title widgets
+ //data1 = new FormData();
+ //data1.top = new FormAttachment(cmpGraphOptsGraph, 10);
+
+ Group cmpGraphOptsSeries = new Group(comp, SWT.SHADOW_ETCHED_IN);
+ cmpGraphOptsSeries.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ //rowLayout = new RowLayout(SWT.VERTICAL);
+ //rowLayout.fill = true;
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ cmpGraphOptsSeries.setLayout(layout);
+
+ Label lblTitle = new Label(cmpGraphOptsSeries, SWT.NONE);
+ lblTitle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+ lblTitle.setText(Localization.getString("SelectGraphAndSeriesWizardPage.Title")); //$NON-NLS-1$
+ txtTitle = new Text(cmpGraphOptsSeries, SWT.BORDER);
+ txtTitle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
if (edit) {
txtTitle.setText(model.getGraphData().title);
}
@@ -63,7 +94,7 @@ public class SelectSeriesWizardPage extends WizardPage {
public void modifyText(ModifyEvent e) {
getWizard().getContainer().updateButtons();
if(txtTitle.getText().length() == 0) {
- setErrorMessage(Localization.getString("SelectSeriesWizardPage.TitleNotSet")); //$NON-NLS-1$
+ setErrorMessage(Localization.getString("SelectGraphAndSeriesWizardPage.TitleNotSet")); //$NON-NLS-1$
setMessage(null);
} else {
setErrorMessage(null);
@@ -71,53 +102,31 @@ public class SelectSeriesWizardPage extends WizardPage {
}
}
});
- data1 = new FormData();
- data1.left = new FormAttachment(0,0);
- data1.top = new FormAttachment(0,0);
- data1.width = 200;
- lblTitle.setLayoutData(data1);
-
- data1 = new FormData();
- data1.left = new FormAttachment(0,0);
- data1.top = new FormAttachment(lblTitle,0);
- data1.width = 200;
- txtTitle.setLayoutData(data1);
-
//Add the data series widgets
- data1 = new FormData();
- data1.left = new FormAttachment(0, 0);
- data1.top = new FormAttachment(txtTitle, 20);
- data1.right = new FormAttachment(40, 0);
- data1.bottom = new FormAttachment(100, 0);
-
- Composite cmpGraphOpts = new Composite(comp, SWT.NONE);
- cmpGraphOpts.setLayoutData(data1);
- ColumnLayout colLayout = new ColumnLayout();
- colLayout.maxNumColumns = 1;
- cmpGraphOpts.setLayout(colLayout);
-
String[] labels = model.getSeries();
cboYItems = new Combo[labels.length];
lblYItems = new Label[cboYItems.length];
- Label lblXItem = new Label(cmpGraphOpts, SWT.NONE);
- lblXItem.setText(Localization.getString("SelectSeriesWizardPage.XSeries")); //$NON-NLS-1$
- cboXItem = new Combo(cmpGraphOpts, SWT.DROP_DOWN);
+ Label lblXItem = new Label(cmpGraphOptsSeries, SWT.NONE);
+ lblXItem.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+ lblXItem.setText(Localization.getString("SelectGraphAndSeriesWizardPage.XSeries")); //$NON-NLS-1$
+ cboXItem = new Combo(cmpGraphOptsSeries, SWT.DROP_DOWN);
+ cboXItem.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
cboXItem.addSelectionListener(new ComboSelectionListener());
- cboXItem.add(Localization.getString("SelectSeriesWizardPage.RowID")); //$NON-NLS-1$
-
- new Label(cmpGraphOpts, SWT.NONE); //Spacer
+ cboXItem.add(Localization.getString("SelectGraphAndSeriesWizardPage.RowID")); //$NON-NLS-1$
for(int i=0; i<cboYItems.length; i++) {
- lblYItems[i] = new Label(cmpGraphOpts, SWT.NONE);
- lblYItems[i].setText(Localization.getString("SelectSeriesWizardPage.YSeries") + i + ":"); //$NON-NLS-1$ //$NON-NLS-2$
- cboYItems[i] = new Combo(cmpGraphOpts, SWT.DROP_DOWN);
+ lblYItems[i] = new Label(cmpGraphOptsSeries, SWT.NONE);
+ lblYItems[i].setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+ lblYItems[i].setText(Localization.getString("SelectGraphAndSeriesWizardPage.YSeries") + i + ":"); //$NON-NLS-1$ //$NON-NLS-2$
+ cboYItems[i] = new Combo(cmpGraphOptsSeries, SWT.DROP_DOWN);
+ cboYItems[i].setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
cboYItems[i].addSelectionListener(new ComboSelectionListener());
if(i>0) {
- cboYItems[i].add(Localization.getString("SelectSeriesWizardPage.NA")); //$NON-NLS-1$
+ cboYItems[i].add(Localization.getString("SelectGraphAndSeriesWizardPage.NA")); //$NON-NLS-1$
cboYItems[i].setVisible(false);
lblYItems[i].setVisible(false);
}
@@ -142,73 +151,24 @@ public class SelectSeriesWizardPage extends WizardPage {
cvisible = (index > 0);
}
- //Add the key filter wigets
- btnKey = new Button(comp, SWT.CHECK);
- btnKey.setText(Localization.getString("SelectSeriesWizardPage.UseHistoricalData")); //$NON-NLS-1$
- btnKey.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {}
- @Override
- public void widgetSelected(SelectionEvent e) {
- txtKey.setEnabled(btnKey.getSelection());
- }
- });
-
- data1 = new FormData();
- data1.left = new FormAttachment(cmpGraphOpts, 20);
- data1.top = new FormAttachment(txtTitle, 0);
- data1.right = new FormAttachment(100, 0);
- btnKey.setLayoutData(data1);
-
- lblKey = new Label(comp, SWT.NONE);
- lblKey.setText(Localization.getString("SelectSeriesWizardPage.KeyFilter")); //$NON-NLS-1$
- txtKey = new Text(comp, SWT.BORDER);
- if (edit && model.getGraphData().key != null) {
- txtKey.setText(model.getGraphData().key);
+ //Select one of the graph types by default, rather than blank choice
+ if (!edit) {
+ btnGraphs[0].setSelection(true);
+ saveDataToModelGraph(graphIDs[0]);
}
-
- if(null != txtKey) {
- txtKey.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- getWizard().getContainer().updateButtons();
- if(txtTitle.getText().length() == 0) {
- setErrorMessage(Localization.getString("SelectSeriesWizardPage.KeyNotSet")); //$NON-NLS-1$
- setMessage(null);
- } else {
- setErrorMessage(null);
- setMessage(""); //$NON-NLS-1$
- }
- }
- });
- }
-
- data1 = new FormData();
- data1.left = new FormAttachment(cmpGraphOpts, 20);
- data1.top = new FormAttachment(btnKey, 0);
- data1.right = new FormAttachment(80, 0);
- lblKey.setLayoutData(data1);
-
- data1 = new FormData();
- data1.left = new FormAttachment(cmpGraphOpts, 20);
- data1.top = new FormAttachment(lblKey, 2);
- data1.right = new FormAttachment(80, 0);
- txtKey.setLayoutData(data1);
-
- if (edit) {
- setKeyEnablement(GraphFactory.isKeyRequired(model.getGraphID(), model.getDataSet()),
- GraphFactory.isKeyOptional(model.getGraphID(), model.getDataSet()));
+ else {
+ saveDataToModelGraph(wizard.model.getGraphID());
}
- //Make comp visible
setControl(comp);
}
- public void setKeyEnablement(boolean required, boolean optional) {
- btnKey.setVisible(optional);
- txtKey.setVisible(required || optional);
- lblKey.setVisible(required || optional);
- txtKey.setEnabled(required);
+ @Override
+ public void handleEvent(Event event) {
+ if(event.widget instanceof Button) {
+ saveDataToModelGraph(((Button)event.widget).getData().toString());
+ wizard.getContainer().updateButtons();
+ }
}
@Override
@@ -218,10 +178,23 @@ public class SelectSeriesWizardPage extends WizardPage {
@Override
public boolean isPageComplete() {
- return saveDataToModel();
+ return saveDataToModelSeries();
}
- private boolean saveDataToModel() {
+ /**
+ * Saves the choice of graph type to the model.
+ * @param selected The ID of the selected graph.
+ */
+ private void saveDataToModelGraph(String selected) {
+ model.setGraph(selected);
+ }
+
+ /**
+ * Saves all information pertaining to series data & naming to the model.
+ * @return True if there are no conflicts in series data selection; false otherwise.
+ * In the case of the latter, no data is saved.
+ */
+ private boolean saveDataToModelSeries() {
if(isSeriesUnique()) {
model.setTitle(txtTitle.getText());
@@ -234,7 +207,7 @@ public class SelectSeriesWizardPage extends WizardPage {
int i, count;
for(i=1, count=1; i<cboYItems.length; i++)
- if(cboYItems[i].isVisible() && 0 != cboYItems[i].getSelectionIndex())
+ if(0 != cboYItems[i].getSelectionIndex())
count++;
int[] ySeries = new int[count];
@@ -247,6 +220,11 @@ public class SelectSeriesWizardPage extends WizardPage {
return false;
}
+ /**
+ * Checks for conflicts in data selection. (An example of a conflict
+ * is two Y-series fields set to the same output value.)
+ * @return True if there is no conflict, false otherwise.
+ */
private boolean isSeriesUnique() {
if("".equals(txtTitle.getText().trim())) //$NON-NLS-1$
return false;
@@ -281,6 +259,11 @@ public class SelectSeriesWizardPage extends WizardPage {
@Override
public void dispose() {
super.dispose();
+ if(null != btnGraphs)
+ for(int i=0; i<btnGraphs.length; i++)
+ btnGraphs[i].dispose();
+ btnGraphs = null;
+
if(null != txtTitle)
txtTitle.dispose();
txtTitle = null;
@@ -313,6 +296,11 @@ public class SelectSeriesWizardPage extends WizardPage {
model = null;
}
+ /**
+ * This class is responsible for updating the menu elements whenever
+ * the user interacts with them. Namely, it checks for naming errors
+ * and invalid series selections, and handles display of Y-series combo boxes.
+ */
private class ComboSelectionListener implements SelectionListener {
@Override
public void widgetDefaultSelected(SelectionEvent e) {}
@@ -334,14 +322,14 @@ public class SelectSeriesWizardPage extends WizardPage {
}
if(!isSeriesUnique()) {
- setErrorMessage(Localization.getString("SelectSeriesWizardPage.SeriesNotSelected")); //$NON-NLS-1$
+ setErrorMessage(Localization.getString("SelectGraphAndSeriesWizardPage.SeriesNotSelected")); //$NON-NLS-1$
setMessage(null);
} else {
setErrorMessage(null);
setMessage(""); //$NON-NLS-1$
}
if(txtTitle.getText().length() == 0) {
- setErrorMessage(Localization.getString("SelectSeriesWizardPage.TitleNotSet")); //$NON-NLS-1$
+ setErrorMessage(Localization.getString("SelectGraphAndSeriesWizardPage.TitleNotSet")); //$NON-NLS-1$
setMessage(null);
}
@@ -349,6 +337,9 @@ public class SelectSeriesWizardPage extends WizardPage {
}
}
+ private Button[] btnGraphs;
+ private SelectGraphAndSeriesWizard wizard;
+
private Text txtTitle; //TODO: Move this to another page once graphs get more detail
private Text txtKey;
private Button btnKey;
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectGraphWizardPage.java b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectGraphWizardPage.java
deleted file mode 100644
index 450514e649..0000000000
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectGraphWizardPage.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * 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.graph;
-
-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.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.ui.forms.widgets.ColumnLayout;
-
-public class SelectGraphWizardPage extends WizardPage implements Listener {
- public SelectGraphWizardPage() {
- super("selectGraph"); //$NON-NLS-1$
- setTitle(Localization.getString("SelectGraphWizardPage.SelectGraph")); //$NON-NLS-1$
- }
-
- @Override
- public void createControl(Composite parent) {
- wizard = (SelectGraphWizard)getWizard();
-
- Composite cmpGraphOpts = new Composite(parent, SWT.NONE);
- ColumnLayout colLayout = new ColumnLayout();
- colLayout.maxNumColumns = 1;
- cmpGraphOpts.setLayout(colLayout);
-
- String[] graphIDs = GraphFactory.getAvailableGraphs(wizard.model.getDataSet());
- btnGraphs = new Button[graphIDs.length];
- for(int i=0; i<btnGraphs.length; i++) {
- btnGraphs[i] = new Button(cmpGraphOpts, SWT.TOGGLE);
- btnGraphs[i].setImage(GraphFactory.getGraphImage(graphIDs[i]));
- btnGraphs[i].addListener(SWT.Selection, this);
- btnGraphs[i].setData(graphIDs[i]);
- btnGraphs[i].setToolTipText(GraphFactory.getGraphName(btnGraphs[i].getData().toString()) + "\n\n" + //$NON-NLS-1$
- GraphFactory.getGraphDescription(btnGraphs[i].getData().toString()));
- if (wizard.isEditing() && graphIDs[i].equals(wizard.model.getGraphID())) {
- btnGraphs[i].setSelection(true);
- }
- }
- setControl(cmpGraphOpts);
- }
-
- @Override
- public void handleEvent(Event event) {
- if(event.widget instanceof Button) {
- Button target = (Button)event.widget;
- for(int i=0; i<btnGraphs.length; i++)
- if(target == btnGraphs[i]) {
- saveDataToModel(btnGraphs[i].getData().toString());
- wizard.getContainer().updateButtons();
- } else {
- btnGraphs[i].setSelection(false);
- }
- }
- }
-
- @Override
- public IWizardPage getNextPage() {
- return wizard.selectSeriesPage;
- }
-
- @Override
- public boolean canFlipToNextPage() {
- return wizard.model.isGraphSet();
- }
-
- private void saveDataToModel(String selected) {
- GraphModel model = wizard.model;
- model.setGraph(selected);
- wizard.selectSeriesPage.setKeyEnablement(
- GraphFactory.isKeyRequired(model.getGraphID(), model.getDataSet()),
- GraphFactory.isKeyOptional(model.getGraphID(), model.getDataSet()));
- }
-
- @Override
- public void dispose() {
- super.dispose();
- if(null != btnGraphs)
- for(int i=0; i<btnGraphs.length; i++)
- btnGraphs[i] = null;
- btnGraphs = null;
- }
-
- private Button[] btnGraphs;
- private SelectGraphWizard wizard;
-} \ No newline at end of file
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/GraphDisplaySet.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/GraphDisplaySet.java
index ebbf493b43..6a7f64067a 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/GraphDisplaySet.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/GraphDisplaySet.java
@@ -25,7 +25,7 @@ import org.eclipse.linuxtools.systemtap.graphingapi.ui.datadisplay.DataGrid;
import org.eclipse.linuxtools.systemtap.graphingapi.ui.widgets.GraphComposite;
import org.eclipse.linuxtools.systemtap.graphingapi.ui.wizards.dataset.DataSetFactory;
import org.eclipse.linuxtools.systemtap.graphingapi.ui.wizards.graph.GraphFactory;
-import org.eclipse.linuxtools.systemtap.graphingapi.ui.wizards.graph.SelectGraphWizard;
+import org.eclipse.linuxtools.systemtap.graphingapi.ui.wizards.graph.SelectGraphAndSeriesWizard;
import org.eclipse.linuxtools.systemtap.structures.UpdateManager;
import org.eclipse.linuxtools.systemtap.structures.listeners.ITabListener;
import org.eclipse.swt.SWT;
@@ -188,7 +188,7 @@ public class GraphDisplaySet {
if(folder.getSelectionIndex() == 0) {
folder.setSelection(lastSelectedTab);
- SelectGraphWizard wizard = new SelectGraphWizard(dataSet, null);
+ SelectGraphAndSeriesWizard wizard = new SelectGraphAndSeriesWizard(dataSet, null);
IWorkbench workbench = PlatformUI.getWorkbench();
wizard.init(workbench, null);
WizardDialog dialog = new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard);
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptGraphOptionsTab.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptGraphOptionsTab.java
index b681382305..c5c0f2082f 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptGraphOptionsTab.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptGraphOptionsTab.java
@@ -28,7 +28,7 @@ import org.eclipse.linuxtools.systemtap.graphingapi.core.structures.GraphData;
import org.eclipse.linuxtools.systemtap.graphingapi.ui.widgets.ExceptionErrorDialog;
import org.eclipse.linuxtools.systemtap.graphingapi.ui.wizards.dataset.DataSetFactory;
import org.eclipse.linuxtools.systemtap.graphingapi.ui.wizards.graph.GraphFactory;
-import org.eclipse.linuxtools.systemtap.graphingapi.ui.wizards.graph.SelectGraphWizard;
+import org.eclipse.linuxtools.systemtap.graphingapi.ui.wizards.graph.SelectGraphAndSeriesWizard;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ModifyEvent;
@@ -336,7 +336,7 @@ public class SystemTapScriptGraphOptionsTab extends
addGraphButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- SelectGraphWizard wizard = new SelectGraphWizard(getDataset(), null);
+ SelectGraphAndSeriesWizard wizard = new SelectGraphAndSeriesWizard(getDataset(), null);
IWorkbench workbench = PlatformUI.getWorkbench();
wizard.init(workbench, null);
WizardDialog dialog = new WizardDialog(workbench
@@ -376,7 +376,7 @@ public class SystemTapScriptGraphOptionsTab extends
editGraphButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- SelectGraphWizard wizard = new SelectGraphWizard(getDataset(),
+ SelectGraphAndSeriesWizard wizard = new SelectGraphAndSeriesWizard(getDataset(),
(GraphData) selectedTableItem.getData());
IWorkbench workbench = PlatformUI.getWorkbench();
wizard.init(workbench, null);

Back to the top