本文整理匯總了Java中org.eclipse.swt.widgets.List.addSelectionListener方法的典型用法代碼示例。如果您正苦於以下問題:Java List.addSelectionListener方法的具體用法?Java List.addSelectionListener怎麽用?Java List.addSelectionListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.List
的用法示例。
在下文中一共展示了List.addSelectionListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createCustomArea
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Creates and returns the contents of an area of the dialog which appears
* below the message and above the button bar.
*
* This implementation creates two labels and two textfields.
*
* @param parent parent composite to contain the custom area
* @return the custom area control, or <code>null</code>
*/
protected Control createCustomArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
composite.setLayout(new GridLayout());
skVarList = new List(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
skVarList.setLayoutData(new GridData(GridData.FILL_BOTH));
skVarList.setItems(items);
skVarList.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
selections = skVarList.getSelectionIndices();
}});
return composite;
}
示例2: createDialogArea
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
GridLayout layout = new GridLayout(2, false);
container.setLayout(layout);
Label lbtOcciServerUrl = new Label(container, SWT.NONE);
lbtOcciServerUrl.setText(Messages.OcciActionDialog_Label);
final List listOcciActions = new List (container, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
listOcciActions.addSelectionListener(
new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
selectedAction = listOcciActions.getSelection()[0];
}
}
);
listOcciActions.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
for(Action action : actions) {
listOcciActions.add(action.getScheme() + action.getTerm());
}
return area;
}
示例3: createBottomSelectedLocalesComposite
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Creates the bottom part of this wizard where selected locales
* are stored.
* @param parent parent container
*/
private void createBottomSelectedLocalesComposite(Composite parent) {
// Selected locales Group
Group selectedGroup = new Group(parent, SWT.NULL);
GridLayout layout = new GridLayout();
layout = new GridLayout();
layout.numColumns = 1;
selectedGroup.setLayout(layout);
GridData gd = new GridData(GridData.FILL_BOTH);
selectedGroup.setLayoutData(gd);
selectedGroup.setText(MessagesEditorPlugin.getString(
"editor.wiz.selected")); //$NON-NLS-1$
bundleLocalesList =
new List(selectedGroup, SWT.READ_ONLY | SWT.MULTI | SWT.BORDER);
gd = new GridData(GridData.FILL_BOTH);
bundleLocalesList.setLayoutData(gd);
bundleLocalesList.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
removeButton.setEnabled(
bundleLocalesList.getSelectionIndices().length != 0);
setAddButtonState();
}
});
}
示例4: createCustomArea
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Creates and returns the contents of an area of the dialog which appears
* below the message and above the button bar.
*
* This implementation creates two labels and two textfields.
*
* @param parent parent composite to contain the custom area
* @return the custom area control, or <code>null</code>
*/
protected Control createCustomArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
composite.setLayout(new GridLayout());
envVarList = new List(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
envVarList.setLayoutData(new GridData(GridData.FILL_BOTH));
envVarList.setItems(items);
envVarList.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
selections = envVarList.getSelectionIndices();
}});
return composite;
}
示例5: createTemplateControl
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Creates a list element containing available templates (system and user)
* and a text area next to it for showing description about the selected template
*
* @param composite the parent container
*/
private void createTemplateControl(Composite composite) {
// add list for templates
templateList = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
templateList.setItems(ProjectTemplateManager.loadTemplateNames());
templateList.setLayoutData(new GridData(GridData.FILL_VERTICAL));
templateList.setToolTipText(TexlipsePlugin.getResourceString("projectWizardTemplateTooltip"));
templateList.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
attributes.setTemplate(templateList.getSelection()[0]);
updateEntries();
}});
templateList.setSelection(0);
// this has to be done, because setSelection() doesn't generate an event
attributes.setTemplate(templateList.getItem(0));
// add TextField for the selected template's description
descriptionField = new Text(composite, SWT.MULTI | SWT.BORDER);
descriptionField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardTemplateDescriptionTooltip"));
descriptionField.setLayoutData(new GridData(GridData.FILL_BOTH));
descriptionField.setEditable(false);
}
示例6: createBottomSelectedLocalesComposite
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Creates the bottom part of this wizard where selected locales are stored.
*
* @param parent
* parent container
*/
private void createBottomSelectedLocalesComposite(Composite parent) {
// Selected locales Group
Group selectedGroup = new Group(parent, SWT.NULL);
GridLayout layout = new GridLayout();
layout = new GridLayout();
layout.numColumns = 1;
selectedGroup.setLayout(layout);
GridData gd = new GridData(GridData.FILL_BOTH);
selectedGroup.setLayoutData(gd);
selectedGroup.setText(Messages.editor_wiz_selected);
bundleLocalesList = new List(selectedGroup, SWT.READ_ONLY | SWT.MULTI | SWT.BORDER);
gd = new GridData(GridData.FILL_BOTH);
bundleLocalesList.setLayoutData(gd);
bundleLocalesList.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
removeButton.setEnabled(bundleLocalesList.getSelectionIndices().length != 0);
setAddButtonState();
}
});
// add a single Locale so that the bundleLocalesList isn't empty on
// startup
bundleLocalesList.add(DEFAULT_LOCALE);
}
示例7: addList
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
private void addList()
{
Composite composite = new Composite(sashform, SWT.NONE);
props.setLook(composite);
FillLayout fillLayout = new FillLayout();
fillLayout.marginWidth = Const.FORM_MARGIN;
fillLayout.marginHeight = Const.FORM_MARGIN;
composite.setLayout(fillLayout);
// Make a listbox
wList = new List(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
// Add a selection listener.
wList.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent arg0)
{
refreshGrid();
}
}
);
}
示例8: buildEmbeddedImageList
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
private void buildEmbeddedImageList( )
{
embeddedImageList = new List( inputArea, SWT.NONE
| SWT.SINGLE
| SWT.BORDER
| SWT.V_SCROLL
| SWT.H_SCROLL );
embeddedImageList.setLayoutData( new GridData( GridData.FILL_BOTH ) );
embeddedImageList.addSelectionListener( new SelectionAdapter( ) {
public void widgetSelected( SelectionEvent event )
{
preview( );
modifyDialogContent( );
updateButtons( );
}
} );
initList( );
}
示例9: addListenerToSourcePackageList
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
private void addListenerToSourcePackageList(final List sourcePackageList) {
sourcePackageList.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if(sourcePackageList.getSelectionCount()>0){
addSelectedPackagesLabel.setEnabled(true);
}else{
addSelectedPackagesLabel.setEnabled(false);
}
}
});
}
示例10: createControl
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
@Override
public void createControl(Composite parent) {
container = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
container.setLayout(layout);
createWorkspaceSelectionControls();
addLabel("Directories: ", 1, 5);
directories = DirectoryTreeContentProvider.createTreeView(container);
setControlGridData(directories.getTree(), 2, 5, true);
directories.addCheckStateListener(e -> updateControls());
new Label(container, SWT.NONE).setText("Targets:");
createTargetTextField();
setControlGridData(target, 1, 1, false);
addTargetButton = createButton("+", e -> addTarget());
targets = new List(container, SWT.SINGLE | SWT.BORDER);
setControlGridData(targets, 2, 5, true);
removeTargetButton = createButton("-", e -> deleteTarget());
targets.addSelectionListener(createSelectionListener(
e -> removeTargetButton.setEnabled(targets.getSelectionCount() > 0)));
setControl(container);
updateControls();
}
示例11: getListControl
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Add an additional SelectionListener to the list component.
* This method call super and installs a SelectionListener,
* which enables and disables the "edit"-button.
*/
public List getListControl(Composite parent) {
List list = super.getListControl(parent);
list.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
List listWidget = (List) event.widget;
editButton.setEnabled(listWidget.getSelectionIndex() >= 0);
}});
return list;
}
示例12: createDialogArea
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* This is the method that puts the content into the popup's
* dialog area. It puts an org.eclipse.swt.widgets.List
* (note that this isn't an ordinary Java List) there.
*
*/
protected Control createDialogArea(Composite composite)
{
// create the list
list = new List(composite, SWT.SINGLE | SWT.V_SCROLL | SWT.RESIZE);
// Populate the popup's display area.
setList();
// list.addKeyListener(listener);
/*
* To put a Composite instead of a List in the
* dialog area, do something like the following:
Composite stuff = new Composite(composite, SWT.NONE);
stuff.setLayoutData(new GridData());
stuff.setLayout(new FillLayout(SWT.VERTICAL));
Button button1 = new Button(stuff, SWT.FLAT);
button1.setText("Button 1");
// button1.setParent(stuff);
Button button2 = new Button(stuff, SWT.PUSH);
button2.setText("Button 2");
*/
list.addSelectionListener(new ShowDeclarationsSelectionListener(EditorUtil.getTLAEditorWithFocus()));
// Adding the KeyListener after the SelectionListener is necessary for the handling
// of keystrokes to work. If they're added in the opposite order, some keys change
// the selection and call the SelectionListener.
list.addKeyListener(new ShowDeclarationsKeyListener(this)); // Testing
// System.out.println("testing showAll = " + showAll);
// It is necessary to select an item on the list if one is to be
// able to listen for keystrokes. Otherwise, a keystroke causes the
// current selection to change, calling the SelectionListener's widgetSelected()
// method.
list.setSelection(0);
return list;
}
示例13: createControl
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
@Override
public Control createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new GridLayout());
Label l = new Label(container, SWT.NONE);
l.setText(Messages.DatePattern_template_formats);
list = new List(container, SWT.BORDER);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.verticalSpan = 3;
gd.heightHint = 200;
gd.widthHint = 100;
list.setLayoutData(gd);
SimpleDateFormat f = (SimpleDateFormat) getFormatter();
for (String s : getDefaults()) {
f.applyPattern(s);
list.add(f.format(getSample()));
}
list.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
formatChanged();
}
});
return container;
}
示例14: createDialogArea
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea (Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
container.setLayout(gridLayout);
final Label filterLabel = new Label(container, SWT.NONE);
filterLabel.setLayoutData(new GridData(GridData.BEGINNING,
GridData.BEGINNING, false, false, 2, 1));
filterLabel.setText("Select the column that you want to delete:");
final Label nameLabel = new Label(container, SWT.NONE);
nameLabel.setLayoutData(new GridData(GridData.END,
GridData.CENTER, false, false));
nameLabel.setText("Column:");
final List columnList = new List(container, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
columnList.setBounds(40, 20, 220, 100);
columnList.setItems(columnTitle);
columnList.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected (SelectionEvent e) {
selectedColumn.clear();
selectedColumn.addAll(Arrays.asList(columnList.getSelection()));
}});
return container;
}
示例15: createNetworkList
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Create the Network List
*
*/
private void createNetworkList() {
Label listTxt = new Label(getWindowShell(), SWT.LEFT);
listTxt.setText("Select address to create QRCode:");
listTxt.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false));
List list = new List(getWindowShell(), SWT.SINGLE);
list.addSelectionListener(this);
list.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
// Add IPs to list
for(String ip : getIPs()) {
list.add(ip);
}
}