Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 165236639cd41841dc46085389cf2e136beafef3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*******************************************************************************
 * Copyright (c) 2011, 2013 Wind River Systems, Inc. and others. 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:
 * Wind River Systems - initial API and implementation
 *******************************************************************************/
package org.eclipse.tcf.te.tcf.processes.ui.search;

import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.tcf.te.ui.interfaces.ISearchMatcher;
import org.eclipse.tcf.te.ui.utils.AbstractSearchable;

/**
 * The base searchable that provides common methods for its subclasses.
 *
 * @see ProcessStateSearchable
 * @see ProcessUserSearchable
 */
public abstract class ProcessBaseSearchable extends AbstractSearchable implements ISearchMatcher {

	/**
	 * Create a group with the specified title.
	 *
	 * @param parent The parent where the group is to be created.
	 * @return The group composite.
	 */
	protected Composite createGroup(Composite parent) {
		Assert.isNotNull(parent);

		Group group = new Group(parent, SWT.NONE);
		group.setText(getGroupTitle());
		group.setLayout(new GridLayout());
		group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		group.setBackground(parent.getBackground());

		return group;
	}

	/**
	 * Returns the group title.
	 *
	 * @return The group title.
	 */
	protected abstract String getGroupTitle();

	/* (non-Javadoc)
	 * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getMatcher()
	 */
	@Override
	public ISearchMatcher getMatcher() {
		return this;
	}
}

Back to the top