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

« back to all changes in this revision

Viewing changes to valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/charting/ChartPNG.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:
1
 
/***********************************************************************
2
 
 * Copyright (c) 2004, 2005 Actuate Corporation.
3
 
 * All rights reserved. This program and the accompanying materials
4
 
 * are made available under the terms of the Eclipse Public License v1.0
5
 
 * which accompanies this distribution, and is available at
6
 
 * http://www.eclipse.org/legal/epl-v10.html
7
 
 *
8
 
 * Contributors:
9
 
 * Actuate Corporation - initial API and implementation
10
 
 * Elliott Baron <ebaron@redhat.com> - Modified implementation
11
 
 ***********************************************************************/
12
 
package org.eclipse.linuxtools.internal.valgrind.massif.charting;
13
 
 
14
 
import org.eclipse.core.runtime.IPath;
15
 
import org.eclipse.linuxtools.valgrind.ui.ValgrindUIConstants;
16
 
import org.eclipse.swt.SWT;
17
 
import org.eclipse.swt.graphics.GC;
18
 
import org.eclipse.swt.graphics.Image;
19
 
import org.eclipse.swt.graphics.ImageData;
20
 
import org.eclipse.swt.graphics.ImageLoader;
21
 
import org.eclipse.swt.widgets.Composite;
22
 
import org.eclipse.swt.widgets.Display;
23
 
import org.eclipse.ui.IWorkbenchPage;
24
 
import org.eclipse.ui.PartInitException;
25
 
import org.eclipse.ui.PlatformUI;
26
 
 
27
 
public class ChartPNG {
28
 
 
29
 
        protected HeapChart cm = null;
30
 
        
31
 
        public ChartPNG(HeapChart chart) {
32
 
                cm = chart;
33
 
        }
34
 
 
35
 
        public void renderPNG(IPath pngPath) {
36
 
                Composite comp = cm.getChartControl();
37
 
                Display dsp = Display.getCurrent();
38
 
                GC gc = new GC(comp);
39
 
                Image img = new Image(dsp, comp.getSize().x + 1, comp.getSize().y + 1);
40
 
                gc.copyArea(img, 0, 0);
41
 
                gc.dispose();
42
 
                ImageLoader imageLoader = new ImageLoader();
43
 
                imageLoader.data = new ImageData[] {img.getImageData()};
44
 
                imageLoader.save(pngPath.toOSString(), SWT.IMAGE_PNG);
45
 
        }
46
 
 
47
 
        public HeapChart getDesignTimeModel() {
48
 
                return cm;
49
 
        }
50
 
 
51
 
        public Object peerInstance() {
52
 
                return this;
53
 
        }
54
 
 
55
 
        public void regenerateChart() {
56
 
        }
57
 
 
58
 
        public void repaintChart() {
59
 
        }
60
 
        
61
 
        /**
62
 
         * Shows the Valgrind view in the active page and gives it focus.
63
 
         */
64
 
        public void showView() {
65
 
                Display.getDefault().syncExec(new Runnable() {
66
 
                        public void run() {
67
 
                                try {
68
 
                                        IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
69
 
                                        activePage.showView(ValgrindUIConstants.VIEW_ID);
70
 
                                } catch (PartInitException e) {
71
 
                                        e.printStackTrace();
72
 
                                }
73
 
                        }                       
74
 
                });
75
 
        }
76
 
        
77
 
}