-/*******************************************************************************\r
- * Copyright (c) 2010 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- * Patrick Tasse - Initial API and implementation\r
- *******************************************************************************/\r
-\r
-package org.eclipse.linuxtools.tmf.ui.views.filter;\r
-\r
-import org.eclipse.jface.dialogs.Dialog;\r
-import org.eclipse.linuxtools.tmf.core.filter.model.ITmfFilterTreeNode;\r
-import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterNode;\r
-import org.eclipse.linuxtools.tmf.ui.internal.Messages;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Shell;\r
-\r
-public class FilterDialog extends Dialog {\r
-\r
- TmfFilterNode fRoot;\r
- FilterViewer fViewer;\r
- \r
- public FilterDialog(Shell shell) {\r
- super(shell);\r
- setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX);\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)\r
- */\r
- @Override\r
- protected Control createDialogArea(Composite parent) {\r
- getShell().setText(Messages.FilterDialog_FilterDialogTitle);\r
- getShell().setMinimumSize(getShell().computeSize(500, 200));\r
- Composite composite = (Composite) super.createDialogArea(parent);\r
- \r
- fViewer = new FilterViewer(composite, SWT.BORDER);\r
- fViewer.setInput(fRoot);\r
- return composite;\r
- }\r
-\r
- /**\r
- * @param fFilter the filter to set\r
- */\r
- public void setFilter(ITmfFilterTreeNode filter) {\r
- fRoot = new TmfFilterNode(null);\r
- if (filter != null) {\r
- fRoot.addChild(filter.clone());\r
- }\r
- if (fViewer != null) {\r
- fViewer.setInput(fRoot);\r
- }\r
- }\r
- \r
- /**\r
- * @return the fFilter\r
- */\r
- public ITmfFilterTreeNode getFilter() {\r
- if (fRoot != null && fRoot.hasChildren()) {\r
- return fRoot.getChild(0).clone();\r
- }\r
- return null;\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2010, 2012 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:
+ * Patrick Tasse - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ui.views.filter;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.linuxtools.internal.tmf.ui.Messages;
+import org.eclipse.linuxtools.tmf.core.filter.model.ITmfFilterTreeNode;
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterNode;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * The dialog for user-defined filters.
+ *
+ * @version 1.0
+ * @author Patrick Tasse
+ */
+public class FilterDialog extends Dialog {
+
+ TmfFilterNode fRoot;
+ FilterViewer fViewer;
+
+ /**
+ * Constructor.
+ *
+ * @param shell
+ * The shell to which this dialog is attached
+ */
+ public FilterDialog(Shell shell) {
+ super(shell);
+ setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ getShell().setText(Messages.FilterDialog_FilterDialogTitle);
+ getShell().setMinimumSize(getShell().computeSize(500, 200));
+ Composite composite = (Composite) super.createDialogArea(parent);
+
+ fViewer = new FilterViewer(composite, SWT.BORDER);
+ fViewer.setInput(fRoot);
+ return composite;
+ }
+
+ /**
+ * @param filter the filter to set
+ */
+ public void setFilter(ITmfFilterTreeNode filter) {
+ fRoot = new TmfFilterNode(null);
+ if (filter != null) {
+ fRoot.addChild(filter.clone());
+ }
+ if (fViewer != null) {
+ fViewer.setInput(fRoot);
+ }
+ }
+
+ /**
+ * @return the filter
+ */
+ public ITmfFilterTreeNode getFilter() {
+ if (fRoot != null && fRoot.hasChildren()) {
+ return fRoot.getChild(0).clone();
+ }
+ return null;
+ }
+
+}