aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferrazzutti2013-05-30 15:56:16 (EDT)
committerJeff Johnston2013-06-03 16:18:25 (EDT)
commitdbaf2af3f0fbcdd29f8a5e884b01636d89a1454c (patch)
tree9e49191d59ba4fc30de31eaeda375f3c95747358
parentd9aa4d8fd48946aff08d7d2338358cfaa53dcf4e (diff)
downloadorg.eclipse.linuxtools-dbaf2af3f0fbcdd29f8a5e884b01636d89a1454c.zip
org.eclipse.linuxtools-dbaf2af3f0fbcdd29f8a5e884b01636d89a1454c.tar.gz
org.eclipse.linuxtools-dbaf2af3f0fbcdd29f8a5e884b01636d89a1454c.tar.bz2
Systemtap: Add Edit Graph button.refs/changes/16/13516/3
Add a button to the Systemtap Run Configurations->Graphing tab to allow users to edit graphs that are already made. Fixes: https://bugs.eclipse.org/bugs/show_bug.cgi?id=408634 Change-Id: I01f376e1a9768d7d367a4f4908425b3c5f4bd2b6 Reviewed-on: https://git.eclipse.org/r/13459 Tested-by: Hudson CI IP-Clean: Sami Wagiaalla <swagiaal@redhat.com> Tested-by: Sami Wagiaalla <swagiaal@redhat.com> Reviewed-by: Sami Wagiaalla <swagiaal@redhat.com> Reviewed-on: https://git.eclipse.org/r/13516 Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> IP-Clean: Jeff Johnston <jjohnstn@redhat.com> Tested-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/internal/systemtap/graphingapi/ui/localization.properties1
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectGraphWizard.java17
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectGraphWizardPage.java3
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectSeriesWizardPage.java27
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/GraphDisplaySet.java2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/Messages.java5
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptGraphOptionsTab.java48
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/messages.properties5
8 files changed, 95 insertions, 13 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 696bc00..7fe30be 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
@@ -132,6 +132,7 @@ GraphFactory.MeterDescription=This is a meter chart.
SelectGraphWizard.CreateGraph=Create Graph
+SelectGraphWizard.EditGraph=Edit Graph
SelectGraphWizardPage.SelectGraph=Select Graph
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/SelectGraphWizard.java
index 3bf0245..92a8e44 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/SelectGraphWizard.java
@@ -22,8 +22,16 @@ import org.eclipse.ui.IWorkbench;
public class SelectGraphWizard extends Wizard implements INewWizard {
- public SelectGraphWizard(IDataSet data) {
+ public SelectGraphWizard(IDataSet data, GraphData gdata) {
model = new GraphModel(data);
+ edit = (gdata != null);
+ if (edit) {
+ model.setGraph(gdata.graphID);
+ model.setKey(gdata.key);
+ model.setTitle(gdata.title);
+ model.setXSeries(gdata.xSeries);
+ model.setYSeries(gdata.ySeries);
+ }
}
@Override
@@ -32,7 +40,7 @@ public class SelectGraphWizard extends Wizard implements INewWizard {
@Override
public void addPages() {
- setWindowTitle(Localization.getString("SelectGraphWizard.CreateGraph")); //$NON-NLS-1$
+ setWindowTitle(Localization.getString(!edit ? "SelectGraphWizard.CreateGraph" : "SelectGraphWizard.EditGraph")); //$NON-NLS-1$//$NON-NLS-2$
selectGraphPage = new SelectGraphWizardPage();
addPage(selectGraphPage);
selectSeriesPage = new SelectSeriesWizardPage();
@@ -62,6 +70,10 @@ public class SelectGraphWizard extends Wizard implements INewWizard {
return model.getGraphData();
}
+ public boolean isEditing() {
+ return edit;
+ }
+
@Override
public void dispose() {
if(null != selectGraphPage)
@@ -74,4 +86,5 @@ public class SelectGraphWizard extends Wizard implements INewWizard {
public SelectGraphWizardPage selectGraphPage;
public SelectSeriesWizardPage selectSeriesPage;
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/SelectGraphWizardPage.java b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/graph/SelectGraphWizardPage.java
index 87fe0c6..450514e 100644
--- 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
@@ -45,6 +45,9 @@ public class SelectGraphWizardPage extends WizardPage implements Listener {
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);
}
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/SelectSeriesWizardPage.java
index c5b82ce..5f14b65 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/SelectSeriesWizardPage.java
@@ -39,6 +39,7 @@ public class SelectSeriesWizardPage extends WizardPage {
@Override
public void createControl(Composite parent) {
+ edit = ((SelectGraphWizard)super.getWizard()).isEditing();
model = ((SelectGraphWizard)super.getWizard()).model;
//Set the layout data
@@ -54,6 +55,9 @@ public class SelectSeriesWizardPage extends WizardPage {
Label lblTitle = new Label(comp, SWT.NONE);
lblTitle.setText(Localization.getString("SelectSeriesWizardPage.Title")); //$NON-NLS-1$
txtTitle = new Text(comp, SWT.BORDER);
+ if (edit) {
+ txtTitle.setText(model.getGraphData().title);
+ }
txtTitle.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
@@ -103,7 +107,6 @@ public class SelectSeriesWizardPage extends WizardPage {
cboXItem = new Combo(cmpGraphOpts, SWT.DROP_DOWN);
cboXItem.addSelectionListener(new ComboSelectionListener());
cboXItem.add(Localization.getString("SelectSeriesWizardPage.RowID")); //$NON-NLS-1$
- cboXItem.select(0);
new Label(cmpGraphOpts, SWT.NONE); //Spacer
@@ -115,7 +118,6 @@ public class SelectSeriesWizardPage extends WizardPage {
if(i>0) {
cboYItems[i].add(Localization.getString("SelectSeriesWizardPage.NA")); //$NON-NLS-1$
- cboYItems[i].select(0);
cboYItems[i].setVisible(false);
lblYItems[i].setVisible(false);
}
@@ -127,6 +129,18 @@ public class SelectSeriesWizardPage extends WizardPage {
cboYItems[j].add(labels[i]);
}
+ cboXItem.select(edit ? model.getXSeries() + 1 : 0);
+ boolean cvisible = edit;
+ if (edit) {
+ cboYItems[0].select(model.getYSeries()[0]);
+ }
+ for(int i=1; i<cboYItems.length; i++) {
+ int index = edit && model.getYSeries().length > i ? model.getYSeries()[i] + 1 : 0;
+ cboYItems[i].select(index);
+ cboYItems[i].setVisible(cvisible);
+ lblYItems[i].setVisible(cvisible);
+ cvisible = (index > 0);
+ }
//Add the key filter wigets
btnKey = new Button(comp, SWT.CHECK);
@@ -149,6 +163,9 @@ public class SelectSeriesWizardPage extends WizardPage {
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);
+ }
if(null != txtKey) {
txtKey.addModifyListener(new ModifyListener() {
@@ -178,6 +195,11 @@ public class SelectSeriesWizardPage extends WizardPage {
data1.right = new FormAttachment(80, 0);
txtKey.setLayoutData(data1);
+ if (edit) {
+ setKeyEnablement(GraphFactory.isKeyRequired(model.getGraphID(), model.getDataSet()),
+ GraphFactory.isKeyOptional(model.getGraphID(), model.getDataSet()));
+ }
+
//Make comp visible
setControl(comp);
}
@@ -335,4 +357,5 @@ public class SelectSeriesWizardPage extends WizardPage {
private Combo[] cboYItems;
private Label[] lblYItems;
private GraphModel model;
+ private boolean edit;
} \ 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 127d863..ebbf493 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
@@ -188,7 +188,7 @@ public class GraphDisplaySet {
if(folder.getSelectionIndex() == 0) {
folder.setSelection(lastSelectedTab);
- SelectGraphWizard wizard = new SelectGraphWizard(dataSet);
+ SelectGraphWizard wizard = new SelectGraphWizard(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/Messages.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/Messages.java
index 1f7ca2c..4d33cce 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/Messages.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/Messages.java
@@ -33,8 +33,11 @@ public class Messages extends NLS {
public static String SystemTapScriptGraphOptionsTab_AddGraphButton;
public static String SystemTapScriptGraphOptionsTab_AddGraphButtonToolTip;
+ public static String SystemTapScriptGraphOptionsTab_EditGraphButton;
+ public static String SystemTapScriptGraphOptionsTab_EditGraphButtonToolTip;
+ public static String SystemTapScriptGraphOptionsTab_RemoveGraphButton;
+ public static String SystemTapScriptGraphOptionsTab_RemoveGraphButtonToolTip;
public static String SystemTapScriptGraphOptionsTab_graphsTitle;
- public static String SystemTapScriptGraphOptionsTab_RemoveGraphButtonLabel;
public static String SystemTapScriptLaunchConfigurationTab_0;
public static String SystemTapScriptLaunchConfigurationTab_1;
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 088ab83..a18c39c 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
@@ -88,7 +88,7 @@ public class SystemTapScriptGraphOptionsTab extends
private Button runWithChartCheckButton;
private Table graphsTable;
- private Button addGraphButton, removeGraphButton;
+ private Button addGraphButton, editGraphButton, removeGraphButton;
private TableItem selectedTableItem;
private Group graphsGroup;
@@ -297,16 +297,22 @@ public class SystemTapScriptGraphOptionsTab extends
gridLayout.numColumns = 1;
buttonComposite.setLayout(gridLayout);
+ // Button to add a new graph
addGraphButton = new Button(buttonComposite, SWT.PUSH);
addGraphButton.setText(Messages.SystemTapScriptGraphOptionsTab_AddGraphButton);
addGraphButton.setToolTipText(Messages.SystemTapScriptGraphOptionsTab_AddGraphButtonToolTip);
addGraphButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ // Button to edit an existing graph
+ editGraphButton = new Button(buttonComposite, SWT.PUSH);
+ editGraphButton.setText(Messages.SystemTapScriptGraphOptionsTab_EditGraphButton);
+ editGraphButton.setToolTipText(Messages.SystemTapScriptGraphOptionsTab_EditGraphButtonToolTip);
+ editGraphButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
// Button to remove the selected graph/filter
removeGraphButton = new Button(buttonComposite, SWT.PUSH);
- removeGraphButton.setText("Remove"); //$NON-NLS-1$
- removeGraphButton.setToolTipText(Messages.SystemTapScriptGraphOptionsTab_RemoveGraphButtonLabel);
- removeGraphButton.setEnabled(false);
+ removeGraphButton.setText(Messages.SystemTapScriptGraphOptionsTab_RemoveGraphButton);
+ removeGraphButton.setToolTipText(Messages.SystemTapScriptGraphOptionsTab_RemoveGraphButtonToolTip);
removeGraphButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
// Action to notify the buttons when to enable/disable themselves based
@@ -315,6 +321,7 @@ public class SystemTapScriptGraphOptionsTab extends
@Override
public void widgetSelected(SelectionEvent e) {
selectedTableItem = (TableItem) e.item;
+ editGraphButton.setEnabled(true);
removeGraphButton.setEnabled(true);
}
});
@@ -324,7 +331,7 @@ public class SystemTapScriptGraphOptionsTab extends
addGraphButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- SelectGraphWizard wizard = new SelectGraphWizard(getDataset());
+ SelectGraphWizard wizard = new SelectGraphWizard(getDataset(), null);
IWorkbench workbench = PlatformUI.getWorkbench();
wizard.init(workbench, null);
WizardDialog dialog = new WizardDialog(workbench
@@ -344,11 +351,38 @@ public class SystemTapScriptGraphOptionsTab extends
}
});
+ // When button is clicked, brings up same wizard as the one for adding
+ // a graph. Data in the wizard is filled out to match the properties
+ // of the selected graph.
+ editGraphButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ SelectGraphWizard wizard = new SelectGraphWizard(getDataset(),
+ (GraphData) selectedTableItem.getData());
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ wizard.init(workbench, null);
+ WizardDialog dialog = new WizardDialog(workbench
+ .getActiveWorkbenchWindow().getShell(), wizard);
+ dialog.create();
+ dialog.open();
+
+ GraphData gd = wizard.getGraphData();
+
+ if (null != gd) {
+ selectedTableItem.setText(GraphFactory.getGraphName(gd.graphID) + ":" //$NON-NLS-1$
+ + gd.title);
+ selectedTableItem.setData(gd);
+ updateLaunchConfigurationDialog();
+ }
+ }
+ });
+
// Removes the selected graph/filter from the table
removeGraphButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
selectedTableItem.dispose();
+ editGraphButton.setEnabled(false);
removeGraphButton.setEnabled(false);
updateLaunchConfigurationDialog();
}
@@ -530,7 +564,9 @@ public class SystemTapScriptGraphOptionsTab extends
private void setControlEnabled(Composite composite, boolean enabled){
composite.setEnabled(enabled);
for (Control child : composite.getChildren()) {
- child.setEnabled(enabled);
+ if (child == removeGraphButton || child == editGraphButton) {
+ child.setEnabled(false);
+ }
if(child instanceof Composite){
setControlEnabled((Composite)child, enabled);
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/messages.properties b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/messages.properties
index de5d853..3b82b7d 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/messages.properties
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/messages.properties
@@ -26,8 +26,11 @@ SystemTapScriptGraphOptionsTab_7=Graphing
SystemTapScriptGraphOptionsTab_0=Unable to initialize launch configuration tab
SystemTapScriptGraphOptionsTab_AddGraphButton=Add...
SystemTapScriptGraphOptionsTab_AddGraphButtonToolTip=Add a new graph
+SystemTapScriptGraphOptionsTab_EditGraphButton=Edit...
+SystemTapScriptGraphOptionsTab_EditGraphButtonToolTip=Edit the selected graph
+SystemTapScriptGraphOptionsTab_RemoveGraphButton=Remove
+SystemTapScriptGraphOptionsTab_RemoveGraphButtonToolTip=Remove the selected graph
SystemTapScriptGraphOptionsTab_graphsTitle=Graphs:
-SystemTapScriptGraphOptionsTab_RemoveGraphButtonLabel=Remove the selected graph
SystemTapScriptLaunchConfigurationTab_0=Systemtap Script:
SystemTapScriptLaunchConfigurationTab_1=Browse...
SystemTapScriptLaunchConfigurationTab_2=Execute script as current user.