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


Java Combo.setData方法代碼示例

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


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

示例1: 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

示例2: reloadChannelCombo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void reloadChannelCombo(Combo combo, List<Integer> channels, int selected, String valueKey){
	if(!(combo.getData() instanceof List) || isDifferentList(channels, (List<Integer>)combo.getData())){
		combo.removeAll();
		combo.setData(channels);
		for( int i = 0 ; i < channels.size() ; i ++ ){
			combo.add(TuxGuitar.getProperty(valueKey, new String[]{channels.get(i).toString()}));
		}
	}
	for( int i = 0 ; i < channels.size() ; i ++ ){
		Integer channel = (Integer)channels.get(i);
		if( channel.intValue() == selected ){
			combo.select( i );
		}
	}
}
 
開發者ID:theokyr,項目名稱:TuxGuitar-1.3.1-fork,代碼行數:17,代碼來源:GMChannelSettingsDialog.java

示例3: loadChannels

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
protected void loadChannels(int selectedChannelId){
	List<Integer> tgChannelsData = new ArrayList<Integer>();
	List<TGChannel> tgChannelsAvailable = findSongManager().getChannels(findSong());
	
	Combo tgChannelsCombo = this.instrumentCombo;
	tgChannelsCombo.removeAll();
	tgChannelsCombo.add(TuxGuitar.getProperty("track.instrument.default-select-option"));
	tgChannelsCombo.select(0);
	tgChannelsData.add(new Integer(-1));
	
	for( int i = 0 ; i < tgChannelsAvailable.size() ; i ++) {
		TGChannel tgChannel = (TGChannel)tgChannelsAvailable.get(i);
		tgChannelsData.add(new Integer(tgChannel.getChannelId()));
		tgChannelsCombo.add(tgChannel.getName());
		
		if( tgChannel.getChannelId() == selectedChannelId ){
			tgChannelsCombo.select(tgChannelsCombo.getItemCount() - 1);
		}
		
	}
	tgChannelsCombo.setData(tgChannelsData);
}
 
開發者ID:theokyr,項目名稱:TuxGuitar-1.3.1-fork,代碼行數:23,代碼來源:TGTrackPropertiesDialog.java

示例4: reloadChannelCombo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void reloadChannelCombo(Combo combo, List<Integer> channels, int selected, String valueKey){
	if(!(combo.getData() instanceof List) || isDifferentList(channels, (List<Integer>) combo.getData())){
		combo.removeAll();
		combo.setData(channels);
		for( int i = 0 ; i < channels.size() ; i ++ ){
			combo.add(TuxGuitar.getProperty(valueKey, new String[]{channels.get(i).toString()}));
		}
	}
	for( int i = 0 ; i < channels.size() ; i ++ ){
		Integer channel = (Integer)channels.get(i);
		if( channel.intValue() == selected ){
			combo.select( i );
		}
	}
}
 
開發者ID:theokyr,項目名稱:TuxGuitar-1.3.1-fork,代碼行數:17,代碼來源:JackChannelSettingsDialog.java

示例5: createTestContainerSelectionGroup

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void createTestContainerSelectionGroup (Composite parent) {
	Label fTestLabel = new Label(parent, SWT.NONE);
	GridData gd = new GridData( );
	gd.horizontalAlignment = SWT.RIGHT;
	gd.horizontalIndent = 25;
	gd.verticalAlignment=SWT.TOP;
	fTestLabel.setLayoutData(gd);
	fTestLabel.setText(MessageUtil.getString("mainTestExecutionContext"));
	 
	fMainTestExecutionComboViewer = new ComboViewer(parent,SWT.DROP_DOWN);
	Combo combo = fMainTestExecutionComboViewer.getCombo();
	combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	fMainTestExecutionComboViewer.setContentProvider(new   IStructuredContentProvider(){
		@Override
		public Object[] getElements(Object inputElement) {
			String projectName= (String) inputElement;
			loadMainExecutionContextTests(projectName);
			return mainExecutionContexts;
		}
	});
	ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_QUALIFIED);
	fMainTestExecutionComboViewer.setLabelProvider(labelProvider);
	fMainTestExecutionComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
        	 	fAdditionalTestViewer.setInput(null);
                IStructuredSelection selection = (IStructuredSelection) event.getSelection();
                if (selection.size() > 0){
                	  resetDoHint();
                      IType type =  (IType) selection.getFirstElement();
                      fAdditionalTestViewer.setInput(type);
                      validatePage();
                }
        }
	});
	combo.setData(GW4E_LAUNCH_CONFIGURATION_CONTROL_ID,GW4E_LAUNCH_TEST_CONFIGURATION_MAIN_TEST);
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:38,代碼來源:GW4ELaunchConfigurationTab.java

示例6: loadComboJarListFromBuildPath

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@SuppressWarnings("restriction")
private void loadComboJarListFromBuildPath(Combo comboJarList, String newJarName) {
	comboJarList.removeAll();
	IProject iProject = BuildExpressionEditorDataSturcture.INSTANCE.getCurrentProject();
	IJavaProject iJavaProject=null;
	try {
		iJavaProject = JavaCore.create(iProject);
		PackageFragmentRoot srcfragmentRoot= BuildExpressionEditorDataSturcture.INSTANCE.getSrcPackageFragment(iJavaProject);
		comboJarList.add(hydrograph.ui.common.util.Constants.ProjectSupport_SRC);
		comboJarList.setData(String.valueOf(comboJarList.getItemCount() - 1), srcfragmentRoot);
		
		for (IPackageFragmentRoot iPackageFragmentRoot : iJavaProject.getAllPackageFragmentRoots()) {
			if (isJarPresentInLibFolder(iPackageFragmentRoot.getPath())
					&& iPackageFragmentRoot.getKind() != IPackageFragmentRoot.K_SOURCE) {
				comboJarList.add(iPackageFragmentRoot.getElementName());
				comboJarList.setData(String.valueOf(comboJarList.getItemCount() - 1), iPackageFragmentRoot);
			}
		}
		selectAndLoadJarData(newJarName);
	} catch (JavaModelException javaModelException) {
		LOGGER.error("Error occurred while loading engines-transform jar", javaModelException);
	}
	finally{
		if(iJavaProject!=null){
			try {
				iJavaProject.close();
			} catch (JavaModelException e) {
				LOGGER.warn("JavaModelException occurred while closing java-project"+e);
			}
		}
	}

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:34,代碼來源:CategoriesDialogSourceComposite.java

示例7: createComboWithLabel

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private static Combo createComboWithLabel(Composite parent, String label, int comboStyle, String propertyName) {		
	Label l = new Label(parent, SWT.LEFT);
	l.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
	l.setText(label);
	
	Combo combo = new Combo(parent, comboStyle);
	combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	if (propertyName!=null && !propertyName.isEmpty())
		combo.setData("propertyName", propertyName);		
	
	return combo;
}
 
開發者ID:Transkribus,項目名稱:TranskribusSwtGui,代碼行數:13,代碼來源:TextStyleTypeWidget.java

示例8: addLocaleBox

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

	String currValue = getPreferenceStore().getString(key);
	Locale locale = SpellCheckEngine.convertToLocale(currValue);
	locale = SpellCheckEngine.findClosestLocale(locale);
	if (locale != null) currValue = locale.toString();
	combo.select(data.getSelection(currValue));
	return combo;
}
 
開發者ID:grosenberg,項目名稱:fluentmark,代碼行數:14,代碼來源:MkSpellingConfigurationBlock.java


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