1 /*******************************************************************************
2 * Copyright (c) 2010 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 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.ui
.views
.filter
;
15 import org
.eclipse
.jface
.dialogs
.Dialog
;
16 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.Messages
;
17 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.ITmfFilterTreeNode
;
18 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterNode
;
19 import org
.eclipse
.swt
.SWT
;
20 import org
.eclipse
.swt
.widgets
.Composite
;
21 import org
.eclipse
.swt
.widgets
.Control
;
22 import org
.eclipse
.swt
.widgets
.Shell
;
24 public class FilterDialog
extends Dialog
{
29 public FilterDialog(Shell shell
) {
31 setShellStyle(getShellStyle() | SWT
.RESIZE
| SWT
.MAX
);
35 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
38 protected Control
createDialogArea(Composite parent
) {
39 getShell().setText(Messages
.FilterDialog_FilterDialogTitle
);
40 getShell().setMinimumSize(getShell().computeSize(500, 200));
41 Composite composite
= (Composite
) super.createDialogArea(parent
);
43 fViewer
= new FilterViewer(composite
, SWT
.BORDER
);
44 fViewer
.setInput(fRoot
);
49 * @param filter the filter to set
51 public void setFilter(ITmfFilterTreeNode filter
) {
52 fRoot
= new TmfFilterNode(null);
54 fRoot
.addChild(filter
.clone());
56 if (fViewer
!= null) {
57 fViewer
.setInput(fRoot
);
64 public ITmfFilterTreeNode
getFilter() {
65 if (fRoot
!= null && fRoot
.hasChildren()) {
66 return fRoot
.getChild(0).clone();