aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferrazzutti2013-06-03 09:51:40 (EDT)
committerSami Wagiaalla2013-06-05 16:32:02 (EDT)
commitb7aabb7513857114d529b1a8bfdc6ed786709fa7 (patch)
treec0e16ed35d2494d8e497a3f1e56a702961986a0e
parent7e6bde75f5cb6c0a8a766e8464184678316e80c8 (diff)
downloadorg.eclipse.linuxtools-b7aabb7513857114d529b1a8bfdc6ed786709fa7.zip
org.eclipse.linuxtools-b7aabb7513857114d529b1a8bfdc6ed786709fa7.tar.gz
org.eclipse.linuxtools-b7aabb7513857114d529b1a8bfdc6ed786709fa7.tar.bz2
Systemtap: Add Copy Graph buttonrefs/changes/98/13498/6
Add a "Copy Graph" button to Run Configurations->Graphing tab to allow users to create a duplicate of an existing graph. Change-Id: I3b24e3c151bcf24c3e5049b628f9c4d9b3dc4c2f Reviewed-on: https://git.eclipse.org/r/13498 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.properties2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/Messages.java2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptGraphOptionsTab.java44
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/messages.properties2
4 files changed, 41 insertions, 9 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 7fe30be..355c2e1 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
@@ -124,7 +124,7 @@ GraphFactory.AreaGraph=Area Graph
GraphFactory.LineGraph=Line Graph
GraphFactory.MeterChart=Meter Graph
GraphFactory.LineDescription=This is a simple line graph of a single set of data. Each (x,y) pair will be plotted a a single dot and connected with a solid line on the graph.
-GraphFactory.BarDescription=This is a histagram of data. One series represents the categories and the other represents the value assigned to that category.
+GraphFactory.BarDescription=This is a histogram of data. One series represents the categories and the other represents the value assigned to that category.
GraphFactory.AreaDescription=This is an Area Graph
GraphFactory.PieDescription=This is a pie chart
GraphFactory.ScatterDescription=This is a simple plot of one series of data vs another set. Each (x,y) pair will be plotted as a single dot on the graph.
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 4d33cce..370ea51 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,6 +33,8 @@ public class Messages extends NLS {
public static String SystemTapScriptGraphOptionsTab_AddGraphButton;
public static String SystemTapScriptGraphOptionsTab_AddGraphButtonToolTip;
+ public static String SystemTapScriptGraphOptionsTab_DuplicateGraphButton;
+ public static String SystemTapScriptGraphOptionsTab_DuplicateGraphButtonToolTip;
public static String SystemTapScriptGraphOptionsTab_EditGraphButton;
public static String SystemTapScriptGraphOptionsTab_EditGraphButtonToolTip;
public static String SystemTapScriptGraphOptionsTab_RemoveGraphButton;
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 a18c39c..b681382 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, editGraphButton, removeGraphButton;
+ private Button addGraphButton, duplicateGraphButton, editGraphButton, removeGraphButton;
private TableItem selectedTableItem;
private Group graphsGroup;
@@ -303,6 +303,12 @@ public class SystemTapScriptGraphOptionsTab extends
addGraphButton.setToolTipText(Messages.SystemTapScriptGraphOptionsTab_AddGraphButtonToolTip);
addGraphButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ // Button to copy an existing graph
+ duplicateGraphButton = new Button(buttonComposite, SWT.PUSH);
+ duplicateGraphButton.setText(Messages.SystemTapScriptGraphOptionsTab_DuplicateGraphButton);
+ duplicateGraphButton.setToolTipText(Messages.SystemTapScriptGraphOptionsTab_DuplicateGraphButtonToolTip);
+ duplicateGraphButton.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);
@@ -321,8 +327,7 @@ public class SystemTapScriptGraphOptionsTab extends
@Override
public void widgetSelected(SelectionEvent e) {
selectedTableItem = (TableItem) e.item;
- editGraphButton.setEnabled(true);
- removeGraphButton.setEnabled(true);
+ setSelectionControlsEnabled(true);
}
});
@@ -351,6 +356,20 @@ public class SystemTapScriptGraphOptionsTab extends
}
});
+ // Adds a new entry to the list of graphs that is a copy of the one selected.
+ duplicateGraphButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ GraphData gd = (GraphData) selectedTableItem.getData();
+
+ TableItem item = new TableItem(graphsTable, SWT.NONE);
+ item.setText(GraphFactory.getGraphName(gd.graphID) + ":" //$NON-NLS-1$
+ + gd.title);
+ item.setData(gd);
+ updateLaunchConfigurationDialog();
+ }
+ });
+
// 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.
@@ -382,8 +401,7 @@ public class SystemTapScriptGraphOptionsTab extends
@Override
public void widgetSelected(SelectionEvent e) {
selectedTableItem.dispose();
- editGraphButton.setEnabled(false);
- removeGraphButton.setEnabled(false);
+ setSelectionControlsEnabled(false);
updateLaunchConfigurationDialog();
}
});
@@ -558,18 +576,28 @@ public class SystemTapScriptGraphOptionsTab extends
private void setGraphingEnabled(boolean enabled){
this.setControlEnabled(outputParsingGroup, enabled);
this.setControlEnabled(graphsGroup, enabled);
+ // Disable buttons that rely on a selected graph if no graph is selected.
+ this.setSelectionControlsEnabled(selectedTableItem != null);
updateLaunchConfigurationDialog();
}
private void setControlEnabled(Composite composite, boolean enabled){
composite.setEnabled(enabled);
for (Control child : composite.getChildren()) {
- if (child == removeGraphButton || child == editGraphButton) {
- child.setEnabled(false);
- }
+ child.setEnabled(enabled);
if(child instanceof Composite){
setControlEnabled((Composite)child, enabled);
}
}
}
+
+ /**
+ * Call this to enable/disable all buttons whose actions depend on a selected graph.
+ * @param enabled Set to true to enable the buttons; set to false to disable them.
+ */
+ private void setSelectionControlsEnabled(boolean enabled) {
+ duplicateGraphButton.setEnabled(enabled);
+ editGraphButton.setEnabled(enabled);
+ removeGraphButton.setEnabled(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 3b82b7d..bff0e95 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,6 +26,8 @@ SystemTapScriptGraphOptionsTab_7=Graphing
SystemTapScriptGraphOptionsTab_0=Unable to initialize launch configuration tab
SystemTapScriptGraphOptionsTab_AddGraphButton=Add...
SystemTapScriptGraphOptionsTab_AddGraphButtonToolTip=Add a new graph
+SystemTapScriptGraphOptionsTab_DuplicateGraphButton=Duplicate
+SystemTapScriptGraphOptionsTab_DuplicateGraphButtonToolTip=Create a duplicate of the selected graph
SystemTapScriptGraphOptionsTab_EditGraphButton=Edit...
SystemTapScriptGraphOptionsTab_EditGraphButtonToolTip=Edit the selected graph
SystemTapScriptGraphOptionsTab_RemoveGraphButton=Remove