~ubuntu-branches/ubuntu/wily/eclipse-linuxtools/wily

« back to all changes in this revision

Viewing changes to systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapView.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam, Jakub Adam, tony mancill
  • Date: 2014-10-11 11:44:05 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20141011114405-yazjvxfzzhmi5sgj
Tags: 3.1.0-1
[ Jakub Adam ]
* New upstream release (Closes: #761524).
* Refreshed d/patches.
* Don't build removed feature org.eclipse.linuxtools.tools.launch
  - merged into org.eclipse.linuxtools.profiling.
* Use javac target 1.7.
* Build new feature org.eclipse.linuxtools.dataviewers.feature
  - required by Valgrind integration.
* Build-depend on eclipse-remote-services-api and eclipse-cdt-autotools.
* Bump Standards-Version to 3.9.6.
* Override incompatible-java-bytecode-format - linuxtools needs Java 7.
* Remove unused codeless-jar override.

[ tony mancill ]
* Tweak short package description to make lintian happy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
    private final String NEW_LINE = Messages.getString("SystemTapView.1"); //$NON-NLS-1$
47
47
 
48
48
    public Composite masterComposite;
49
 
    private IMenuManager help;
50
49
    private Action kill;
51
50
 
52
51
    protected String viewID;
140
139
     * @return
141
140
     */
142
141
    public SystemTapParser getParser() {
143
 
        return parser;
 
142
        return parser;
144
143
    }
145
144
 
146
145
    /**
152
151
     * @return
153
152
     */
154
153
    public boolean setParser(SystemTapParser parser) {
155
 
        this.parser = parser;
156
 
        if (this.parser == null) {
157
 
                return false;
 
154
        this.parser = parser;
 
155
        if (this.parser == null) {
 
156
            return false;
158
157
        }
159
 
        return true;
 
158
        return true;
160
159
    }
161
160
 
162
161
    /**
220
219
 
221
220
    public void addHelpMenu() {
222
221
        IMenuManager menu = getViewSite().getActionBars().getMenuManager();
223
 
        help = new MenuManager(Messages.getString("SystemTapView.Help")); //$NON-NLS-1$
 
222
        IMenuManager help = new MenuManager(Messages.getString("SystemTapView.Help")); //$NON-NLS-1$
224
223
        menu.add(help);
225
224
        createHelpActions();
226
225
 
228
227
    }
229
228
 
230
229
 
231
 
    public void createHelpActions() {
 
230
    private void createHelpActions() {
232
231
        helpVersion = new Action(Messages.getString("SystemTapView.Version")) { //$NON-NLS-1$
233
232
            @Override
234
 
                        public void run() {
 
233
            public void run() {
235
234
                try {
236
 
                        Process pr = RuntimeProcessFactory.getFactory().exec("stap -V", null); //$NON-NLS-1$
 
235
                    Process pr = RuntimeProcessFactory.getFactory().exec("stap -V", null); //$NON-NLS-1$
237
236
                    BufferedReader buf = new BufferedReader(
238
237
                            new InputStreamReader(pr.getErrorStream()));
239
238
                    String line = ""; //$NON-NLS-1$
261
260
        };
262
261
    }
263
262
 
264
 
    protected void createSaveAction() {
 
263
    private void createSaveAction() {
265
264
        //Save callgraph.out
266
265
        saveFile = new Action(Messages.getString("SystemTapView.SaveMenu")){ //$NON-NLS-1$
267
266
            @Override
268
 
                        public void run(){
 
267
            public void run(){
269
268
                Shell sh = new Shell();
270
269
                FileDialog dialog = new FileDialog(sh, SWT.SAVE);
271
270
                String filePath = dialog.open();
283
282
        kill = new Action(Messages.getString("SystemTapView.StopScript"), //$NON-NLS-1$
284
283
                AbstractUIPlugin.imageDescriptorFromPlugin(CallgraphCorePlugin.PLUGIN_ID, "icons/progress_stop.gif")) { //$NON-NLS-1$
285
284
            @Override
286
 
                        public void run() {
 
285
            public void run() {
287
286
                getParser().cancelJob();
288
287
            }
289
288
        };
306
305
     * @param sourcePath
307
306
     */
308
307
    public void saveData(String targetFile) {
309
 
                try {
310
 
                        File file = new File(targetFile);
311
 
                        file.delete();
312
 
                        file.createNewFile();
313
 
 
314
 
                        File sFile = new File(sourcePath);
315
 
                        if (!sFile.exists()) {
316
 
                                return;
317
 
                        }
318
 
 
319
 
                        FileInputStream fileIn = null;
320
 
                        FileOutputStream fileOut = null;
321
 
                        FileChannel channelIn = null;
322
 
                        FileChannel channelOut = null;
323
 
                        try {
324
 
                                fileIn = new FileInputStream(sFile);
325
 
                                fileOut = new FileOutputStream(file);
326
 
                                channelIn = fileIn.getChannel();
327
 
                                channelOut = fileOut.getChannel();
328
 
 
329
 
                                if (channelIn == null || channelOut == null) {
330
 
                                        return;
331
 
                                }
332
 
 
333
 
                                long size = channelIn.size();
334
 
                                MappedByteBuffer buf = channelIn.map(
335
 
                                                FileChannel.MapMode.READ_ONLY, 0, size);
336
 
 
337
 
                                channelOut.write(buf);
338
 
 
339
 
                        } finally {
340
 
                                if (channelIn != null) {
341
 
                                        channelIn.close();
342
 
                                }
343
 
                                if (channelOut != null) {
344
 
                                        channelOut.close();
345
 
                                }
346
 
                                if (fileIn != null) {
347
 
                                        fileIn.close();
348
 
                                }
349
 
                                if (fileOut != null) {
350
 
                                        fileOut.close();
351
 
                                }
352
 
                        }
353
 
                } catch (IOException e) {
354
 
                        CallgraphCorePlugin.logException(e);
355
 
                }
356
 
        }
 
308
        try {
 
309
            File file = new File(targetFile);
 
310
            file.delete();
 
311
            file.createNewFile();
 
312
 
 
313
            File sFile = new File(sourcePath);
 
314
            if (!sFile.exists()) {
 
315
                return;
 
316
            }
 
317
 
 
318
            try  (FileInputStream fileIn = new FileInputStream(sFile); FileOutputStream fileOut = new FileOutputStream(file);
 
319
                    FileChannel channelIn = fileIn.getChannel(); FileChannel channelOut = fileOut.getChannel()){
 
320
 
 
321
                if (channelIn == null || channelOut == null) {
 
322
                    return;
 
323
                }
 
324
 
 
325
                long size = channelIn.size();
 
326
                MappedByteBuffer buf = channelIn.map(
 
327
                        FileChannel.MapMode.READ_ONLY, 0, size);
 
328
 
 
329
                channelOut.write(buf);
 
330
            }
 
331
        } catch (IOException e) {
 
332
            CallgraphCorePlugin.logException(e);
 
333
        }
 
334
    }
357
335
 
358
336
    public void setSourcePath(String file) {
359
337
        sourcePath = file;