當前位置: 首頁>>代碼示例>>Java>>正文


Java Combo.addSelectionListener方法代碼示例

本文整理匯總了Java中org.eclipse.swt.widgets.Combo.addSelectionListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Combo.addSelectionListener方法的具體用法?Java Combo.addSelectionListener怎麽用?Java Combo.addSelectionListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.swt.widgets.Combo的用法示例。


在下文中一共展示了Combo.addSelectionListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createDialogArea

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parentShell) {
  Composite parent = (Composite) super.createDialogArea(parentShell);
  Composite c = new Composite(parent, SWT.NONE);

  c.setLayout(new GridLayout(2, false));

  Label l = new Label(c, SWT.NONE);
  l.setText("Select device: ");

  final Combo combo = new Combo(c, SWT.BORDER | SWT.READ_ONLY);
  combo.setItems(mDeviceNames);
  int defaultSelection =
      sSelectedDeviceIndex < mDevices.size() ? sSelectedDeviceIndex : 0;
  combo.select(defaultSelection);
  sSelectedDeviceIndex = defaultSelection;

  combo.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent arg0) {
      sSelectedDeviceIndex = combo.getSelectionIndex();
    }
  });

  return parent;
}
 
開發者ID:DroidTesting,項目名稱:android-uiautomatorviewer,代碼行數:27,代碼來源:ScreenshotAction.java

示例2: createAssertionCombo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private Combo createAssertionCombo ()
{
    final Combo c = new Combo ( this, SWT.NONE );
    for ( final Assertion assertion : Assertion.values () )
    {
        c.add ( assertion.toString () );
    }
    c.select ( 0 );
    c.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        }
    } );
    final RowData rowData = new RowData ();
    rowData.width = 75;
    c.setLayoutData ( rowData );
    return c;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:21,代碼來源:FilterAdvancedComposite.java

示例3: createControl

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
public void createControl(Composite parent) {
	container = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	container.setLayout(layout);
	layout.numColumns = 2;

	Label labelExampleSelection = new Label(container, SWT.NONE);
	labelExampleSelection.setText("Select example to be created:");
	combo = new Combo(container, SWT.READ_ONLY);
	if (availableExamples != null) {
		for (String exampleName : availableExamples.keySet()) {
			combo.add(exampleName);
		}
	}

	combo.addSelectionListener(this);

	setControl(container);
	setPageComplete(false);
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:22,代碼來源:ExampleSelectionWizardPage.java

示例4: ComboBox

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public ComboBox(Composite composite, String message, String [] options,
        String[] commentTemplates) {
    
    fMessage= message;
    fComments= options;
    fCommentTemplates = commentTemplates;
    
    fCombo = new Combo(composite, SWT.READ_ONLY);
    fCombo.setLayoutData(SWTUtils.createHFillGridData());
    fCombo.setVisibleItemCount(20);
    
    // populate the previous comment list
    populateList();
    
    // We don't want to have an initial selection
    // (see bug 32078: http://bugs.eclipse.org/bugs/show_bug.cgi?id=32078)
    fCombo.addFocusListener(this);
    fCombo.addSelectionListener(this);
}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:20,代碼來源:CommitCommentArea.java

示例5: AccountSelector

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public AccountSelector(Composite parent, IGoogleLoginService loginService) {
  super(parent, SWT.NONE);
  this.loginService = loginService;
  loginMessage = Messages.getString("ACCOUNT_SELECTOR_LOGIN");

  combo = new Combo(this, SWT.READ_ONLY);

  List<Account> sortedAccounts = new ArrayList<>(loginService.getAccounts());
  Collections.sort(sortedAccounts, new Comparator<Account>() {
    @Override
    public int compare(Account o1, Account o2) {
      return o1.getEmail().compareTo(o2.getEmail());
    }
  });
  for (Account account : sortedAccounts) {
    combo.add(account.getEmail());
    combo.setData(account.getEmail(), account);
  }
  combo.add(loginMessage);
  combo.addSelectionListener(logInOnSelect);

  GridDataFactory.fillDefaults().grab(true, false).applyTo(combo);
  GridLayoutFactory.fillDefaults().generateLayout(this);
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:25,代碼來源:AccountSelector.java

示例6: initHttpCombo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void initHttpCombo( Composite top){
   httpCombo = new Combo(top, SWT.READ_ONLY);
   httpCombo.setItems(CoreConstants.HTTP11_METHODS);
   httpCombo.setText(model.getHttpMethod());
   httpCombo.addSelectionListener(new SelectionAdapter() {

      private String prevMethod = model.getHttpMethod();


      public void widgetSelected( SelectionEvent e){
         // becomes GET, HEAD, PUT, etc
         if (CoreConstants.HTTP_POST.equals(prevMethod) && !CoreConstants.HTTP_POST.equals(httpCombo.getText())) {
            state.setState(ItemState.POST_DISABLED);
            // becomes POST
         } else if (!CoreConstants.HTTP_POST.equals(prevMethod) && CoreConstants.HTTP_POST.equals(httpCombo.getText())) {
            state.setState(ItemState.POST_ENABLED);
            // no update
         } else {
            state.setState(ItemState.POST_NO_UPDATE);
         }
         prevMethod = httpCombo.getText();
         model.fireExecute(new ModelEvent(ModelEvent.HTTP_METHOD_CHANGE, model));
      }
   });
}
 
開發者ID:nextinterfaces,項目名稱:http4e,代碼行數:26,代碼來源:ItemView.java

示例7: addComboBox

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
protected Combo addComboBox(Composite parent, String label, String key, String[] values, String[] valueLabels,
		int indent) {

	GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
	gd.horizontalIndent = indent;

	Label labelControl = new Label(parent, SWT.LEFT | SWT.WRAP);
	labelControl.setText(label);
	labelControl.setLayoutData(gd);

	Combo comboBox = new Combo(parent, SWT.READ_ONLY);
	SwtUtil.setDefaultVisibleItemCount(comboBox);
	comboBox.setItems(valueLabels);
	gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
	gd.horizontalSpan = 2;
	comboBox.setLayoutData(gd);
	comboBox.addSelectionListener(fComboFieldListener);
	fComboFields.put(comboBox, key);
	return comboBox;
}
 
開發者ID:grosenberg,項目名稱:fluentmark,代碼行數:21,代碼來源:AbstractConfigurationBlock.java

示例8: createLanguageLayout

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/***
 * Create the Field where user enters the language used to execute
 * 
 * @param parent container composite
 * @param font used font
 * @return the created composite containing the fields
 */
public Composite createLanguageLayout(Composite parent, Font font) {
	// Language
	createTextLabelLayout(parent, "Melange languages");
	_languageCombo = new Combo(parent, SWT.NONE);
	_languageCombo.setLayoutData(createStandardLayout());

	List<String> languagesNames = MelangeHelper.getAllLanguages();
	String[] empty = {};
	_languageCombo.setItems(languagesNames.toArray(empty));
	_languageCombo.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			//String selection = _languageCombo.getText();
			//List<String> modelTypeNames = MelangeHelper.getModelTypes(selection);
			updateLaunchConfigurationDialog();
		}
	});
	createTextLabelLayout(parent, "");

	createTextLabelLayout(parent, "Melange resource adapter query");
	_melangeQueryText = new Text(parent, SWT.SINGLE | SWT.BORDER);
	_melangeQueryText.setLayoutData(createStandardLayout());
	_melangeQueryText.setFont(font);
	_melangeQueryText.setEditable(false);
	createTextLabelLayout(parent, "");
	
	return parent;
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:36,代碼來源:LaunchConfigurationMainTab.java

示例9: createControl

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public void createControl(Composite parent) {
	Composite container = new Composite(parent, SWT.NULL);
	GridLayout layout = new GridLayout();
	container.setLayout(layout);
	layout.numColumns = 2;
	layout.verticalSpacing = 9;

	Label label = new Label(container, SWT.NULL);
	label.setText("&Emulator technology:");

	emulatorTechnologyCombo = new Combo(container, SWT.NONE);
	String[] tags = EmulatorTechnologyEditor.getTags(null);
	for (int i = 0 ; i < tags.length ; i ++) {
		emulatorTechnologyCombo.add(tags[i]);
	}
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	emulatorTechnologyCombo.setLayoutData(gd);
	emulatorTechnologyCombo.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			dialogChanged();
		}
	});
	
	initialize();
	//dialogChanged();
	setControl(container);
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:28,代碼來源:EmulatorTechnologyWizardPage.java

示例10: createControl

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public void createControl(Composite parent) {
	super.createControl(parent);
	Composite composite = (Composite) getControl();
	Group group = new Group(composite, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.numColumns = 2;
	group.setLayout(layout);
	group.setText("設置");
	group.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));

	Label label = new Label(group, SWT.NULL);
	label.setText("數據庫方言:");
	final Combo combo = new Combo(group, SWT.READ_ONLY);
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	combo.setLayoutData(gd);
	DbType[] values = DbType.values();
	for (DbType type : values) {
		combo.add(type.name());
	}
	combo.select(0);
	currentDbType = combo.getText();
	setFileName("NewFile" + DEFAULT_EXTENSION);
	combo.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			currentDbType = combo.getText();
		}
	});
	setPageComplete(validatePage());
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:30,代碼來源:DbToolCreationWizardPage.java

示例11: createDecisionCombo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
 * Creates a new combo box, initilizes the enty values, and configures
 * it with a listener capable of updating the right entry in our
 * map of item->decision.
 */
private Combo createDecisionCombo(Composite parent, Task item) {
  Combo combo = new Combo(parent, SWT.READ_ONLY);
  combo.add(YES);
  combo.add(NO);
  combo.add(NEVER);
  combo.select(0);

  combo.addSelectionListener(new ComboListener(item));
  return combo;
}
 
開發者ID:alfsch,項目名稱:workspacemechanic,代碼行數:16,代碼來源:MechanicDialog.java

示例12: Swt_combo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public Swt_combo(Swt_control owner, Keyval_hash ctorArgs) {
	combo = new Combo(owner.Under_composite(), SWT.DROP_DOWN);
	core = new Swt_core_cmds(combo);
	combo.addKeyListener(new Swt_lnr_key(this));
	combo.addMouseListener(new Swt_lnr_mouse(this));
	combo.addSelectionListener(new Swt_combo__selection_listener(this));
}
 
開發者ID:gnosygnu,項目名稱:xowa_android,代碼行數:8,代碼來源:Swt_combo.java

示例13: populateTreeOptionsCombo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void populateTreeOptionsCombo(final Combo combo, final String initialValue) {
    int selectedItemIndex = 0;
    final ArrayList list = new ArrayList();
    mapTreeDisplayNameToReferenceName = new HashMap();

    final WorkItemLinkTypeCollection linkTypes = query.getWorkItemClient().getLinkTypes();
    final WorkItemLinkTypeEndCollection endTypes = linkTypes.getLinkTypeEnds();

    for (final Iterator it = endTypes.iterator(); it.hasNext();) {
        final WorkItemLinkTypeEnd end = (WorkItemLinkTypeEnd) it.next();
        if (end.getLinkType().getLinkTopology() == Topology.TREE && end.isForwardLink()) {
            final String referenceName = end.getImmutableName();
            final String display =
                MessageFormat.format(Messages.getString("QueryEditorControl.HierarchyLinkTypeFormat"), new Object[] //$NON-NLS-1$
            {
                end.getOppositeEnd().getName(),
                end.getName()
            });

            if (referenceName.equalsIgnoreCase(initialValue)) {
                selectedItemIndex = list.size();
            }

            list.add(display);
            mapTreeDisplayNameToReferenceName.put(display, referenceName);
        }
    }

    combo.setItems((String[]) list.toArray(new String[list.size()]));
    if (combo.getItemCount() > 0) {
        combo.select(selectedItemIndex);
    }

    combo.addSelectionListener(new ComboTreeOptionsSelectionHandler());
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:36,代碼來源:QueryEditorControl.java

示例14: hookAddToDialogArea

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
protected void hookAddToDialogArea(final Composite dialogArea) {
    final GridLayout gridLayout = new GridLayout(1, false);
    dialogArea.setLayout(gridLayout);

    final Label teamProjectLabel = new Label(dialogArea, SWT.NONE);
    teamProjectLabel.setText(Messages.getString("CopyWorkItemsDialog.TeamProjectLabelText")); //$NON-NLS-1$

    projectCombo = new Combo(dialogArea, SWT.DROP_DOWN | SWT.READ_ONLY);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    projectCombo.setLayoutData(gd);

    populateProjects();
    projectCombo.addSelectionListener(new ProjectChangedListener());

    final Label workItemTypeLabel = new Label(dialogArea, SWT.NONE);
    workItemTypeLabel.setText(Messages.getString("CopyWorkItemsDialog.TypeLabelText")); //$NON-NLS-1$

    workItemTypeCombo = new Combo(dialogArea, SWT.DROP_DOWN | SWT.READ_ONLY);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    workItemTypeCombo.setLayoutData(gd);

    populateWorkItemTypes();
    workItemTypeCombo.addSelectionListener(new WorkItemTypeChangedListener());
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:30,代碼來源:CopyWorkItemsDialog.java

示例15: createTypeCombo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private Combo createTypeCombo(final NormalColumn targetColumn) {
    final GridData gridData = new GridData();
    gridData.widthHint = 100;

    final Combo typeCombo = new Combo(attributeTable, SWT.READ_ONLY);
    initializeTypeCombo(typeCombo);
    typeCombo.setLayoutData(gridData);

    typeCombo.addSelectionListener(new SelectionAdapter() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void widgetSelected(final SelectionEvent event) {
            validate();
        }

    });

    final SqlType sqlType = targetColumn.getType();

    final String database = diagram.getDatabase();

    if (sqlType != null && sqlType.getAlias(database) != null) {
        typeCombo.setText(sqlType.getAlias(database));
    }

    return typeCombo;
}
 
開發者ID:roundrop,項目名稱:ermasterr,代碼行數:31,代碼來源:EditAllAttributesDialog.java


注:本文中的org.eclipse.swt.widgets.Combo.addSelectionListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。