diff options
Diffstat (limited to 'systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org')
17 files changed, 1756 insertions, 0 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/GraphingConstants.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/GraphingConstants.java new file mode 100644 index 0000000000..0fb671b35c --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/GraphingConstants.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * 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.ui.graphing; + +import java.io.File; + +import org.eclipse.linuxtools.systemtap.ui.systemtapgui.SystemTapGUISettings; + + + +public final class GraphingConstants { + private static final String dataSetFileName = "/GraphSettings.xml"; + public static final File DataSetMetaData = new File(SystemTapGUISettings.settingsFolder.getAbsolutePath() + dataSetFileName); +} diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/GraphingPerspective.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/GraphingPerspective.java new file mode 100644 index 0000000000..f4faa4bbc8 --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/GraphingPerspective.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * 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.ui.graphing; + +import org.eclipse.linuxtools.systemtap.ui.graphing.views.GraphSelectorView; +import org.eclipse.linuxtools.systemtap.ui.logging.LogManager; +import org.eclipse.ui.IPageLayout; +import org.eclipse.ui.IPerspectiveFactory; + + + +/** + * The <code>GraphingPerspective</code> class defines the layout of the Graphing perspective + * in the application. + * @see org.eclipse.ui.IPerspectiveFactory + * @author Ryan Morse + */ +public class GraphingPerspective implements IPerspectiveFactory { + public static String ID = "org.eclipse.linuxtools.systemtap.ui.graphing.GraphingPerspective"; + + public void createInitialLayout(IPageLayout layout) { + LogManager.logDebug("Start createInitialLayout: layout-" + layout, this); + LogManager.logInfo("Initializing", this); + String editorArea = layout.getEditorArea(); + layout.setEditorAreaVisible(false); + + layout.addStandaloneView(GraphSelectorView.ID, false, IPageLayout.TOP, .75f, editorArea); + + layout.getViewLayout(GraphSelectorView.ID).setCloseable(false); + + //Add all perspectives to the MainMenu. Window->Show View + layout.addShowViewShortcut(GraphSelectorView.ID); + + //Add a link to the perspective in the MainMenu. Window->Open Perspective + layout.addPerspectiveShortcut(ID); + + LogManager.logDebug("End createInitialLayout:", this); + } +} diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/actions/ExportDataSetAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/actions/ExportDataSetAction.java new file mode 100644 index 0000000000..f7ce968532 --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/actions/ExportDataSetAction.java @@ -0,0 +1,148 @@ +/******************************************************************************* + * 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.ui.graphing.actions; + +import java.io.File; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.linuxtools.systemtap.ui.graphing.internal.Localization; +import org.eclipse.linuxtools.systemtap.ui.graphing.structures.GraphDisplaySet; +import org.eclipse.linuxtools.systemtap.ui.graphing.views.GraphSelectorView; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.datasets.IDataSet; +import org.eclipse.linuxtools.systemtap.ui.logging.LogManager; +import org.eclipse.linuxtools.systemtap.ui.structures.listeners.ITabListener; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; +import org.eclipse.ui.PlatformUI; + + + +/** + * This action handles exporting all of the data that was collected for the DataSet. It + * exports everything as a table, that can easily be read back in at a later time. + * @author Ryan Morse + */ +public class ExportDataSetAction extends Action implements IWorkbenchWindowActionDelegate { + public void init(IWorkbenchWindow window) { + LogManager.logDebug("Start ExportDataSetAction.init", this); + LogManager.logInfo("Initialize ExportDataSetAction", this); + fWindow = window; + LogManager.logDebug("End ExportDataSetAction.init", this); + } + + /** + * This is the main method of the action. It handles getting the active dataset, + * and then saving it to a file that can be accessed later. + * @param act The action that fired this method. + */ + public void run(IAction act) { + LogManager.logDebug("Start ExportDataSetAction.run", this); + File f = null; + IDataSet data = getDataSet(); + + if(null != data) + f = getFile(); + + if(f != null && data != null) + data.writeToFile(f); + LogManager.logDebug("End ExportDataSetAction.run", this); + } + + /** + * This method retreives the active <code>DataSet</code> from the <code>GraphSelectorView</code>. If no + * DataSet is active it will return null. + * @return The IDataSet in tha active display set. + */ + public IDataSet getDataSet() { + LogManager.logDebug("Start ExportDataSetAction.getDataSet", this); + IViewPart ivp = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(GraphSelectorView.ID); + IDataSet data = null; + GraphDisplaySet gds = ((GraphSelectorView)ivp).getActiveDisplaySet(); + if(null != gds) + data = gds.getDataSet(); + LogManager.logDebug("End ExportDataSetAction.getDataSet", this); + return data; + } + + /** + * This method will display a dialog box for the user to select a + * location to save the graph image. + * @return The File selected to save the image to. + */ + public File getFile() { + LogManager.logDebug("Start ExportDataSetAction.getFile", this); + String path = null; + FileDialog dialog= new FileDialog(fWindow.getShell(), SWT.SAVE); + dialog.setText(Localization.getString("ExportDataSetAction.NewFile")); + + path = dialog.open(); + + if(null == path) + return null; + + LogManager.logDebug("End ExportDataSetAction.getFile", this); + return new File(path); + } + + public void selectionChanged(IAction a, ISelection s) { + action = a; + setEnablement(false); + buildEnablementChecks(); + } + + /** + * This method is used to generate the checks to see it this button + * should be enabled or not. + */ + private void buildEnablementChecks() { + IViewPart ivp = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(GraphSelectorView.ID); + if(null != ivp) { + final GraphSelectorView gsv = (GraphSelectorView)ivp; + setEnablement(null != gsv.getActiveDisplaySet()); + gsv.addTabListener(new ITabListener() { + public void tabClosed() { + setEnablement(null != gsv.getActiveDisplaySet()); + } + + public void tabOpened() { + setEnablement(true); + } + + public void tabChanged() {} + }); + } + } + + private void setEnablement(boolean enable) { + action.setEnabled(enable); + } + + /** + * Removes all internal references in this class. Nothing should make any references + * to anyting in this class after calling the dispose method. + */ + public void dispose() { + LogManager.logDebug("Start ExportDataSetAction.dispose", this); + LogManager.logInfo("Dispose ExportDataSetAction", this); + fWindow = null; + action = null; + LogManager.logDebug("End ExportDataSetAction.dispose", this); + } + + private IWorkbenchWindow fWindow; + private IAction action; +} diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/actions/ImportDataSetAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/actions/ImportDataSetAction.java new file mode 100644 index 0000000000..b181a13349 --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/actions/ImportDataSetAction.java @@ -0,0 +1,160 @@ +/******************************************************************************* + * 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.ui.graphing.actions; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.linuxtools.systemtap.ui.graphing.GraphingPerspective; +import org.eclipse.linuxtools.systemtap.ui.graphing.internal.Localization; +import org.eclipse.linuxtools.systemtap.ui.graphing.views.GraphSelectorView; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.datasets.IDataSet; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.wizards.dataset.DataSetFactory; +import org.eclipse.linuxtools.systemtap.ui.logging.LogManager; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.WorkbenchException; + + + +/** + * This action is designed to open up an exported <code>DataSet</code> from the graphing. + * It allows users to bring up data from previous runs of stap so they can + * see old data. Importing DataSets is no different then a script live and getting data. + * @author Ryan Morse + */ +public class ImportDataSetAction extends Action implements IWorkbenchWindowActionDelegate { + public void init(IWorkbenchWindow window) { + LogManager.logDebug("Start ImportDataSetAction.init", this); + LogManager.logDebug("Initializing", this); + fWindow = window; + LogManager.logDebug("End ImportDataSetAction.init", this); + } + + /** + * This is the main method of the action. It handles prompting the user + * for a file that contans an exported DataSet. Then, it will generate + * a new <code>DataSet</code> to hold all of the data. + * @param act The action that fired this method. + */ + public void run(IAction act) { + LogManager.logDebug("Start ImportDataSetAction.run", this); + //Get the file + FileDialog dialog= new FileDialog(fWindow.getShell(), SWT.OPEN); + dialog.setText(Localization.getString("ImportDataSetAction.OpenDataSetFile")); + String fileName = dialog.open(); + + File f = null; + + if(null == fileName || fileName.length() <= 0) + return; + + f = new File(fileName); + + if(!f.exists() || !f.canRead()) + return; + + //Create a new DataSet + IDataSet dataSet = readFile(f); + + if(null == dataSet) { + displayError(Localization.getString("ImportDataSetAction.ErrorReadingDataSet")); + return; + } + + //Create a new script set + try { + IWorkbenchPage p = PlatformUI.getWorkbench().showPerspective(GraphingPerspective.ID, PlatformUI.getWorkbench().getActiveWorkbenchWindow()); + IViewPart ivp = p.findView(GraphSelectorView.ID); + ((GraphSelectorView)ivp).createScriptSet(fileName, dataSet); + } catch(WorkbenchException we) { + LogManager.logCritical("WorkbenchException ImportDataSetAction.run:" + we.getMessage(), this); + } + LogManager.logDebug("End ImportDataSetAction.run", this); + } + + public void selectionChanged(IAction a, ISelection s) {} + + /** + * Read the contents of the file into a new DataSet + * @param f The file that was selected to read a DataSet from + * @return The newly created DataSet containing the data from the file. + */ + private IDataSet readFile(File f) { + LogManager.logDebug("Start ImportDataSetAction.readFile", this); + IDataSet data; + + readHeader(f); + if(null == labels || null == id) + return null; + + data = DataSetFactory.createFilteredDataSet(id, labels); + data.readFromFile(f); + + LogManager.logDebug("End ImportDataSetAction.readFile", this); + return data; + } + + /** + * This method will read out the labels and DataSet type from the file + * @param f The file that was selected for reading. + * @return An array of all of the labels found in the file + */ + private void readHeader(File f) { + LogManager.logDebug("Start ImportDataSetAction.readLabels", this); + + try { + FileReader fr = new FileReader(f); + BufferedReader br = new BufferedReader(fr); + + id = br.readLine(); + + String line = br.readLine(); + labels = line.split(", "); + } catch(FileNotFoundException fnfe) { + LogManager.logCritical("FileNotFoundException ImportDataSetAction.readLabels:" + fnfe.getMessage(), this); + } catch(IOException ioe) { + LogManager.logCritical("IOException ImportDataSetAction.readLabels:" + ioe.getMessage(), this); + } + + LogManager.logDebug("End ImportDataSetAction.readLabels", this); + } + + private void displayError(String message) { + LogManager.logInfo("Initializing", MessageDialog.class); + MessageDialog.openWarning(fWindow.getShell(), Localization.getString("ImportDataSetAction.Problem"), message); + LogManager.logInfo("Disposing", MessageDialog.class); + } + + public void dispose() { + LogManager.logDebug("Start ImportDataSetAction.dispose", this); + LogManager.logInfo("Disposing", this); + fWindow = null; + LogManager.logDebug("End ImportDataSetAction.dispose", this); + } + + private IWorkbenchWindow fWindow; + private String id; + private String[] labels; +} diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/actions/ModifyParsingAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/actions/ModifyParsingAction.java new file mode 100644 index 0000000000..2c246742dc --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/actions/ModifyParsingAction.java @@ -0,0 +1,105 @@ +/******************************************************************************* + * 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.ui.graphing.actions; + +import java.util.ArrayList; + +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.linuxtools.systemtap.ui.consolelog.actions.ConsoleAction; +import org.eclipse.linuxtools.systemtap.ui.consolelog.structures.ScriptConsole; +import org.eclipse.linuxtools.systemtap.ui.editor.PathEditorInput; +import org.eclipse.linuxtools.systemtap.ui.graphing.GraphingConstants; +import org.eclipse.linuxtools.systemtap.ui.graphing.GraphingPerspective; +import org.eclipse.linuxtools.systemtap.ui.graphing.views.GraphSelectorView; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.datasets.IDataSet; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.datasets.IDataSetParser; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.structures.ChartStreamDaemon; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.structures.ChartStreamDaemon2; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.wizards.dataset.DataSetWizard; +import org.eclipse.linuxtools.systemtap.ui.structures.runnable.LoggedCommand; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.WorkbenchException; + + + + +/** + * The action to allow users to change the parsing expression while a script is activly running. + * @author Ryan Morse + */ +public class ModifyParsingAction extends ConsoleAction implements IWorkbenchWindowActionDelegate { + /** + * Prompts the user for a new regular expression to use in parsing the stap output for + * the <code>DataSet</code>. If the user enters a new parsing expression then it will + * get the active <code>ScriptConsole</code> and from that the active <code>LoggedCommand</code>. + * Finally, it will dispose of the old <code>ChartStreamDaemon2</code> and add an new + * one in its place. + */ + public void run() { + DataSetWizard wizard = new DataSetWizard(GraphingConstants.DataSetMetaData, getFilePath()); + IWorkbench workbench = PlatformUI.getWorkbench(); + wizard.init(workbench, null); + WizardDialog dialog = new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard); + dialog.create(); + dialog.open(); + + IDataSetParser parser = wizard.getParser(); + IDataSet dataSet = wizard.getDataSet(); + + if(null != parser && null != dataSet) { + ScriptConsole console = super.getActive(); + LoggedCommand cmd = console.getCommand(); + + ArrayList<?> listeners = cmd.getInputStreamListeners(); + ChartStreamDaemon2 daemon = null; + if(null != listeners) { + for(int i=0; i<listeners.size(); i++) { + if(listeners.get(i) instanceof ChartStreamDaemon) { + daemon = (ChartStreamDaemon2)listeners.get(i); + break; + } + } + } + if(null == daemon) { + daemon = new ChartStreamDaemon2(console, dataSet, parser); + cmd.addInputStreamListener(daemon); + } else + daemon.setParser(dataSet, parser); + + IViewPart ivp = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(GraphSelectorView.ID); + GraphSelectorView graphSelector = ((GraphSelectorView)ivp); + String name = console.getName(); + graphSelector.createScriptSet(name.substring(name.lastIndexOf('/')+1), dataSet); + } + + wizard.dispose(); + } + + /** + * Gets the file location of the file open in the editor window. + * @return The path of the file in the active editor window. + */ + private String getFilePath() { + try { + IWorkbenchPage p = PlatformUI.getWorkbench().showPerspective("org.eclipse.linuxtools.systemtap.ui.ide.IDEPerspective", PlatformUI.getWorkbench().getActiveWorkbenchWindow()); + IEditorPart ed = p.getActiveEditor(); + PlatformUI.getWorkbench().showPerspective(GraphingPerspective.ID, PlatformUI.getWorkbench().getActiveWorkbenchWindow()); + return ((PathEditorInput)ed.getEditorInput()).getPath().toString(); + } catch(WorkbenchException we) {} + return null; + } +}
\ No newline at end of file diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/actions/OpenScriptOutputAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/actions/OpenScriptOutputAction.java new file mode 100644 index 0000000000..d011363901 --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/actions/OpenScriptOutputAction.java @@ -0,0 +1,200 @@ +/******************************************************************************* + * 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.ui.graphing.actions; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.linuxtools.systemtap.ui.graphing.GraphingConstants; +import org.eclipse.linuxtools.systemtap.ui.graphing.GraphingPerspective; +import org.eclipse.linuxtools.systemtap.ui.graphing.internal.Localization; +import org.eclipse.linuxtools.systemtap.ui.graphing.views.GraphSelectorView; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.datasets.IDataEntry; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.datasets.IDataSet; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.datasets.IDataSetParser; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.wizards.dataset.DataSetWizard; +import org.eclipse.linuxtools.systemtap.ui.logging.LogManager; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.WorkbenchException; + + + +/** + * This action is designed to open up the raw script output from a stap command. + * It will act just like the user is running a script with graphing, but will + * not cause update events. + * @author Ryan Morse + */ +public class OpenScriptOutputAction extends Action implements IWorkbenchWindowActionDelegate { + public void init(IWorkbenchWindow window) { + LogManager.logDebug("Start OpenScriptOutputAction.init", this); + LogManager.logDebug("Initializing", this); + fWindow = window; + LogManager.logDebug("End OpenScriptOutputAction.init", this); + } + + /** + * This is the main method of the action. It handles prompting the user + * for a file that they want to graph. Then prompts the user to select a + * parsing expression to use to break the table into tabular output. Finally, + * it will generate a new <code>DataSet</code> to hold all of the data. + * @param act The action that fired this method. + */ + public void run(IAction act) { + LogManager.logDebug("Start OpenScriptOutputAction.run", this); + + File f = queryFile(); + + if(null == f) { + } else if(!f.exists()) { + displayError(Localization.getString("OpenScriptOutputAction.SelectedFileDNE")); + } else if(!f.canRead()) { + displayError(Localization.getString("OpenScriptOutputAction.SelectedFileCanNotRead")); + } else { + //Get the file from the user + StringBuilder sb = new StringBuilder(); + readFile(f, sb); + if(getChartingOptions(f.getAbsolutePath())) { + IDataEntry output; + while(true) { + output = parser.parse(sb); + if(null != output) + dataSet.setData(output); + else + break; + } + + try { + IWorkbenchPage p = PlatformUI.getWorkbench().showPerspective(GraphingPerspective.ID, PlatformUI.getWorkbench().getActiveWorkbenchWindow()); + IViewPart ivp = p.findView(GraphSelectorView.ID); + ((GraphSelectorView)ivp).createScriptSet(f.getName(), dataSet); + } catch(WorkbenchException we) { + LogManager.logCritical("WorkbenchException OpenScriptOutputAction.run:" + we.getMessage(), this); + } + } + } + + LogManager.logDebug("End OpenScriptOutputAction.run", this); + } + + + /** + * This method will display a dialog box for the user to select a + * location to open a file from. + * @return The File selected to open. + */ + private File queryFile() { + LogManager.logDebug("Start queryFile:", this); + FileDialog dialog= new FileDialog(fWindow.getShell(), SWT.OPEN); + dialog.setText(Localization.getString("OpenScriptOutputAction.OpenFile")); + String path= dialog.open(); + if (path != null && path.length() > 0) { + LogManager.logDebug("queryFile: returnVal-" + path, this); + return new File(path); + } + LogManager.logDebug("queryFile: returnVal-null", this); + return null; + } + + /** + * This method will display the error message to the user in the case + * that something went wrong. + * @param message The message that should be shown in the error dialog. + */ + private void displayError(String message) { + LogManager.logDebug("Start OpenScriptOutputAction.displayError", this); + LogManager.logInfo("Initializing", MessageDialog.class); + MessageDialog.openWarning(fWindow.getShell(), Localization.getString("OpenScriptOutputAction.Problem"), message); + LogManager.logInfo("Disposing", MessageDialog.class); + LogManager.logDebug("End OpenScriptOutputAction.displayError", this); + } + + /** + * This method will read the contents of the provided file and + * add the contents to the provided StringBuilder. + * @param f The file that will be opened for reading + * @param sb The StringBuilder to store the contents of the file + */ + private void readFile(File f, StringBuilder sb) { + LogManager.logDebug("Start ImportDataSetAction.readData", this); + try { + FileReader fr = new FileReader(f); + BufferedReader br = new BufferedReader(fr); + + String line; + while(null != (line=br.readLine())) { + sb.append(line); + } + } catch(FileNotFoundException fnfe) { + fnfe.printStackTrace(); + LogManager.logCritical("FileNotFoundException ImportDataSetAction.readData:" + fnfe.getMessage(), this); + } catch(IOException ioe) { + ioe.printStackTrace(); + LogManager.logCritical("IOException ImportDataSetAction.readData:" + ioe.getMessage(), this); + } + LogManager.logDebug("End ImportDataSetAction.readData", this); + } + + /** + * This method will get all of the parsing information from the user. + * @param filePath The location of the file to be opened. + * @return boolean representing whether or not it was successful + */ + protected boolean getChartingOptions(String filePath) { + DataSetWizard wizard = new DataSetWizard(GraphingConstants.DataSetMetaData, filePath); + IWorkbench workbench = PlatformUI.getWorkbench(); + wizard.init(workbench, null); + WizardDialog dialog = new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard); + dialog.create(); + dialog.open(); + + parser = wizard.getParser(); + dataSet = wizard.getDataSet(); + + wizard.dispose(); + return(null != parser && null != dataSet); + } + + public void selectionChanged(IAction a, ISelection s) { + } + + /** + * Removes all internal references in this class. Nothing should make any references + * to anyting in this class after calling the dispose method. + */ + public void dispose() { + LogManager.logDebug("Start OpenScriptOutputAction.dispose", this); + LogManager.logInfo("Disposing", this); + fWindow = null; + parser = null; + LogManager.logDebug("End OpenScriptOutputAction.dispose", this); + } + + private IWorkbenchWindow fWindow; + private IDataSet dataSet; + private IDataSetParser parser; +} diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/actions/SaveGraphImageAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/actions/SaveGraphImageAction.java new file mode 100644 index 0000000000..1d88bce6cc --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/actions/SaveGraphImageAction.java @@ -0,0 +1,234 @@ +/******************************************************************************* + * 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.ui.graphing.actions; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.linuxtools.systemtap.ui.graphing.internal.Localization; +import org.eclipse.linuxtools.systemtap.ui.graphing.structures.GraphDisplaySet; +import org.eclipse.linuxtools.systemtap.ui.graphing.views.GraphSelectorView; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.graphs.IGraph; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.widgets.GraphCanvas; +import org.eclipse.linuxtools.systemtap.ui.logging.LogManager; +import org.eclipse.linuxtools.systemtap.ui.structures.listeners.ITabListener; +import org.eclipse.swt.SWT; +import org.eclipse.swt.SWTException; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.ImageLoader; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; +import org.eclipse.ui.PlatformUI; + + + +/** + * This action is designed to allow for saving of the graph in the active window. + * It will let the user select the location to save the image, and then save it as + * a jpg image. + * @author Ryan Morse + */ +public class SaveGraphImageAction extends Action implements IWorkbenchWindowActionDelegate { + public void init(IWorkbenchWindow window) { + fWindow = window; + } + + /** + * This is the main method of the action. It handles getting the active graph, + * prompting the user for a location to save the image to, and then actually doing + * the save. + * @param act The action that fired this method. + */ + public void run(IAction act) { + LogManager.logDebug("Start run", this); + IGraph g = getGraph(); + try { + PlatformUI.getWorkbench().getDisplay().update(); + } catch(SWTException swte) { + LogManager.logCritical("SWTException SaveGraphImageAction.run:" + swte.getMessage(), this); + } + if(null == g) { + displayError(Localization.getString("SaveGraphImageAction.CanNotGetGraph")); + return; + } + + ImageData image = getImage(g); + if(null == image) { + displayError(Localization.getString("SaveGraphImageAction.CanNotCreateImage")); + return; + } + + String path = getFile(); + if(null == path) + return; + + save(image, path); + LogManager.logDebug("End run", this); + } + + /** + * This method retreives the active graph from the GraphSelectorView. If no + * graph is active it will return null. + * @return The IGraph in tha active display set. + */ + public IGraph getGraph() { + LogManager.logDebug("Start getGraph", this); + IViewPart ivp = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(GraphSelectorView.ID); + IGraph g = null; + + GraphDisplaySet gds = ((GraphSelectorView)ivp).getActiveDisplaySet(); + if(null != gds) + g = gds.getActiveGraph(); + LogManager.logDebug("End getGraph", this); + return g; + } + + /** + * This method converts the Graph into an actual image. + * @param g The graph that needs to be converted to an image + * @return The Image that was generated by the supplied Graph. + */ + public ImageData getImage(IGraph g) { + LogManager.logDebug("Start getImage", this); + GraphCanvas canvas = (GraphCanvas)g; + GC gc = new GC(canvas); + Image image = new Image(canvas.getDisplay(), canvas.getSize().x, canvas.getSize().y); + gc.copyArea(image, 0, 0); + gc.dispose(); + + ImageData data = image.getImageData(); + image.dispose(); + LogManager.logDebug("End getImage", this); + return data; + } + + /** + * This method will display a dialog box for the user to select a + * location to save the graph image. + * @return The String location selected to save the image to. + */ + public String getFile() { + LogManager.logDebug("Start getFile", this); //$NON-NLS-1$ + FileDialog dialog= new FileDialog(fWindow.getShell(), SWT.SAVE); + dialog.setText(Localization.getString("SaveGraphImageAction.NewFile")); + + LogManager.logInfo("Init FileDialog", dialog); + LogManager.logDebug("End getFile", this); + return dialog.open(); + } + + /** + * This method will perform the save operation to store the generated + * image as an image file on the computer + * @param image The image data generated from the graph + * @param path The location to create the new file in and save to. + */ + public void save(ImageData image, String path) { + LogManager.logDebug("Start save", this); + + ImageLoader loader = new ImageLoader(); + loader.data = new ImageData[] {image}; + loader.save(path, SWT.IMAGE_JPEG); + + LogManager.logDebug("End save", this); + } + + /** + * This method will display the error message to the user in the case + * that something went wrong. + * @param message The message that should be shown in the error dialog. + */ + private void displayError(String message) { + LogManager.logInfo("Initializing", MessageDialog.class); + MessageDialog.openWarning(fWindow.getShell(), Localization.getString("SaveGraphImageAction.Problem"), message); + LogManager.logInfo("Disposing", MessageDialog.class); + } + + /** + * This method is used to generate the checks to see it this button + * should be enabled or not. + */ + public void selectionChanged(IAction a, ISelection s) { + action = a; + setEnablement(false); + buildEnablementChecks(); + } + + /** + * This method is used to generate the checks to see it this button + * should be enabled or not. + */ + private void buildEnablementChecks() { + IViewPart ivp = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(GraphSelectorView.ID); + if(null != ivp) { + final GraphSelectorView gsv = (GraphSelectorView)ivp; + gsv.addTabListener(new ITabListener() { + public void tabClosed() { + if(null == gsv.getActiveDisplaySet() || null == gsv.getActiveDisplaySet().getActiveGraph()) + setEnablement(false); + } + + public void tabOpened() { + gsv.getActiveDisplaySet().addTabListener(new ITabListener() { + public void tabClosed() { + if(null == gsv.getActiveDisplaySet().getActiveGraph()) + setEnablement(false); + } + + public void tabOpened() { + if(null != gsv.getActiveDisplaySet().getActiveGraph()) + setEnablement(true); + } + + public void tabChanged() { + if(null == gsv.getActiveDisplaySet() || null == gsv.getActiveDisplaySet().getActiveGraph()) + setEnablement(false); + else + setEnablement(true); + } + }); + } + + public void tabChanged() { + if(null == gsv.getActiveDisplaySet() || null == gsv.getActiveDisplaySet().getActiveGraph()) + setEnablement(false); + else + setEnablement(true); + } + }); + } + } + + private void setEnablement(boolean enable) { + action.setEnabled(enable); + } + + /** + * Removes all internal references in this class. Nothing should make any references + * to anyting in this class after calling the dispose method. + */ + public void dispose() { + LogManager.logInfo("Start dispose", this); + LogManager.logInfo("Disposing", MessageDialog.class); + fWindow = null; + action = null; + LogManager.logDebug("End dispose", this); + } + + private IWorkbenchWindow fWindow; + private IAction action; +} diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/internal/GraphingPlugin.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/internal/GraphingPlugin.java new file mode 100644 index 0000000000..4cc210b09e --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/internal/GraphingPlugin.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * 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.ui.graphing.internal; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The main plugin class to be used in the desktop. + */ +public class GraphingPlugin extends AbstractUIPlugin { + + //The shared instance. + private static GraphingPlugin plugin; + + /** + * The constructor. + */ + public GraphingPlugin() { + plugin = this; + } + + /** + * This method is called upon plug-in activation + */ + public void start(BundleContext context) throws Exception { + super.start(context); + } + + /** + * This method is called when the plug-in is stopped + */ + public void stop(BundleContext context) throws Exception { + super.stop(context); + plugin = null; + } + + /** + * Returns the shared instance. + */ + public static GraphingPlugin getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path. + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.linuxtools.systemtap.ui.graphing", path); + } +} diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/internal/Localization.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/internal/Localization.java new file mode 100644 index 0000000000..7525e5f791 --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/internal/Localization.java @@ -0,0 +1,22 @@ +package org.eclipse.linuxtools.systemtap.ui.graphing.internal; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Localization { + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.systemtap.ui.graphing.internal.localization"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + + private Localization() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/internal/localization.properties b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/internal/localization.properties new file mode 100644 index 0000000000..75ee813387 --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/internal/localization.properties @@ -0,0 +1,20 @@ +ExportDataSetAction.NewFile=New File + +ImportDataSetAction.OpenDataSetFile=Open DataSet File +ImportDataSetAction.ErrorReadingDataSet=Error reading the selected dataset. +ImportDataSetAction.Problem=Problem + +OpenScriptOutputAction.SelectedFileDNE=Selected file does not exist\! +OpenScriptOutputAction.SelectedFileCanNotRead=Selected file can not be read\! +OpenScriptOutputAction.OpenFile=Open File +OpenScriptOutputAction.Problem=Problem + +SaveGraphImageAction.CanNotGetGraph=Can't get active graph. +SaveGraphImageAction.CanNotCreateImage=Can't create image +SaveGraphImageAction.NewFile=New File +SaveGraphImageAction.Problem=Problem + +GraphingPreferencePage.GraphDisplayPreferences=Basic preferences for graph display. +GraphingPreferencePage.RefreshDelay=&Refresh delay (ms): + +GraphDisplaySet.DataView=Data View diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/preferences/DataTablePreferencePage.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/preferences/DataTablePreferencePage.java new file mode 100644 index 0000000000..eb90cf2ac4 --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/preferences/DataTablePreferencePage.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * 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.ui.graphing.preferences; + +import org.eclipse.jface.preference.BooleanFieldEditor; +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.jface.preference.IntegerFieldEditor; +import org.eclipse.linuxtools.systemtap.ui.graphing.internal.GraphingPlugin; +import org.eclipse.linuxtools.systemtap.ui.graphing.internal.Localization; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.preferences.GraphingAPIPreferenceConstants; +import org.eclipse.linuxtools.systemtap.ui.logging.LogManager; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + + + +public class DataTablePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { + public DataTablePreferencePage() { + super(GRID); + LogManager.logDebug("Start DataTablePreferencePage:", this); + //setPreferenceStore(GraphingAPIUIPlugin.getDefault().getPreferenceStore()); + setPreferenceStore(GraphingPlugin.getDefault().getPreferenceStore()); + setDescription(Localization.getString("DataTablePreferencePage.GraphDisplayPreferences")); + LogManager.logDebug("End DataTablePreferencePage:", this); + } + + public void createFieldEditors() { + LogManager.logDebug("Start createFieldEditors:", this); + + addField(new BooleanFieldEditor( + GraphingAPIPreferenceConstants.P_JUMP_NEW_TABLE_ENTRY, + Localization.getString("DataTablePreferencePage.JumpNewestEntry"), + getFieldEditorParent())); + + addField(new BooleanFieldEditor( + GraphingAPIPreferenceConstants.P_AUTO_RESIZE, + Localization.getString("DataTablePreferencePage.AutoResizeColumns"), + getFieldEditorParent())); + + addField( + new IntegerFieldEditor( + GraphingAPIPreferenceConstants.P_MAX_DATA_ITEMS, + Localization.getString("DataTablePreferencePage.MaxDataItems"), + getFieldEditorParent())); + + LogManager.logDebug("End createFieldEditors:", this); + } + + public void init(IWorkbench workbench) { + LogManager.logDebug("Start init:", this); + LogManager.logInfo("Initializing", this); + LogManager.logDebug("End init:", this); + } + + public void dispose() { + LogManager.logDebug("Start dispose:", this); + LogManager.logInfo("Disposing", this); + super.dispose(); + LogManager.logDebug("End dispose:", this); + } +} + diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/preferences/GraphPreferencePage.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/preferences/GraphPreferencePage.java new file mode 100644 index 0000000000..ce88e48916 --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/preferences/GraphPreferencePage.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * 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.ui.graphing.preferences; + +import org.eclipse.jface.preference.BooleanFieldEditor; +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.jface.preference.IntegerFieldEditor; +import org.eclipse.linuxtools.systemtap.ui.graphing.internal.GraphingPlugin; +import org.eclipse.linuxtools.systemtap.ui.graphing.internal.Localization; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.preferences.GraphingAPIPreferenceConstants; +import org.eclipse.linuxtools.systemtap.ui.logging.LogManager; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + + + +public class GraphPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { + public GraphPreferencePage() { + super(GRID); + LogManager.logDebug("Start GraphPreferencePage:", this); + setPreferenceStore(GraphingPlugin.getDefault().getPreferenceStore()); + //setPreferenceStore(GraphingAPIUIPlugin.getDefault().getPreferenceStore()); + setDescription(Localization.getString("GraphPreferencePage.GraphDisplayPreferences")); + LogManager.logDebug("End GraphPreferencePage:", this); + } + + public void createFieldEditors() { + LogManager.logDebug("Start createFieldEditors:", this); + + addField(new BooleanFieldEditor( + GraphingAPIPreferenceConstants.P_SHOW_GRID_LINES, + Localization.getString("GraphPreferencePage.ShowGridLines"), + getFieldEditorParent())); + + addField( + new IntegerFieldEditor( + GraphingAPIPreferenceConstants.P_MAX_DATA_ITEMS, + Localization.getString("GraphPreferencePage.MaxDataItems"), + getFieldEditorParent())); + + addField( + new IntegerFieldEditor( + GraphingAPIPreferenceConstants.P_VIEWABLE_DATA_ITEMS, + Localization.getString("GraphPreferencePage.ViewableDataItems"), + getFieldEditorParent())); + + addField( + new IntegerFieldEditor( + GraphingAPIPreferenceConstants.P_X_SERIES_TICKS, + Localization.getString("GraphPreferencePage.XSeriesTicks"), + getFieldEditorParent())); + + addField( + new IntegerFieldEditor( + GraphingAPIPreferenceConstants.P_Y_SERIES_TICKS, + Localization.getString("GraphPreferencePage.YSeriesTicks"), + getFieldEditorParent())); + + LogManager.logDebug("End createFieldEditors:", this); + } + + public void init(IWorkbench workbench) { + LogManager.logDebug("Start init:", this); + LogManager.logInfo("Initializing", this); + LogManager.logDebug("End init:", this); + } + + public void dispose() { + LogManager.logDebug("Start dispose:", this); + LogManager.logInfo("Disposing", this); + super.dispose(); + LogManager.logDebug("End dispose:", this); + } +} + diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/preferences/GraphingPreferenceConstants.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/preferences/GraphingPreferenceConstants.java new file mode 100644 index 0000000000..208328151f --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/preferences/GraphingPreferenceConstants.java @@ -0,0 +1,20 @@ +/******************************************************************************* + * 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.ui.graphing.preferences; + +public class GraphingPreferenceConstants { + + //graphing + public static final String P_GRAPH_UPDATE_DELAY = "GraphUpdateDelay"; + + +} diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/preferences/GraphingPreferencePage.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/preferences/GraphingPreferencePage.java new file mode 100644 index 0000000000..8e526657a2 --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/preferences/GraphingPreferencePage.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * 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.ui.graphing.preferences; + +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.jface.preference.IntegerFieldEditor; +import org.eclipse.linuxtools.systemtap.ui.graphing.internal.GraphingPlugin; +import org.eclipse.linuxtools.systemtap.ui.graphing.internal.Localization; +import org.eclipse.linuxtools.systemtap.ui.logging.LogManager; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + + + +public class GraphingPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { + public GraphingPreferencePage() { + super(GRID); + LogManager.logDebug("Start GraphingPreferencePage:", this); + setPreferenceStore(GraphingPlugin.getDefault().getPreferenceStore()); + setDescription(Localization.getString("GraphingPreferencePage.GraphDisplayPreferences")); + LogManager.logDebug("End GraphingPreferencePage:", this); + } + + public void createFieldEditors() { + LogManager.logDebug("Start createFieldEditors:", this); + + addField( + new IntegerFieldEditor( + GraphingPreferenceConstants.P_GRAPH_UPDATE_DELAY, + Localization.getString("GraphingPreferencePage.RefreshDelay"), + getFieldEditorParent())); + + LogManager.logDebug("End createFieldEditors:", this); + } + + public void init(IWorkbench workbench) { + LogManager.logDebug("Start init:", this); + LogManager.logInfo("Initializing", this); + LogManager.logDebug("End init:", this); + } + + public void dispose() { + LogManager.logDebug("Start dispose:", this); + LogManager.logInfo("Disposing", this); + super.dispose(); + LogManager.logDebug("End dispose:", this); + } +} diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/preferences/PreferenceInitializer.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/preferences/PreferenceInitializer.java new file mode 100644 index 0000000000..c49d777230 --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/preferences/PreferenceInitializer.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * 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.ui.graphing.preferences; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.linuxtools.systemtap.ui.graphing.internal.GraphingPlugin; +import org.eclipse.linuxtools.systemtap.ui.logging.LogManager; + + + +public class PreferenceInitializer extends AbstractPreferenceInitializer { + public void initializeDefaultPreferences() { + LogManager.logDebug("Start initializeDefaultPreferences:", this); + IPreferenceStore store = GraphingPlugin.getDefault().getPreferenceStore(); + + //graphing + store.setDefault(GraphingPreferenceConstants.P_GRAPH_UPDATE_DELAY, 1000); + +/* These are set in graphingapi.ui. They shouldn't be reset here + + IPreferenceStore store2 = GraphingAPIUIPlugin.getDefault().getPreferenceStore(); + //graphing.graph + store2.setDefault(GraphingAPIPreferenceConstants.P_SHOW_GRID_LINES, true); + store2.setDefault(GraphingAPIPreferenceConstants.P_VIEWABLE_DATA_ITEMS, 100); + + //graphing.datatable + store2.setDefault(GraphingAPIPreferenceConstants.P_AUTO_RESIZE, true); + store2.setDefault(GraphingAPIPreferenceConstants.P_JUMP_NEW_TABLE_ENTRY, false); + store2.setDefault(GraphingAPIPreferenceConstants.P_MAX_DATA_ITEMS, 250); +*/ + LogManager.logDebug("End initializeDefaultPreferences:", this); + } +} diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/structures/GraphDisplaySet.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/structures/GraphDisplaySet.java new file mode 100644 index 0000000000..2ad625742e --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/structures/GraphDisplaySet.java @@ -0,0 +1,272 @@ +/******************************************************************************* + * 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.ui.graphing.structures; + +import java.util.ArrayList; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.linuxtools.systemtap.ui.graphing.internal.GraphingPlugin; +import org.eclipse.linuxtools.systemtap.ui.graphing.internal.Localization; +import org.eclipse.linuxtools.systemtap.ui.graphing.preferences.GraphingPreferenceConstants; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.datasets.IDataSet; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.structures.GraphData; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.datadisplay.DataGrid; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.graphs.IGraph; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.widgets.GraphComposite; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.wizards.dataset.DataSetFactory; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.wizards.graph.GraphFactory; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.wizards.graph.SelectGraphWizard; +import org.eclipse.linuxtools.systemtap.ui.logging.LogManager; +import org.eclipse.linuxtools.systemtap.ui.structures.UpdateManager; +import org.eclipse.linuxtools.systemtap.ui.structures.listeners.ITabListener; +import org.eclipse.linuxtools.systemtap.ui.structures.listeners.IUpdateListener; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabFolder2Listener; +import org.eclipse.swt.custom.CTabFolderEvent; +import org.eclipse.swt.custom.CTabItem; +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.widgets.Composite; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; + + + +/** + * This class is used to contain all of the graphing components that can + * be displayed as individual tabs in a single location. + * @author Ryan Morse + */ +public class GraphDisplaySet { + public GraphDisplaySet(Composite parent, IDataSet data) { + LogManager.logDebug("Start GraphSelectorView:", this); + LogManager.logInfo("Initializing", this); + IPreferenceStore p = GraphingPlugin.getDefault().getPreferenceStore(); + int delay = p.getInt(GraphingPreferenceConstants.P_GRAPH_UPDATE_DELAY); + + dataSet = data; + // if(null != cmd) { + updater = new UpdateManager(delay); + updater.addUpdateListener(new IUpdateListener() { + public void handleUpdateEvent() { + // if(!cmd.isRunning()) + // updater.stop(); + } + }); + // } + createPartControl(parent); + + graphs = new ArrayList<IGraph>(); + tabListeners = new ArrayList<ITabListener>(); + LogManager.logDebug("End GraphSelectorView:", this); + } + + /** + * This method creates the framework for what will be displayed by this dialog box. + * @param parent The composite that will contain all the elements from this dialog + */ + public void createPartControl(Composite parent) { + LogManager.logDebug("Start createPartControl: parent-" + parent, this); + + parent.setLayout(new FormLayout()); + FormData data1 = new FormData(); + Composite cmpCoolBar = new Composite(parent, SWT.NONE); + data1.left = new FormAttachment(0, 0); + data1.top = new FormAttachment(0, 0); + data1.right = new FormAttachment(100, 0); + data1.bottom = new FormAttachment(0, 10); + cmpCoolBar.setLayoutData(data1); + + FormData data2 = new FormData(); + data2.left = new FormAttachment(0, 0); + data2.top = new FormAttachment(cmpCoolBar); + data2.right = new FormAttachment(100, 0); + data2.bottom = new FormAttachment(100, 0); + Composite cmpGraph = new Composite(parent, SWT.NONE); + cmpGraph.setLayoutData(data2); + + //This is for the tab view + cmpGraph.setLayout(new FormLayout()); + + folder = new CTabFolder(cmpGraph, SWT.NONE); + FormData data = new FormData(); + data.top = new FormAttachment(0, 0); + data.left = new FormAttachment(0, 0); + data.right = new FormAttachment(100, 0); + data.bottom = new FormAttachment(100, 0); + folder.setLayoutData(data); + + listener = new ButtonClickListener(); + folder.addSelectionListener(listener); + + folder.addCTabFolder2Listener(new CTabFolder2Listener() { + public void restore(CTabFolderEvent e) {} + public void showList(CTabFolderEvent e) {} + public void minimize(CTabFolderEvent e) {} + public void maximize(CTabFolderEvent e) {} + public void close(CTabFolderEvent e) { + int selected = folder.indexOf((CTabItem)e.item)-2; + if(null != updater) + updater.removeUpdateListener((IGraph)graphs.get(selected)); + graphs.remove(selected); + fireTabCloseEvent(); + } + }); + + //This is a tab/button for opening new graphs + CTabItem newGraph = new CTabItem(folder, SWT.NONE); + newGraph.setImage(GraphingPlugin.getImageDescriptor("icons/actions/new_wiz.gif").createImage()); + + //Tab containing the data table + CTabItem item = new CTabItem(folder, SWT.NONE); + item.setText(Localization.getString("GraphDisplaySet.DataView")); + Composite c = new Composite(folder, SWT.NONE); + GridLayout grid = new GridLayout(); + grid.marginHeight = 0; + grid.marginWidth = 0; + c.setLayout(grid); + + GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); + DataGrid table = DataSetFactory.getDataGrid(c, dataSet); + if(null != updater) + updater.addUpdateListener(table); + table.getControl().setLayoutData(gd); + item.setControl(c); + folder.setSelection(item); + lastSelectedTab = 1; + + LogManager.logDebug("End createPartControl", this); + } + + public IDataSet getDataSet() { + return dataSet; + } + + /** + * Finds the graph that is open in the current tab + * @return The graph that is currently visible on the screen + */ + public IGraph getActiveGraph() { + if(0 == graphs.size() || folder.getSelectionIndex() < 2) + return null; + return (IGraph)graphs.get(folder.getSelectionIndex()-2); + } + + public void setFocus() {} + + /** + * Removes all internal references in this class. Nothing should make any references + * to anyting in this class after calling the dispose method. + */ + public void dispose() { + LogManager.logDebug("Start dispose:", this); + LogManager.logInfo("Disposing", this); + + if(null != updater) + updater.dispose(); + updater = null; + + dataSet = null; + if(null != folder) { + folder.removeSelectionListener(listener); + folder.dispose(); + folder = null; + } + listener = null; + + LogManager.logDebug("End dispose:", this); + } + + /** + * This class handles switching between tabs and creating new graphs. + * When the user selects the first tab a new dialog is displayed for + * them to slect what they want to display for the new graph. + */ + public class ButtonClickListener implements SelectionListener { + public void widgetDefaultSelected(SelectionEvent event) {} + public void widgetSelected(SelectionEvent event) { + CTabFolder folder = (CTabFolder)event.getSource(); + + if(folder.getSelectionIndex() == 0) { + folder.setSelection(lastSelectedTab); + SelectGraphWizard wizard = new SelectGraphWizard(dataSet); + 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) { + CTabItem item = new CTabItem(folder, SWT.CLOSE); + item.setText(GraphFactory.getGraphName(gd.graphID)); + GraphComposite gc = new GraphComposite(folder, SWT.FILL, gd, dataSet); + gc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + folder.setSelection(item); + + IGraph g = gc.getGraph(); + item.setControl(gc); + + if(null != g) { + if(null != updater) + updater.addUpdateListener(g); + graphs.add(g); + } + } + wizard.dispose(); + fireTabOpenEvent(); + } + lastSelectedTab = folder.getSelectionIndex(); + fireTabChangedEvent(); + } + } + + public void addTabListener(ITabListener listener) { + tabListeners.add(listener); + } + + public void removeTabListener(ITabListener listener) { + tabListeners.remove(listener); + } + + private void fireTabCloseEvent() { + for(int i=0; i<tabListeners.size(); i++) + ((ITabListener)tabListeners.get(i)).tabClosed(); + } + + private void fireTabOpenEvent() { + for(int i=0; i<tabListeners.size(); i++) + ((ITabListener)tabListeners.get(i)).tabOpened(); + } + + private void fireTabChangedEvent() { + for(int i=0; i<tabListeners.size(); i++) + ((ITabListener)tabListeners.get(i)).tabChanged(); + } + + private int lastSelectedTab; + private IDataSet dataSet; + private CTabFolder folder; + private ButtonClickListener listener; + private UpdateManager updater; + private ArrayList<ITabListener> tabListeners; + + private ArrayList<IGraph> graphs; +}
\ No newline at end of file diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/views/GraphSelectorView.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/views/GraphSelectorView.java new file mode 100644 index 0000000000..9acb449480 --- /dev/null +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/systemtap/ui/graphing/views/GraphSelectorView.java @@ -0,0 +1,184 @@ +/******************************************************************************* + * 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.ui.graphing.views; + +import java.util.ArrayList; + +import org.eclipse.linuxtools.systemtap.ui.graphing.structures.GraphDisplaySet; +import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.datasets.IDataSet; +import org.eclipse.linuxtools.systemtap.ui.logging.LogManager; +import org.eclipse.linuxtools.systemtap.ui.structures.listeners.ITabListener; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabFolder2Listener; +import org.eclipse.swt.custom.CTabFolderEvent; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.part.ViewPart; + + + +/** + * This class is designed to hold a number of different running script sets. + * Each running script is given its own tab that contains all the details for + * that specific script. Script sets can be created or disposed of at the will + * of the user. + * @author Ryan Morse + */ +public class GraphSelectorView extends ViewPart { + public GraphSelectorView() { + super(); + LogManager.logDebug("Start GraphSelectorView:", this); + LogManager.logInfo("Initializing", this); + displaySets = new ArrayList<GraphDisplaySet>(); + tabListeners = new ArrayList<ITabListener>(); + LogManager.logDebug("End GraphSelectorView:", this); + } + + /** + * This method will create a new script set for the provided dataSet + * The new script set will be given a new tab item at the end of + * the list. + * @param title The name to be shown on the new tab + * @param dataSet The <code>IDataSet</code> for the new script set + * @param cmd The running command that this script set represents. + */ + public void createScriptSet(String title, IDataSet dataSet) { + CTabItem item; + + item = new CTabItem(scriptFolder, SWT.CLOSE); + item.setText(title); + Composite parent = new Composite(scriptFolder, SWT.NONE); + parent.setBackground(new Color(parent.getDisplay(), 0, 0, 255)); + GraphDisplaySet gds = new GraphDisplaySet(parent, dataSet); + displaySets.add(gds); + item.setControl(parent); + + scriptFolder.setSelection(item); + fireTabOpenEvent(); + } + + /** + * This method creates the framework for what will be displayed by this dialog box. + * @param parent The composite that will contain all the elements from this dialog + */ + public void createPartControl(Composite parent) { + LogManager.logDebug("Start createPartControl: parent-" + parent, this); + + FormData data2 = new FormData(); + data2.left = new FormAttachment(0, 0); + data2.top = new FormAttachment(0, 0); + data2.right = new FormAttachment(100, 0); + data2.bottom = new FormAttachment(100, 0); + Composite cmpGraph = new Composite(parent, SWT.NONE); + cmpGraph.setLayoutData(data2); + + //This is for the tab view + cmpGraph.setLayout(new FormLayout()); + + //Create the folder for all of the script sets, so it takes up all of the parent composite + scriptFolder = new CTabFolder(cmpGraph, SWT.NONE); + FormData data = new FormData(); + data.top = new FormAttachment(0, 0); + data.left = new FormAttachment(0, 0); + data.right = new FormAttachment(100, 0); + data.bottom = new FormAttachment(100, 0); + scriptFolder.setLayoutData(data); + scriptFolder.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + fireTabChangedEvent(); + } + + public void widgetDefaultSelected(SelectionEvent e) {} + }); + + + scriptFolder.addCTabFolder2Listener(new CTabFolder2Listener() { + public void restore(CTabFolderEvent e) {} + public void showList(CTabFolderEvent e) {} + public void minimize(CTabFolderEvent e) {} + public void maximize(CTabFolderEvent e) {} + public void close(CTabFolderEvent e) { + displaySets.remove(scriptFolder.indexOf((CTabItem)e.item)); + fireTabCloseEvent(); + } + }); + + LogManager.logDebug("End createPartControl", this); + } + + /** + * Finds and returns the active component inside of the active script set + * @return The <code>GraphDisplaySet</code> that is currently active + */ + public GraphDisplaySet getActiveDisplaySet() { + int index = scriptFolder.getSelectionIndex(); + if(index >= 0 && index < displaySets.size()) + return (GraphDisplaySet)displaySets.get(index); + else + return null; + } + + public void setFocus() {} + + public void addTabListener(ITabListener listener) { + tabListeners.add(listener); + } + + public void removeTabListener(ITabListener listener) { + tabListeners.remove(listener); + } + + private void fireTabCloseEvent() { + for(int i=0; i<tabListeners.size(); i++) + ((ITabListener)tabListeners.get(i)).tabClosed(); + } + + private void fireTabOpenEvent() { + for(int i=0; i<tabListeners.size(); i++) + ((ITabListener)tabListeners.get(i)).tabOpened(); + } + + private void fireTabChangedEvent() { + for(int i=0; i<tabListeners.size(); i++) + ((ITabListener)tabListeners.get(i)).tabChanged(); + } + + /** + * Removes all internal references in this class. Nothing should make any references + * to anyting in this class after calling the dispose method. + */ + public void dispose() { + LogManager.logDebug("Start dispose:", this); + LogManager.logInfo("Disposing", this); + super.dispose(); + + if(null != scriptFolder) + scriptFolder.dispose(); + scriptFolder = null; + if(null != tabListeners) + tabListeners.removeAll(tabListeners); + tabListeners = null; + LogManager.logDebug("End dispose:", this); + } + + private CTabFolder scriptFolder; + private ArrayList<GraphDisplaySet> displaySets; + private ArrayList<ITabListener> tabListeners; + public static final String ID = "org.eclipse.linuxtools.systemtap.ui.graphing.views.GraphSelectorView"; +}
\ No newline at end of file |