~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/internal/systemtap/ui/graphing/actions/ImportDataSetAction.java

  • Committer: Package Import Robot
  • Author(s): tony mancill
  • Date: 2013-05-13 21:43:22 UTC
  • mfrom: (1.2.1) (2.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130513214322-6frgd9du1n0w2uo7
Tags: 1.2.1-1
* Team upload.
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
 */
47
47
public class ImportDataSetAction extends Action implements IWorkbenchWindowActionDelegate {
48
48
        public void init(IWorkbenchWindow window) {
49
 
                LogManager.logDebug("Start ImportDataSetAction.init", this);
50
 
                LogManager.logDebug("Initializing", this);
 
49
                LogManager.logDebug("Start ImportDataSetAction.init", this); //$NON-NLS-1$
 
50
                LogManager.logDebug("Initializing", this); //$NON-NLS-1$
51
51
                fWindow = window;
52
 
                LogManager.logDebug("End ImportDataSetAction.init", this);
 
52
                LogManager.logDebug("End ImportDataSetAction.init", this); //$NON-NLS-1$
53
53
        }
54
54
 
55
55
        /**
59
59
         * @param act The action that fired this method.
60
60
         */
61
61
        public void run(IAction act) {
62
 
                LogManager.logDebug("Start ImportDataSetAction.run", this);
 
62
                LogManager.logDebug("Start ImportDataSetAction.run", this); //$NON-NLS-1$
63
63
                //Get the file
64
64
                FileDialog dialog= new FileDialog(fWindow.getShell(), SWT.OPEN);
65
65
                dialog.setText(Localization.getString("ImportDataSetAction.OpenDataSetFile"));
89
89
                        IViewPart ivp = p.findView(GraphSelectorView.ID);
90
90
                        ((GraphSelectorView)ivp).createScriptSet(fileName, dataSet);
91
91
                } catch(WorkbenchException we) {
92
 
                        LogManager.logCritical("WorkbenchException ImportDataSetAction.run:" + we.getMessage(), this);
 
92
                        LogManager.logCritical("WorkbenchException ImportDataSetAction.run:" + we.getMessage(), this); //$NON-NLS-1$
93
93
                }
94
 
                LogManager.logDebug("End ImportDataSetAction.run", this);
 
94
                LogManager.logDebug("End ImportDataSetAction.run", this); //$NON-NLS-1$
95
95
        }
96
96
 
97
97
        public void selectionChanged(IAction a, ISelection s) {}
102
102
         * @return The newly created DataSet containing the data from the file.
103
103
         */
104
104
        private IDataSet readFile(File f) {
105
 
                LogManager.logDebug("Start ImportDataSetAction.readFile", this);
 
105
                LogManager.logDebug("Start ImportDataSetAction.readFile", this); //$NON-NLS-1$
106
106
                IDataSet data;
107
107
 
108
108
                readHeader(f);
112
112
                data = DataSetFactory.createFilteredDataSet(id, labels);
113
113
                data.readFromFile(f);
114
114
                
115
 
                LogManager.logDebug("End ImportDataSetAction.readFile", this);
 
115
                LogManager.logDebug("End ImportDataSetAction.readFile", this); //$NON-NLS-1$
116
116
                return data;
117
117
        }
118
118
        
122
122
         * @return An array of all of the labels found in the file
123
123
         */
124
124
        private void readHeader(File f) {
125
 
                LogManager.logDebug("Start ImportDataSetAction.readLabels", this);
 
125
                LogManager.logDebug("Start ImportDataSetAction.readLabels", this); //$NON-NLS-1$
126
126
 
127
127
                try {
128
128
                        FileReader fr = new FileReader(f);
134
134
                        br.close();
135
135
                        labels = line.split(", ");
136
136
                } catch(FileNotFoundException fnfe) {
137
 
                        LogManager.logCritical("FileNotFoundException ImportDataSetAction.readLabels:" + fnfe.getMessage(), this);
 
137
                        LogManager.logCritical("FileNotFoundException ImportDataSetAction.readLabels:" + fnfe.getMessage(), this); //$NON-NLS-1$
138
138
                } catch(IOException ioe) {
139
 
                        LogManager.logCritical("IOException ImportDataSetAction.readLabels:" + ioe.getMessage(), this);
 
139
                        LogManager.logCritical("IOException ImportDataSetAction.readLabels:" + ioe.getMessage(), this); //$NON-NLS-1$
140
140
                }
141
141
 
142
 
                LogManager.logDebug("End ImportDataSetAction.readLabels", this);
 
142
                LogManager.logDebug("End ImportDataSetAction.readLabels", this); //$NON-NLS-1$
143
143
        }
144
144
        
145
145
        private void displayError(String message) {
146
 
                LogManager.logInfo("Initializing", MessageDialog.class);
 
146
                LogManager.logInfo("Initializing", MessageDialog.class); //$NON-NLS-1$
147
147
                MessageDialog.openWarning(fWindow.getShell(), Localization.getString("ImportDataSetAction.Problem"), message);
148
 
                LogManager.logInfo("Disposing", MessageDialog.class);
 
148
                LogManager.logInfo("Disposing", MessageDialog.class); //$NON-NLS-1$
149
149
        }
150
150
        
151
151
        public void dispose() {
152
 
                LogManager.logDebug("Start ImportDataSetAction.dispose", this);
153
 
                LogManager.logInfo("Disposing", this);
 
152
                LogManager.logDebug("Start ImportDataSetAction.dispose", this); //$NON-NLS-1$
 
153
                LogManager.logInfo("Disposing", this); //$NON-NLS-1$
154
154
                fWindow = null;
155
 
                LogManager.logDebug("End ImportDataSetAction.dispose", this);
 
155
                LogManager.logDebug("End ImportDataSetAction.dispose", this); //$NON-NLS-1$
156
156
        }
157
157
        
158
158
        private IWorkbenchWindow fWindow;