/**********************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
- * Copyright (c) 2011, 2012 Ericsson.
- *
+ * Copyright (c) 2005, 2013 IBM Corporation, 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:
- * IBM - Initial API and implementation
- * Bernd Hufmann - Updated for TMF
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ * Bernd Hufmann - Updated for TMF
**********************************************************************/
+
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.dialogs;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDWidget;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SDMessages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Text;
/**
- * Dialog box for entering minimum and maximum time range for time compression bar.
- *
+ * Dialog box for entering minimum and maximum time range for time compression bar.
+ *
* @version 1.0
* @author sveyrier
* @author Bernd Hufmann
- *
+ *
*/
public class MinMaxDialog extends Dialog {
// Attributes
// ------------------------------------------------------------------------
/**
- * Label for minimum.
+ * Label for minimum.
*/
- protected Label minLabel;
+ protected Label fMinLabel;
/**
* Label for maximum.
*/
- protected Label maxLabel;
+ protected Label fMaxLabel;
/**
* Label for scale
*/
- protected Label scaleLabel;
+ protected Label fScaleLabel;
/**
* Label for precision.
*/
- protected Label precisionLabel;
+ protected Label fPrecisionLabel;
/**
- * Text field for minimum.
+ * Text field for minimum.
*/
- protected Text minText;
+ protected Text fMinText;
/**
- * Text field for maximum.
+ * Text field for maximum.
*/
- protected Text maxText;
+ protected Text fMaxText;
/**
- * Text field for scale.
+ * Text field for scale.
*/
- protected Text scaleText;
+ protected Text fScaleText;
/**
- * Text field for precision.
+ * Text field for precision.
*/
- protected Text precisionText;
+ protected Text fPrecisionText;
/**
* The sequence diagram widget reference.
*/
- protected SDWidget sdWidget;
+ protected SDWidget fSdWidget;
// ------------------------------------------------------------------------
// Constructor
/**
* Standard constructor.
* @param shell The shell
- * @param viewer The sequence diagram widget reference.
+ * @param viewer The sequence diagram widget reference.
*/
public MinMaxDialog(Shell shell, SDWidget viewer) {
super(shell);
- sdWidget = viewer;
+ fSdWidget = viewer;
}
// ------------------------------------------------------------------------
g1layout.numColumns = 3;
g1.setLayout(g1layout);
- minLabel = new Label(g1, SWT.RADIO);
- minLabel.setText(SDMessages._124);
- minLabel.setLayoutData(newGridData(1));
+ fMinLabel = new Label(g1, SWT.RADIO);
+ fMinLabel.setText(SDMessages._124);
+ fMinLabel.setLayoutData(newGridData(1));
+
+ fMinText = new Text(g1, SWT.SINGLE | SWT.BORDER);
+ fMinText.setLayoutData(newGridData(2));
+ fMinText.setText(String.valueOf(fSdWidget.getFrame().getMinTime().getValue()));
- minText = new Text(g1, SWT.SINGLE | SWT.BORDER);
- minText.setLayoutData(newGridData(2));
- minText.setText(String.valueOf(sdWidget.getFrame().getMinTime().getValue()));
+ fMaxLabel = new Label(g1, SWT.RADIO);
+ fMaxLabel.setText(SDMessages._125);
+ fMaxLabel.setLayoutData(newGridData(1));
- maxLabel = new Label(g1, SWT.RADIO);
- maxLabel.setText(SDMessages._125);
- maxLabel.setLayoutData(newGridData(1));
+ fMaxText = new Text(g1, SWT.SINGLE | SWT.BORDER);
+ fMaxText.setLayoutData(newGridData(2));
+ fMaxText.setText(String.valueOf(fSdWidget.getFrame().getMaxTime().getValue()));
- maxText = new Text(g1, SWT.SINGLE | SWT.BORDER);
- maxText.setLayoutData(newGridData(2));
- maxText.setText(String.valueOf(sdWidget.getFrame().getMaxTime().getValue()));
+ fScaleLabel = new Label(g1, SWT.RADIO);
+ fScaleLabel.setText(SDMessages._136);
+ fScaleLabel.setLayoutData(newGridData(1));
- scaleLabel = new Label(g1, SWT.RADIO);
- scaleLabel.setText(SDMessages._136);
- scaleLabel.setLayoutData(newGridData(1));
+ fScaleText = new Text(g1, SWT.SINGLE | SWT.BORDER);
+ fScaleText.setLayoutData(newGridData(2));
+ fScaleText.setText(String.valueOf(fSdWidget.getFrame().getMinTime().getScale()));
- scaleText = new Text(g1, SWT.SINGLE | SWT.BORDER);
- scaleText.setLayoutData(newGridData(2));
- scaleText.setText(String.valueOf(sdWidget.getFrame().getMinTime().getScale()));
-
- precisionLabel = new Label(g1, SWT.RADIO);
- precisionLabel.setText(SDMessages._137);
- precisionLabel.setLayoutData(newGridData(1));
+ fPrecisionLabel = new Label(g1, SWT.RADIO);
+ fPrecisionLabel.setText(SDMessages._137);
+ fPrecisionLabel.setLayoutData(newGridData(1));
- precisionText = new Text(g1, SWT.SINGLE | SWT.BORDER);
- precisionText.setLayoutData(newGridData(2));
- precisionText.setText(String.valueOf(sdWidget.getFrame().getMinTime().getPrecision()));
+ fPrecisionText = new Text(g1, SWT.SINGLE | SWT.BORDER);
+ fPrecisionText.setLayoutData(newGridData(2));
+ fPrecisionText.setText(String.valueOf(fSdWidget.getFrame().getMinTime().getPrecision()));
return parent;
}
int scale = 0;
int precision = 0;
try {
- min = Long.parseLong(minText.getText());
- max = Long.parseLong(maxText.getText());
- scale = Integer.parseInt(scaleText.getText());
- precision = Integer.parseInt(precisionText.getText());
+ min = Long.parseLong(fMinText.getText());
+ max = Long.parseLong(fMaxText.getText());
+ scale = Integer.parseInt(fScaleText.getText());
+ precision = Integer.parseInt(fPrecisionText.getText());
- sdWidget.getFrame().setMax(new TmfTimestamp(max, scale, precision));
- sdWidget.getFrame().setMin(new TmfTimestamp(min, scale, precision));
+ fSdWidget.getFrame().setMax(new TmfTimestamp(max, scale, precision));
+ fSdWidget.getFrame().setMin(new TmfTimestamp(min, scale, precision));
- sdWidget.redraw();
+ fSdWidget.redraw();
super.okPressed();
} catch (Exception e) {
*/
@Override
public void widgetSelected(SelectionEvent e) {
- sdWidget.getFrame().resetCustomMinMax();
- minText.setText(String.valueOf(sdWidget.getFrame().getMinTime().getValue()));
- maxText.setText(String.valueOf(sdWidget.getFrame().getMaxTime().getValue()));
- scaleText.setText(String.valueOf(sdWidget.getFrame().getMinTime().getScale()));
- precisionText.setText(String.valueOf(sdWidget.getFrame().getMinTime().getPrecision()));
- maxText.getParent().layout(true);
+ fSdWidget.getFrame().resetCustomMinMax();
+ fMinText.setText(String.valueOf(fSdWidget.getFrame().getMinTime().getValue()));
+ fMaxText.setText(String.valueOf(fSdWidget.getFrame().getMaxTime().getValue()));
+ fScaleText.setText(String.valueOf(fSdWidget.getFrame().getMinTime().getScale()));
+ fPrecisionText.setText(String.valueOf(fSdWidget.getFrame().getMinTime().getPrecision()));
+ fMaxText.getParent().layout(true);
}
/*