/**********************************************************************
- * Copyright (c) 2012 Ericsson
- *
+ * Copyright (c) 2012, 2013 Ericsson
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs;
* <p>
* Dialog box for collecting session creation information.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class ImportConfirmationDialog extends Dialog implements IImportConfirmationDialog {
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
- /**
- * The dialog composite.
- */
- private Composite fDialogComposite = null;
/**
* The radio button for selecting the overwrite action
*/
*/
private Text fNewTraceNameText = null;
/**
- * The trace name which already exists in the project
+ * The trace name which already exists in the project
*/
private String fTraceName = null;
/**
*/
public ImportConfirmationDialog(Shell shell) {
super(shell);
- setShellStyle(SWT.RESIZE);
+ setShellStyle(SWT.RESIZE | getShellStyle());
}
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IImportConfirmationDialog#setTraceName(java.lang.String)
- */
+
@Override
public void setTraceName(String name) {
fTraceName = name;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IImportConfirmationDialog#getNewTraceName()
- */
@Override
public String getNewTraceName() {
return fNewTraceName;
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IImportConfirmationDialog#isOverwrite()
- */
+
@Override
public boolean isOverwrite() {
return fIsOverride;
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
- */
+
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setImage(Activator.getDefault().loadIcon(IMPORT_ICON_FILE));
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
@Override
protected Control createDialogArea(Composite parent) {
-
+
// Main dialog panel
- fDialogComposite = new Composite(parent, SWT.NONE);
+ Composite dialogComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, true);
- fDialogComposite.setLayout(layout);
- fDialogComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ dialogComposite.setLayout(layout);
+ dialogComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- Label sessionNameLabel = new Label(fDialogComposite, SWT.RIGHT);
+ Label sessionNameLabel = new Label(dialogComposite, SWT.RIGHT);
sessionNameLabel.setText(Messages.TraceControl_ImportDialogTraceAlreadyExistError + ": " + fTraceName); //$NON-NLS-1$
- fOverwriteButton = new Button(fDialogComposite, SWT.RADIO);
+ fOverwriteButton = new Button(dialogComposite, SWT.RADIO);
fOverwriteButton.setText(Messages.TraceControl_ImportDialogConfirmationOverwriteLabel);
-
+
fOverwriteButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
fNewTraceNameText.setText(fTraceName);
}
});
-
- fRenameButton = new Button(fDialogComposite, SWT.RADIO);
+
+ fRenameButton = new Button(dialogComposite, SWT.RADIO);
fRenameButton.setText(Messages.TraceControl_ImportDialogConfirmationRenameLabel);
-
+
fRenameButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
fNewTraceNameText.setEnabled(true);
}
});
-
- fNewTraceNameText = new Text(fDialogComposite, SWT.NONE);
+
+ fNewTraceNameText = new Text(dialogComposite, SWT.NONE);
fNewTraceNameText.setToolTipText(Messages.TraceControl_ImportDialogConfirmationNewNameLabel);
fNewTraceNameText.setText(fTraceName);
// Default
fOverwriteButton.setSelection(true);
fNewTraceNameText.setEnabled(false);
-
+
// layout widgets
GridData data = new GridData(GridData.FILL_HORIZONTAL);
-
+
fNewTraceNameText.setLayoutData(data);
getShell().setMinimumSize(new Point(300, 150));
-
- return fDialogComposite;
+
+ return dialogComposite;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
- */
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.CANCEL_ID, "&Cancel", true); //$NON-NLS-1$
createButton(parent, IDialogConstants.OK_ID, "&Ok", true); //$NON-NLS-1$
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
@Override
protected void okPressed() {