Java Code Examples for org.eclipse.swt.widgets.Tree#setFont()

The following examples show how to use org.eclipse.swt.widgets.Tree#setFont() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PackageFilterEditor.java    From eclipse-cs with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
  Composite composite = (Composite) super.createDialogArea(parent);
  Label messageLabel = createMessageArea(composite);
  CheckboxTreeViewer treeViewer = createTreeViewer(composite);

  GridData data = new GridData(GridData.FILL_BOTH);
  data.widthHint = convertWidthInCharsToPixels(mWidth);
  data.heightHint = convertHeightInCharsToPixels(mHeight);
  Tree treeWidget = treeViewer.getTree();
  treeWidget.setLayoutData(data);
  treeWidget.setFont(parent.getFont());
  if (mIsEmpty) {
    messageLabel.setEnabled(false);
    treeWidget.setEnabled(false);
  }
  return composite;
}
 
Example 2
Source File: TraceTypePreferencePageViewer.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create the filter area
 *
 * @param parent
 *            The parent composite
 * @return The filter area composite
 */
public Composite createFilterArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(1, true));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    CheckboxTreeViewer treeViewer = createTreeViewer(composite);
    Control buttonComposite = createSelectionButtons(composite);
    GridData data = new GridData(GridData.FILL_BOTH);
    Tree treeWidget = treeViewer.getTree();
    treeWidget.setLayoutData(data);
    treeWidget.setFont(parent.getFont());
    if (fIsEmpty) {
        treeWidget.setEnabled(false);
        buttonComposite.setEnabled(false);
    }
    return composite;
}
 
Example 3
Source File: TimeGraphFilterDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    Label messageLabel = createMessageArea(composite);
    CheckboxTreeViewer treeViewer = createTreeViewer(composite);
    Control buttonComposite = createSelectionButtons(composite);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = convertWidthInCharsToPixels(fWidth);
    data.heightHint = convertHeightInCharsToPixels(fHeight);
    Tree treeWidget = treeViewer.getTree();
    treeWidget.setLayoutData(data);
    treeWidget.setFont(parent.getFont());
    if (fIsEmpty) {
        messageLabel.setEnabled(false);
        treeWidget.setEnabled(false);
        buttonComposite.setEnabled(false);
    }
    return composite;
}
 
Example 4
Source File: ElementTreeSelectionDialog.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    Label messageLabel = createMessageArea(composite);
    TreeViewer treeViewer = createTreeViewer(composite);

    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = convertWidthInCharsToPixels(fWidth);
    data.heightHint = convertHeightInCharsToPixels(fHeight);

    Tree treeWidget = treeViewer.getTree();
    treeWidget.setLayoutData(data);
    treeWidget.setFont(parent.getFont());

    if (fIsEmpty) {
        messageLabel.setEnabled(false);
        treeWidget.setEnabled(false);
    }

    return composite;
}
 
Example 5
Source File: ElementTreeSelectionDialog.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    Label messageLabel = createMessageArea(composite);
    TreeViewer treeViewer = createTreeViewer(composite);

    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = convertWidthInCharsToPixels(fWidth);
    data.heightHint = convertHeightInCharsToPixels(fHeight);

    Tree treeWidget = treeViewer.getTree();
    treeWidget.setLayoutData(data);
    treeWidget.setFont(parent.getFont());

    if (fIsEmpty) {
        messageLabel.setEnabled(false);
        treeWidget.setEnabled(false);
    }

    return composite;
}
 
Example 6
Source File: AppEngineConfigWizardPage.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void createControl(Composite parent) {

    Font font = parent.getFont();

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    composite.setFont(font);

    // App Engine specification group
    Composite appEngineGroup = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    appEngineGroup.setLayout(layout);
    appEngineGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    appEngineGroup.setFont(font);

    createUserSpecifiedGoogleAppEngineLocationGroup(appEngineGroup);

    tree = new Tree(composite, SWT.SINGLE | SWT.BORDER);
    tree.setLayoutData(new GridData(GridData.FILL_BOTH));
    tree.setFont(font);

    setControl(composite);
}
 
Example 7
Source File: CheckedTreeEditor.java    From cppcheclipse with Apache License 2.0 5 votes vote down vote up
/**
 * Returns this field editor's list control.
 * 
 * @param parent
 *            the parent control
 * @return the list control
 */
public Tree createListControl(Composite parent) {
	Tree table = (Tree) getTreeControl();
	if (table == null) {
		listParent = parent;
		treeViewer = new ContainerCheckedTreeViewer(parent, SWT.BORDER | SWT.MULTI
				| SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION);
		table = treeViewer.getTree();
		table.setFont(parent.getFont());
		treeViewer.addCheckStateListener(this);
	} else {
		checkParent(table, parent);
	}
	return table;
}
 
Example 8
Source File: CTreeCombo.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
void createPopup(Collection<CTreeComboItem> items, CTreeComboItem selectedItem) {
	// create shell and list
	popup = new Shell(getShell(), SWT.NO_TRIM | SWT.ON_TOP);
	final int style = getStyle();
	int listStyle = SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE;
	if ((style & SWT.FLAT) != 0) {
		listStyle |= SWT.FLAT;
	}
	if ((style & SWT.RIGHT_TO_LEFT) != 0) {
		listStyle |= SWT.RIGHT_TO_LEFT;
	}
	if ((style & SWT.LEFT_TO_RIGHT) != 0) {
		listStyle |= SWT.LEFT_TO_RIGHT;
	}
	tree = new Tree(popup, listStyle);
	tree.addTreeListener(hookListener);
	if (font != null) {
		tree.setFont(font);
	}
	if (foreground != null) {
		tree.setForeground(foreground);
	}
	if (background != null) {
		tree.setBackground(background);
	}

	final int[] popupEvents = { SWT.Close, SWT.Paint, SWT.Deactivate };
	for (int i = 0; i < popupEvents.length; i++) {
		popup.addListener(popupEvents[i], listener);
	}
	final int[] listEvents = { SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose, SWT.Collapse, SWT.Expand };
	for (int i = 0; i < listEvents.length; i++) {
		tree.addListener(listEvents[i], listener);
	}

	for (final CTreeComboColumn c : columns) {
		final TreeColumn col = new TreeColumn(tree, SWT.NONE);
		c.setRealTreeColumn(col);
	}

	if (items != null) {
		createTreeItems(items.toArray(new CTreeComboItem[0]));
	}

	if (selectedItem != null) {
		tree.setSelection(selectedItem.getRealTreeItem());
	}
}
 
Example 9
Source File: TreeListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
protected TreeViewer createTreeViewer(Composite parent) {
	Tree tree= new Tree(parent, getTreeStyle());
	tree.setFont(parent.getFont());
	return new TreeViewer(tree);
}
 
Example 10
Source File: TreeListDialogField.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected TreeViewer createTreeViewer(Composite parent) {
	Tree tree= new Tree(parent, getTreeStyle());
	tree.setFont(parent.getFont());
	return new TreeViewer(tree);
}