
org.eclipse.jface.action.Separator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jface Show documentation
Show all versions of jface Show documentation
JFace is a UI toolkit with classes for handling many common UI programming tasks. JFace is window-system-independent in both its API and implementation, and is designed to work with SWT without hiding it. JFace includes the usual UI toolkit components of image and font registries, text, dialog, preference and wizard frameworks, and progress reporting for long running operations. Two of its more interesting features are actions and viewers. The action mechanism allows user commands to be defined independently from their exact whereabouts in the UI. Viewers are model based adapters for certain SWT widgets, simplifying the presentation of application data structured as lists, tables or trees.
The newest version!
/*******************************************************************************
* Copyright (c) 2000, 2006 IBM Corporation 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jface.action;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
/**
* A separator is a special kind of contribution item which acts
* as a visual separator and, optionally, acts as a group marker.
* Unlike group markers, separators do have a visual representation for
* menus and toolbars.
*
* This class may be instantiated; it is not intended to be
* subclassed outside the framework.
*
*/
public class Separator extends AbstractGroupMarker {
/**
* Creates a separator which does not start a new group.
*/
public Separator() {
super();
}
/**
* Creates a new separator which also defines a new group having the given group name.
* The group name must not be null
or the empty string.
* The group name is also used as the item id.
*
* @param groupName the group name of the separator
*/
public Separator(String groupName) {
super(groupName);
}
/* (non-Javadoc)
* Method declared on IContributionItem.
* Fills the given menu with a SWT separator MenuItem.
*/
public void fill(Menu menu, int index) {
if (index >= 0) {
new MenuItem(menu, SWT.SEPARATOR, index);
} else {
new MenuItem(menu, SWT.SEPARATOR);
}
}
/* (non-Javadoc)
* Method declared on IContributionItem.
* Fills the given tool bar with a SWT separator ToolItem.
*/
public void fill(ToolBar toolbar, int index) {
if (index >= 0) {
new ToolItem(toolbar, SWT.SEPARATOR, index);
} else {
new ToolItem(toolbar, SWT.SEPARATOR);
}
}
/**
* The Separator
implementation of this IContributionItem
* method returns true
*/
public boolean isSeparator() {
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy