1 /*******************************************************************************
2 * Copyright (c) 2015 École Polytechnique de Montréal
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Patrick-Jeffrey Pollo Guilbert - Initial API and implementation
11 *******************************************************************************/
12 package org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.handlers
;
14 import org
.eclipse
.jface
.viewers
.ArrayContentProvider
;
15 import org
.eclipse
.jface
.viewers
.CheckboxTreeViewer
;
16 import org
.eclipse
.jface
.viewers
.TreeViewer
;
17 import org
.eclipse
.swt
.widgets
.Label
;
18 import org
.eclipse
.ui
.dialogs
.FilteredTree
;
19 import org
.eclipse
.ui
.dialogs
.PatternFilter
;
20 import org
.eclipse
.jface
.wizard
.WizardPage
;
21 import org
.eclipse
.swt
.SWT
;
22 //import org.eclipse.swt.custom.CTabFolder;
23 //import org.eclipse.swt.custom.CTabItem;
24 import org
.eclipse
.swt
.graphics
.Color
;
25 import org
.eclipse
.swt
.layout
.GridData
;
26 import org
.eclipse
.swt
.layout
.GridLayout
;
27 import org
.eclipse
.swt
.widgets
.Button
;
28 import org
.eclipse
.swt
.widgets
.Composite
;
29 import org
.eclipse
.swt
.widgets
.Group
;
30 //import org.eclipse.swt.widgets.Display;
31 import org
.eclipse
.swt
.widgets
.Shell
;
32 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.dialogs
.INewConnectionDialog
;
33 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.dialogs
.NewConnectionDialog
;
36 public class NewConnectionWizard
{
38 static final int LABEL_WIDTH_CHARS
= 4;
39 private NewConnectionDialog fNewConnectionDialog
;
41 static final int CONNECTIONTREE_HEIGHT_CHARS
= 10;
42 static final int CONNECTIONTREE_WIDTH_CHARS
= 40;
44 TreeViewer fConnectionTree
= null;
45 private CheckboxTreeViewer treeViewer
;
49 // TODO: refactor name of class and all classes associated with it
50 public NewConnectionWizard()
53 Shell shell
= new Shell();
55 shell
.setLayout(new GridLayout());
56 Composite composite
= new Composite(shell
, SWT
.BORDER
);
57 Composite compositeDescription
= new Composite(shell
, SWT
.BORDER
);
58 composite
.setBackground(new Color(null, 255,255,255));
59 compositeDescription
.setBackground(new Color(null, 255,255,255));
61 GridData gridData
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false);
62 gridData
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false);
63 gridData
.horizontalSpan
= 2;
72 Group groupProfile
= new Group(composite
, SWT
.SHADOW_ETCHED_IN
);
73 groupProfile
.setText("Profiles List");
76 composite
.setLayoutData(gridData
);
77 composite
.setLayout(new GridLayout(1, false));
78 groupProfile
.setLayoutData(gridData
);
79 groupProfile
.setLayout(new GridLayout());
80 groupProfile
.setBackground(new Color(null, 255,255,255));
85 new FilteredTree(groupProfile
, SWT
.MULTI
| SWT
.H_SCROLL
| SWT
.V_SCROLL
| SWT
.BORDER
, new PatternFilter(), true){
87 protected TreeViewer
doCreateTreeViewer(Composite aparent
, int style
) {
88 treeViewer
= new CheckboxTreeViewer(aparent
, SWT
.MULTI
| SWT
.H_SCROLL
| SWT
.V_SCROLL
);
89 //TODO: change string to one recorded in Messages class
90 treeViewer
.getTree().setToolTipText("Select one or multiple profiles from the list below."); //$NON-NLS-1$
91 ArrayContentProvider test
= new ArrayContentProvider();
93 treeViewer
.setContentProvider(test
);
95 test
.inputChanged(treeViewer
, null, new String
[]{"allo", "bye"}); //$NON-NLS-1$ //$NON-NLS-2$
97 treeViewer
.getTree().setLayoutData(new GridData(GridData
.FILL_BOTH
));
105 // TODO: modify the checkbox addition to be based on availble profiles
106 Button b
= new Button(groupProfile
, SWT
.CHECK
);
107 b
.setText("CPU Usage");
108 b
.setBackground(new Color(null, 255,255,255));
110 Button b2
= new Button(groupProfile
, SWT
.CHECK
);
111 b2
.setText("Memory usage");
112 b2
.setBackground(new Color(null, 255,255,255));
114 Button b3
= new Button(groupProfile
, SWT
.CHECK
);
115 b3
.setText("Disk Activity");
116 b3
.setBackground(new Color(null, 255,255,255));
119 Group groupDescription
= new Group(composite
, SWT
.SHADOW_ETCHED_IN
);
120 groupDescription
.setText("Description");
122 groupDescription
.setLayoutData(gridData
);
123 groupDescription
.setLayout(new GridLayout());
124 groupDescription
.setBackground(new Color(null, 255,255,255));
127 groupDescription
.pack();
129 Label descriptionLabel
= new Label(groupDescription
, 0);
130 descriptionLabel
.setText("No description available.");
131 descriptionLabel
.setBackground(new Color(null, 255,255,255));
140 WizardPage wp
= new ConnectionPage("Wizard");
142 protected void okPressed()
147 WizardPage testPage
= new WizardPage("Kappa")
151 public void createControl(Composite parent
) {
152 // TODO Auto-generated method stub
153 Composite canvas
= new Composite(parent
, SWT
.NONE
);
154 canvas
.setLayout(new GridLayout());
155 this.setTitle("Session creation");
158 Button b
= new Button(canvas
, SWT
.RADIO
);
165 public INewConnectionDialog
getfNewConnectionDialog() {
166 return fNewConnectionDialog
;
169 public void setNewConnectionDialog(INewConnectionDialog fNewConnectionDialog
) {
170 this.fNewConnectionDialog
= (NewConnectionDialog
) fNewConnectionDialog
;
173 public CheckboxTreeViewer
getTreeViewer() {
177 public void setTreeViewer(CheckboxTreeViewer treeViewer
) {
178 this.treeViewer
= treeViewer
;