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

« back to all changes in this revision

Viewing changes to proctools/org.eclipse.linuxtools.sequoyah.device/src/org/eclipse/linuxtools/sequoyah/device/tools/cpuload/DialogOptions.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) 2009 Motorola Inc. All rights reserved.
3
 
 * This program and the accompanying materials are made available under the terms
4
 
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
5
 
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 
 *
7
 
 * Initial Contributor:
8
 
 * Otavio Ferranti (Motorola)
9
 
 *
10
 
 * Contributors:
11
 
 * {Name} (company) - description of contribution.
12
 
 ********************************************************************************/
13
 
 
14
 
package org.eclipse.linuxtools.sequoyah.device.tools.cpuload;
15
 
 
16
 
import org.eclipse.jface.dialogs.TitleAreaDialog;
17
 
import org.eclipse.linuxtools.sequoyah.device.tools.ITool;
18
 
import org.eclipse.swt.SWT;
19
 
import org.eclipse.swt.graphics.Point;
20
 
import org.eclipse.swt.layout.GridData;
21
 
import org.eclipse.swt.layout.GridLayout;
22
 
import org.eclipse.swt.widgets.Composite;
23
 
import org.eclipse.swt.widgets.Control;
24
 
import org.eclipse.swt.widgets.Label;
25
 
import org.eclipse.swt.widgets.Shell;
26
 
import org.eclipse.swt.widgets.Spinner;
27
 
 
28
 
/**
29
 
 * @author Otavio Ferranti
30
 
 */
31
 
public class DialogOptions extends TitleAreaDialog {
32
 
 
33
 
        final private String WINDOW_TITLE = Messages.OptionsDialog_Window_Title;
34
 
        final private String WINDOW_MESSAGE = Messages.OptionsDialog_Window_Message; 
35
 
        final private String LABEL_REFRESH = Messages.OptionsDialog_Label_Refresh_Rate;
36
 
        final private String LABEL_TIMEUNIT = "ms"; //$NON-NLS-1$
37
 
 
38
 
        private Spinner spinner;
39
 
        
40
 
        private ITool tool = null;
41
 
        
42
 
        /**
43
 
         * The constructor.
44
 
         * @param parent
45
 
         */
46
 
        public DialogOptions(Shell parent, ITool tool) {
47
 
                super(parent);
48
 
                this.tool = tool;
49
 
        }
50
 
        
51
 
        /* (non-Javadoc)
52
 
         * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
53
 
         */
54
 
        protected Control createDialogArea(Composite parent) {
55
 
                setTitle(WINDOW_TITLE);
56
 
                setMessage(WINDOW_MESSAGE);
57
 
                
58
 
                Composite dialogArea = new Composite(parent, SWT.NONE);
59
 
                GridLayout gridLayout = new GridLayout(3, false);
60
 
                
61
 
                gridLayout.marginLeft = 7;
62
 
                gridLayout.marginRight = 7;
63
 
                
64
 
                dialogArea.setLayout(gridLayout);
65
 
                dialogArea.setLayoutData(new GridData(GridData.FILL_BOTH));
66
 
                dialogArea.setFont(parent.getFont());
67
 
        
68
 
                Label refreshLabel = new Label(dialogArea, SWT.NULL);
69
 
                refreshLabel.setText(LABEL_REFRESH);
70
 
                
71
 
                spinner = new Spinner(dialogArea, SWT.BORDER);
72
 
                
73
 
                Label timeUnit = new Label(dialogArea, SWT.NULL);
74
 
                timeUnit.setText(LABEL_TIMEUNIT);
75
 
                                
76
 
                spinner.setMinimum(0);
77
 
                spinner.setMaximum(50000);
78
 
                spinner.setSelection(tool.getRefreshDelay());
79
 
                spinner.setIncrement(100);
80
 
                spinner.setPageIncrement(500);
81
 
                spinner.pack();
82
 
                
83
 
                return dialogArea;
84
 
        }
85
 
        
86
 
        
87
 
        /* (non-Javadoc)
88
 
         * @see org.eclipse.jface.dialogs.TitleAreaDialog#getInitialSize()
89
 
         */
90
 
        protected Point getInitialSize() {
91
 
                return super.getInitialSize();
92
 
        }
93
 
        
94
 
        /* (non-Javadoc)
95
 
         * @see org.eclipse.jface.dialogs.Dialog#okPressed()
96
 
         */
97
 
        protected void okPressed() {
98
 
                tool.setRefreshDelay(spinner.getSelection());
99
 
                super.okPressed();
100
 
        }
101
 
        
102
 
        /* (non-Javadoc)
103
 
         * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
104
 
         */
105
 
        protected void cancelPressed() {
106
 
                super.cancelPressed();
107
 
        }
108
 
}