1 /**********************************************************************
2 * Copyright (c) 2015 Ericsson
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 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.dialogs
;
14 import org
.eclipse
.jface
.dialogs
.Dialog
;
15 import org
.eclipse
.jface
.dialogs
.IDialogConstants
;
16 import org
.eclipse
.swt
.SWT
;
17 import org
.eclipse
.swt
.layout
.GridData
;
18 import org
.eclipse
.swt
.layout
.GridLayout
;
19 import org
.eclipse
.swt
.widgets
.Button
;
20 import org
.eclipse
.swt
.widgets
.Composite
;
21 import org
.eclipse
.swt
.widgets
.Control
;
22 import org
.eclipse
.swt
.widgets
.Shell
;
23 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.Activator
;
24 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.messages
.Messages
;
27 * Dialog box for collecting parameter for loading a session.
29 * @author Bernd Hufmann
31 public class SaveDialog
extends Dialog
implements ISaveDialog
{
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
35 /** The icon file for this dialog box. */
36 public static final String EXPORT_ICON_FILE
= "icons/elcl16/export_button.png"; //$NON-NLS-1$
38 // ------------------------------------------------------------------------
40 // ------------------------------------------------------------------------
42 * The dialog composite.
44 private Composite fDialogComposite
= null;
46 private Button fForceButton
= null;
48 private boolean fIsForce
= true;
50 // ------------------------------------------------------------------------
52 // ------------------------------------------------------------------------
57 * - a shell for the display of the dialog
59 public SaveDialog(Shell shell
) {
61 setShellStyle(SWT
.RESIZE
| getShellStyle());
65 public boolean isForce() {
69 // ------------------------------------------------------------------------
71 // ------------------------------------------------------------------------
73 protected void configureShell(Shell newShell
) {
74 super.configureShell(newShell
);
75 newShell
.setText(Messages
.TraceControl_SaveDialogTitle
);
76 newShell
.setImage(Activator
.getDefault().loadIcon(EXPORT_ICON_FILE
));
80 protected Control
createDialogArea(Composite parent
) {
82 fDialogComposite
= new Composite(parent
, SWT
.NONE
);
83 GridLayout layout
= new GridLayout(1, true);
84 fDialogComposite
.setLayout(layout
);
85 fDialogComposite
.setLayoutData(new GridData(GridData
.FILL_BOTH
));
86 createOptionComposite();
87 return fDialogComposite
;
90 private void createOptionComposite() {
91 Composite group
= new Composite(fDialogComposite
, SWT
.BORDER
);
92 group
.setLayout(new GridLayout(1, true));
93 group
.setLayoutData(new GridData(GridData
.FILL_HORIZONTAL
));
95 fForceButton
= new Button(group
, SWT
.CHECK
);
96 fForceButton
.setSelection(true);
97 fForceButton
.setText(Messages
.TraceControl_ForceButtonText
);
101 protected void createButtonsForButtonBar(final Composite parent
) {
102 createButton(parent
, IDialogConstants
.CANCEL_ID
, IDialogConstants
.CANCEL_LABEL
, true);
103 createButton(parent
, IDialogConstants
.OK_ID
, IDialogConstants
.OK_LABEL
, true);
107 protected void okPressed() {
108 fIsForce
= fForceButton
.getSelection();