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


Java ComboViewer.setSelection方法代碼示例

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


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

示例1: createRuntimeField

import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
@Override
protected void createRuntimeField(Composite composite) {
  Label runtimeLabel = new Label(composite, SWT.LEAD);
  runtimeLabel.setText(Messages.getString("app.engine.standard.project.runtimetype")); //$NON-NLS-1$
  runtimeField = new ComboViewer(composite, SWT.READ_ONLY);
  runtimeField.setLabelProvider(new LabelProvider() {
    @Override
    public String getText(Object element) {
      return ((AppEngineRuntime) element).getLabel();
    }
  });
  runtimeField.setContentProvider(ArrayContentProvider.getInstance());
  runtimeField.setInput(AppEngineRuntime.STANDARD_RUNTIMES);
  runtimeField.setSelection(new StructuredSelection(DEFAULT_RUNTIME), true);
  runtimeField.addPostSelectionChangedListener(new ISelectionChangedListener() {
    @Override
    public void selectionChanged(SelectionChangedEvent event) {
      revalidate();
    }
  });
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:22,代碼來源:AppEngineStandardWizardPage.java

示例2: setConfigComboViewer

import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
/**
 * @param subtypeCMB_Main_viewer2
 * @param string
 */
private void setConfigComboViewer(ComboViewer viewer, String inputString) {
	Object input = viewer.getInput();
	if (input instanceof BTSConfigItem) {
		for (BTSConfig i : ((BTSConfig) input).getChildren()) {
			if (i instanceof BTSConfigItem
					&& inputString
							.equals(((BTSConfigItem) i).getValue())) {
				viewer.setSelection(new StructuredSelection(i));
				return;
			}
		}
		BTSConfigItem cci = BtsmodelFactory.eINSTANCE
				.createBTSConfigItem();
		cci.setLabel(BtsmodelFactory.eINSTANCE.createBTSTranslations());

		cci.getLabel().setTranslation(inputString, "en");
		cci.setValue(inputString);
		((BTSConfig) input).getChildren().add(cci);
		viewer.setSelection(new StructuredSelection( cci));
		return;
	}
	
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:28,代碼來源:TextAnnotationSettingsEditor.java

示例3: setClass

import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
void setClass(final IType type,
        final Button classButton,
        final ComboViewer methodComboViewer) {
    try {
        classButton.setText(type.getFullyQualifiedName());
        final List<IMethod> methods = new ArrayList<>(Arrays.asList(type.getMethods()));
        for (final Iterator<IMethod> iter = methods.iterator(); iter.hasNext();) {
            if (!valid(iter.next())) {
                iter.remove();
            }
        }
        methodComboViewer.setInput(methods.toArray());
        if (!methods.isEmpty()) {
            methodComboViewer.setSelection(new StructuredSelection(methods.get(0)));
        }
        this.type = type;
        getButton(IDialogConstants.OK_ID).setEnabled(true);
    } catch (final JavaModelException e) {
        Activator.error(e);
    }
}
 
開發者ID:fabric8io,項目名稱:data-mapper,代碼行數:22,代碼來源:AddCustomFunctionDialog.java

示例4: bindUniverseDefinition

import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
private void bindUniverseDefinition(ComboViewer universeDefinitionCombo) {
	universeDefinitionCombo.setContentProvider(new ArrayContentProvider());
	universeDefinitionCombo.setLabelProvider(new ProjectUniverseLabelProvider());
	universeDefinitionCombo.setComparator(new ViewerComparator());
	Set<ProjectUniverse> projectUniverses = getProjectUniverses();
	universeDefinitionCombo.setInput(projectUniverses);

	IObservableValue selectedUniverseDefinition = ViewerProperties.singleSelection().observe(universeDefinitionCombo);
	IObservableValue universeDefinition = BeansObservables.observeValue(editVersionModel, EditVersionModel.PN_PROJECT_UNIVERSE);
	dbc.bindValue(selectedUniverseDefinition, universeDefinition);

	ProjectUniverse projectUniverse = findUniverse(projectUniverses, getUniverseId());
	if (projectUniverse == null) {
		projectUniverse = findUniverse(projectUniverses, UniverseDefinitions.ALL_WORKSPACE_PROJECTS_UNIVERSE_ID);
	}
	/* We simply use the first element in the list as the initial selection. */
	if (0 < universeDefinitionCombo.getCombo().getItemCount()) {
		universeDefinitionCombo.setSelection(new StructuredSelection(projectUniverse));
	}
}
 
開發者ID:inventage,項目名稱:version-tiger,代碼行數:21,代碼來源:EditVersionPage.java

示例5: createComponentViewer

import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
private void createComponentViewer(Composite composite) {
	UI.formLabel(composite, toolkit, M.Component);
	componentViewer = new ComboViewer(composite);
	UI.gridData(componentViewer.getControl(), false, false).widthHint = 250;
	componentViewer.setContentProvider(ArrayContentProvider
			.getInstance());
	componentViewer.setLabelProvider(new ComponentLabel());
	componentViewer.setInput(ReportComponent.values());
	componentViewer.addSelectionChangedListener((evt) -> {
		ReportComponent c = Viewers.getFirst(evt.getSelection());
		if (c == null || c == ReportComponent.NONE)
			model.componentId = null;
			else
				model.componentId = c.getId();
			editor.setDirty(true);
		});
	if (model.componentId != null)
		componentViewer.setSelection(new StructuredSelection(
				ReportComponent.getForId(model.componentId)));
}
 
開發者ID:GreenDelta,項目名稱:olca-app,代碼行數:21,代碼來源:SectionList.java

示例6: updateComboSelection

import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
private void updateComboSelection(String value, ComboViewer comboViewer)
{
  if (comboViewer != null)
  {
    LabelValuePair[] pairs = (LabelValuePair[]) comboViewer.getInput();

    if (pairs != null)
    {
      for (LabelValuePair pair : pairs)
      {
        if (pair.getValue().equals(value))
        {
          comboViewer.setSelection(new StructuredSelection(pair));
        }
      }
    }
  }
}
 
開發者ID:terraframe,項目名稱:geoprism,代碼行數:19,代碼來源:GeoprismDataSetEditorPage.java

示例7: setupAncestor

import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
private void setupAncestor(ComboViewer comboViewer) {
	comboViewer.setContentProvider(new IStructuredContentProvider() {
		@Override
		public Object[] getElements(Object inputElement) {
			List<IFile> files = (List<IFile>) inputElement;
			Object[] ret = new Object[files.size()];
			int index = 0;
			for (IFile file : files) {
				ret[index++] = JavaCore.create(file);
			}
			return ret;
		}
	});
	comboViewer.setLabelProvider(new JavaElementLabelProvider(
			JavaElementLabelProvider.SHOW_QUALIFIED | JavaElementLabelProvider.SHOW_ROOT));
	comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
		@Override
		public void selectionChanged(SelectionChangedEvent event) {
			IStructuredSelection selection = (IStructuredSelection) event.getSelection();
			if (selection.size() > 0) {
				ancestor = (ICompilationUnit) selection.getFirstElement();
			}
		}
	});
	comboViewer.getCombo().setData(GW4E_CONVERSION_WIDGET_ID, GW4E_CONVERSION_COMBO_ANCESTOR_EXTEND_TEST);

	comboViewer.setInput(ancestors);
	if (hasItems()) {
		comboViewer.setSelection(new StructuredSelection(JavaCore.create(ancestors.get(0))));
	}
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:32,代碼來源:ExecutionContextSelectionUIPage.java

示例8: createGrammarsControls

import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
/**
 * Creates the grammars controls.
 * 
 * @param composite
 *          the composite
 */
private void createGrammarsControls(final Composite composite) {
  Label generatorConfigLabel = new Label(composite, SWT.NONE);
  generatorConfigLabel.setText(Messages.GRAMMAR_FIELD_NAME_LABEL);

  Combo generatorConfigurationField = new Combo(composite, SWT.READ_ONLY);
  GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
  data.widthHint = PAGE_WIDTH_HINT; // prevents shrinking of combo view
  generatorConfigurationField.setLayoutData(data);
  generatorConfigurationField.setFont(composite.getFont());

  ComboViewer grammars = new ComboViewer(generatorConfigurationField);
  grammars.setContentProvider(new ArrayContentProvider());
  grammars.setLabelProvider(new LabelProvider() {
    @Override
    public String getText(final Object object) {
      if (object instanceof Grammar) {
        return new GrammarHelper((Grammar) object).getLabelName();
      }
      return super.getText(object);
    }
  });
  grammars.setInput(resourceUtil.getGrammars());

  // React to the selection of the viewer
  // Note that the viewer return the real object and not just a string
  // representation
  grammars.addSelectionChangedListener(new ISelectionChangedListener() {
    public void selectionChanged(final SelectionChangedEvent event) {
      if (event.getSelection() instanceof StructuredSelection) {
        grammar = (Grammar) ((StructuredSelection) event.getSelection()).getFirstElement();
        grammarStatus = validateGrammarAccess();
        handleFieldChanged(GRAMMAR);
      }
    }
  });
  grammars.setSelection(null); // no pre-defined grammar to be used, forces the user to make a decision about which language to target
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:44,代碼來源:NewCheckCatalogWizardPage.java

示例9: populateSeverityCombosFromWorkingCopy

import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
private void populateSeverityCombosFromWorkingCopy() {
  for (IGdtProblemType problemType : problemSeverityCombos.keySet()) {
    ComboViewer combo = problemSeverityCombos.get(problemType);
    GdtProblemSeverity severity = problemSeveritiesWorkingCopy.getSeverity(problemType);
    combo.setSelection(new StructuredSelection(severity));
  }
}
 
開發者ID:gwt-plugins,項目名稱:gwt-eclipse-plugin,代碼行數:8,代碼來源:ErrorsWarningsPage.java

示例10: setDriverSelection

import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
/**
 * Set selected driver in driverChooserViewer combo box
 * 
 * @param driverChooserViewer
 * @param driverList
 */
private void setDriverSelection( String originalDriverClassName,
		ComboViewer driverChooserViewer, List driverList )
{
	// there may exist logic error
	if ( driverList == null || driverList.size( ) == 0 )
	{
		return;
	}

	StructuredSelection selection = null;
	JDBCDriverInformation jdbcDriverInfo = findJdbcDriverInfo( driverChooserViewer,
			originalDriverClassName );
	if ( jdbcDriverInfo != null )
	{
		selection = new StructuredSelection( jdbcDriverInfo );
	}
	else if ( originalDriverClassName.trim( ).length( ) == 0 )
	{
		return;
	}
	else
	{
		JDBCDriverInformation driverInfo = JDBCDriverInformation.newInstance( originalDriverClassName );
		driverList.add( 0, driverInfo );
		driverChooserViewer.setInput( driverList );
		selection = new StructuredSelection( driverInfo );
	}

	driverChooserViewer.setSelection( selection );
}
 
開發者ID:eclipse,項目名稱:birt,代碼行數:37,代碼來源:JDBCSelectionPageHelper.java

示例11: selectComboValue

import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
public static void selectComboValue(ComboViewer viewer, String key, IPreferenceStore store)
{
	String[] input = (String[]) viewer.getInput();
	try
	{
		viewer.setSelection(new StructuredSelection(input[store.getInt(key)]));
	}
	catch (Exception ex)
	{
		viewer.setSelection(new StructuredSelection(input[0]));
	}
}
 
開發者ID:edeoliveira,項目名稱:Mailster,代碼行數:13,代碼來源:DialogUtils.java

示例12: createCombo

import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
private static ComboViewer createCombo(final Composite container, List<?> values) {
	ComboViewer combo = new ComboViewer(container);
	combo.setContentProvider(new ArrayContentProvider());
	combo.setLabelProvider(new LabelProvider());
	combo.setInput(values);
	combo.setSelection(new StructuredSelection(values.get(0)));
	GridDataFactory.fillDefaults().grab(true, false).applyTo(combo.getControl());
	return combo;
}
 
開發者ID:xored,項目名稱:q7.quality.mockups,代碼行數:10,代碼來源:HangingJobPart.java

示例13: setCurrencyContent

import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
private void setCurrencyContent(ComboViewer combo) {
	combo.setContentProvider(ArrayContentProvider.getInstance());
	CurrencyDao dao = new CurrencyDao(Database.get());
	List<Currency> all = dao.getAll();
	Collections.sort(all,
			(c1, c2) -> Strings.compare(c1.getName(), c2.getName()));
	combo.setInput(all);
	currency = exchange.currency;
	if (currency == null)
		currency = dao.getReferenceCurrency();
	if (currency != null) {
		combo.setSelection(new StructuredSelection(currency));
		exchange.currency = currency;
	}
}
 
開發者ID:GreenDelta,項目名稱:olca-app,代碼行數:16,代碼來源:CostDialog.java

示例14: createComboButton

import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
private ComboViewer createComboButton(String label, Object[] options, Group group, IBaseLabelProvider labelProvider) {
    Label effectiveCommandLabel = new Label(group, SWT.NONE);
    effectiveCommandLabel.setText(label);
    ComboViewer comboViewer = new ComboViewer(group, SWT.READ_ONLY);
    comboViewer.setContentProvider(new ArrayContentProvider());
    comboViewer.setInput(options);
    comboViewer.setLabelProvider(labelProvider);
    comboViewer.setSelection(new StructuredSelection(options[0]));
    comboViewer.addSelectionChangedListener(updateEffectiveComandListener);
    return comboViewer;
}
 
開發者ID:mulesoft,項目名稱:mule-tooling-incubator,代碼行數:12,代碼來源:MavenRunCommandLineConfigurationComponent.java

示例15: createBody

import org.eclipse.jface.viewers.ComboViewer; //導入方法依賴的package包/類
@Override
protected void createBody(Composite ancestor) {
	Composite parent = new Composite(ancestor, SWT.NONE);
	parent.setFont(parent.getFont());
	parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	parent.setLayout(new GridLayout(4, false));

	// TextMate theme
	Label label = new Label(parent, SWT.NONE);
	label.setText(TMUIMessages.CreateThemeAssociationWizardPage_theme_text);
	themeViewer = new ComboViewer(parent);
	themeViewer.setLabelProvider(new ThemeLabelProvider());
	themeViewer.setContentProvider(new ThemeContentProvider());
	themeViewer.setInput(TMUIPlugin.getThemeManager());
	themeViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	themeViewer.getControl().addListener(SWT.Selection, this);

	label = new Label(parent, SWT.NONE);
	label.setText(TMUIMessages.CreateThemeAssociationWizardPage_grammar_text);
	grammarViewer = new ComboViewer(parent);
	grammarViewer.setLabelProvider(new GrammarDefinitionLabelProvider());
	grammarViewer.setContentProvider(new GrammarDefinitionContentProvider());
	grammarViewer.setInput(TMEclipseRegistryPlugin.getGrammarRegistryManager());
	grammarViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	grammarViewer.getControl().addListener(SWT.Selection, this);

	if (initialDefinition != null) {
		grammarViewer.setSelection(new StructuredSelection(initialDefinition));
	}

	whenDarkButton = new Button(parent, SWT.CHECK);
	whenDarkButton.setText(TMUIMessages.CreateThemeAssociationWizardPage_whenDark_text);
	GridData data = new GridData();
	data.horizontalSpan = 4;
	whenDarkButton.setLayoutData(data);
	if (initialAssociation != null) {
		ITheme selectedTheme = TMUIPlugin.getThemeManager().getThemeById(initialAssociation.getThemeId());
		if (selectedTheme != null) {
			themeViewer.setSelection(new StructuredSelection(selectedTheme));
		}
		whenDarkButton.setSelection(initialAssociation.isWhenDark());
	}
}
 
開發者ID:eclipse,項目名稱:tm4e,代碼行數:44,代碼來源:CreateThemeAssociationWizardPage.java


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