当前位置: 首页>>代码示例>>Java>>正文


Java ComboViewer.setComparator方法代码示例

本文整理汇总了Java中org.eclipse.jface.viewers.ComboViewer.setComparator方法的典型用法代码示例。如果您正苦于以下问题:Java ComboViewer.setComparator方法的具体用法?Java ComboViewer.setComparator怎么用?Java ComboViewer.setComparator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jface.viewers.ComboViewer的用法示例。


在下文中一共展示了ComboViewer.setComparator方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
private void create(Composite parent) {
  displayExecutor = DisplayExecutor.create(parent.getDisplay());
  comboViewer = new ComboViewer(parent, SWT.READ_ONLY | SWT.DROP_DOWN);
  comboViewer.setComparator(new ViewerComparator());
  comboViewer.setLabelProvider(new LabelProvider() {
    @Override
    public String getText(Object element) {
      if (element instanceof GcpProject) {
        GcpProject project = (GcpProject) element;
        return project.getName() + " (" + project.getId() + ")";
      }
      return super.getText(element);
    }
  });
  comboViewer.setContentProvider(ArrayContentProvider.getInstance());
  comboViewer.setInput(EMPTY_PROJECTS);
  parent.addDisposeListener(new DisposeListener() {
    @Override
    public void widgetDisposed(DisposeEvent event) {
      cancelFetch();
    }
  });

  fetch();
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:26,代码来源:MiniSelector.java

示例2: addMappingBaseCombo

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
/**
 * Add the mapping base {@link ComboViewer} to the given header {@link Composite}.
 * 
 * @param headerComposite
 *            the header {@link Composite}
 * @return the mapping base {@link ComboViewer}
 */
private ComboViewer addMappingBaseCombo(Composite headerComposite) {

	final Label selectMappingBaseLabel = new Label(headerComposite, SWT.NONE);
	selectMappingBaseLabel.setToolTipText("Select a mapping base.");
	selectMappingBaseLabel.setText("Mapping base:");
	final ComboViewer mappingCombo = new ComboViewer(headerComposite, SWT.READ_ONLY);
	Combo combo = mappingCombo.getCombo();
	combo.setToolTipText("Select the mapping base to use.");
	mappingCombo.setContentProvider(new MappingBaseRegistryContentProvider());
	mappingCombo.setLabelProvider(new MappingLabelProvider(MappingLabelProvider.SOURCE));
	mappingCombo.setComparator(new ViewerComparator());
	mappingCombo.setInput(MappingUtils.getMappingRegistry());
	mappingCombo.addSelectionChangedListener(new BaseComboSelectionChangedListener());

	return mappingCombo;
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:24,代码来源:MappingView.java

示例3: ContextValueControl

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
public ContextValueControl(Composite parent) {
  super(parent, SWT.NONE);
  setLayout(new FillLayout());

  viewer = new ComboViewer(this, SWT.READ_ONLY | SWT.FLAT);
  viewer.setContentProvider(new ArrayContentProvider());
  viewer.setLabelProvider(CONTROL_LABEL_PROVIDER);
  viewer.setComparator(new AlphabeticSorter(new ViewerObjectToString() {

      @Override
      public String getString(Object object) {
        return CONTROL_LABEL_PROVIDER.getText(object);
      }
    }));

  viewer.setInput(ContextKey.Base.values());

  listener = new ControlSelectionChangedListener();
  viewer.addSelectionChangedListener(listener);
}
 
开发者ID:google,项目名称:depan,代码行数:21,代码来源:ContextValueControl.java

示例4: ComposeModeControl

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
public ComposeModeControl(Composite parent) {
  super(parent, SWT.NONE);
  setLayout(new FillLayout());

  viewer = new ComboViewer(this, SWT.READ_ONLY | SWT.FLAT);
  viewer.setContentProvider(new ArrayContentProvider());
  viewer.setLabelProvider(CONTROL_LABEL_PROVIDER);
  viewer.setComparator(new AlphabeticSorter(new ViewerObjectToString() {

      @Override
      public String getString(Object object) {
        return CONTROL_LABEL_PROVIDER.getText(object);
      }
    }));

  viewer.setInput(ComposeMode.values());

  listener = new ControlSelectionChangedListener();
  viewer.addSelectionChangedListener(listener);
}
 
开发者ID:google,项目名称:depan,代码行数:21,代码来源:ComposeModeControl.java

示例5: MapChoiceControl

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
public MapChoiceControl(Composite parent) {
  super(parent, SWT.NONE);
  setLayout(new FillLayout());

  viewer = new ComboViewer(this, SWT.READ_ONLY | SWT.FLAT);
  viewer.setContentProvider(new ControlContentProvider());
  viewer.setLabelProvider(CONTROL_LABEL_PROVIDER);
  viewer.setComparator(new AlphabeticSorter(new ViewerObjectToString() {

      @Override
      public String getString(Object object) {
        return CONTROL_LABEL_PROVIDER.getText(object);
      }
    }));

  listener = new ControlSelectionChangedListener();
  viewer.addSelectionChangedListener(listener);
}
 
开发者ID:google,项目名称:depan,代码行数:19,代码来源:MapChoiceControl.java

示例6: addBehandlungsfallComboSelector

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
protected void addBehandlungsfallComboSelector(Composite container){
	Label lblBehandlungsfall = new Label(container, SWT.NONE);
	lblBehandlungsfall.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblBehandlungsfall.setText("Behandlungsfall");
	
	comboViewerBehandlungsfall = new ComboViewer(container, SWT.NONE);
	comboViewerBehandlungsfall.getCombo().setLayoutData(
		new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
	comboViewerBehandlungsfall.getCombo().setEnabled(false);
	comboViewerBehandlungsfall.setContentProvider(ArrayContentProvider.getInstance());
	comboViewerBehandlungsfall.setLabelProvider(new BasePropertyComboLabelProvider());
	comboViewerBehandlungsfall.setComparator(new BasePropertyViewerComparator());
	comboViewerBehandlungsfall.addSelectionChangedListener(new ISelectionChangedListener() {
		@Override
		public void selectionChanged(SelectionChangedEvent event){
			IStructuredSelection behandlungsfallSelection =
				(IStructuredSelection) event.getSelection();
			selectedBehandlungsfallCode =
				((BaseProperty) behandlungsfallSelection.getFirstElement()).getCode();
			setExecuteOk(true);
		}
	});
}
 
开发者ID:MEDEVIT,项目名称:ecard,代码行数:24,代码来源:BehandlungsfallDurchfuehrenDialog.java

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

示例8: bindValue

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
/**
 * 对下拉列表和转换器列表进行绑定
 * @param context
 * @param comboViewer
 * @param model
 *            ;
 */
public static void bindValue(DataBindingContext context, ComboViewer comboViewer, ConverterViewModel model) {
	// ViewerSupport.bind(comboViewer, BeansObservables.observeList(
	// model, "supportTypes", String.class),
	// Properties.selfValue(String.class));
	//		
	//
	// context.bindValue(ViewersObservables
	// .observeSingleSelection(comboViewer), BeansObservables
	// .observeValue(model,
	// "selectedType"));

	// ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider();
	comboViewer.setContentProvider(new ArrayContentProvider());
	comboViewer.setComparator(new ViewerComparator());
	// IObservableMap[] attributeMaps = BeansObservables.observeMaps(
	// viewerContentProvider.getKnownElements(),
	// ConverterBean.class, new String[] { "description" });
	// comboViewer.setLabelProvider(new ObservableMapLabelProvider(
	// attributeMaps));
	// comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class));

	comboViewer.setInput(model.getSupportTypes());
	IViewerObservableValue selection = ViewersObservables.observeSingleSelection(comboViewer);
	IObservableValue observableValue = BeansObservables.observeDetailValue(selection, PROPERTIES_NAME, null);
	context.bindValue(observableValue, BeansObservables.observeValue(model, PROPERTIES_SELECTED_TYPE));
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:34,代码来源:ConverterUtil.java

示例9: bindValue

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
public static void bindValue(DataBindingContext context,ComboViewer comboViewer,
			ConverterViewModel model) {
//		ViewerSupport.bind(comboViewer, BeansObservables.observeList(
//				model, "supportTypes", String.class),
//				Properties.selfValue(String.class));
//		
//
//		context.bindValue(ViewersObservables
//				.observeSingleSelection(comboViewer), BeansObservables
//				.observeValue(model,
//						"selectedType"));
		
//		ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider();
		comboViewer.setContentProvider(new ArrayContentProvider());
		comboViewer.setComparator(new ViewerComparator());
//		IObservableMap[] attributeMaps = BeansObservables.observeMaps(
//				viewerContentProvider.getKnownElements(),
//				ConverterBean.class, new String[] { "description" });
//		comboViewer.setLabelProvider(new ObservableMapLabelProvider(
//		attributeMaps));
//		comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class));
		
		comboViewer.setInput(model.getSupportTypes());
		IViewerObservableValue selection=ViewersObservables.observeSingleSelection(comboViewer);
		IObservableValue observableValue=BeansObservables.observeDetailValue(selection, "name", ConverterBean.class);
		context.bindValue(observableValue, BeansObservables
				.observeValue(model,
						"selectedType"));
	}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:30,代码来源:ConverterUtil.java

示例10: createMavenToOsgiVersionMappingStrategy

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
private void createMavenToOsgiVersionMappingStrategy(final Group group) {
	ComboViewer mavenToOsgiVersionMapping = new ComboViewer(group);
	mavenToOsgiVersionMapping.setContentProvider(new ArrayContentProvider());
	mavenToOsgiVersionMapping.setLabelProvider(new LabelProvider() {
		@Override
		public String getText(Object element) {
			return ((MavenToOsgiVersionMappingStrategy) element).getKey();
		}
	});
	mavenToOsgiVersionMapping.setComparator(new ViewerComparator());
	mavenToOsgiVersionMapping.setInput(MavenToOsgiVersionMappingStrategy.values());
	
	IObservableValue versionMappingTargetObservable = ViewerProperties.singleSelection().observe(mavenToOsgiVersionMapping);
	IObservableValue versionMappingModelObservable = BeansObservables.observeValue(model, PreferencesPageModel.PN_MAVEN_TO_OSGI_VERSION_MAPPING_STRATEGY);
	dataBindingContext.bindValue(versionMappingTargetObservable, versionMappingModelObservable, null, null);
	
	Label description = new Label(group, SWT.WRAP);
	GridDataFactory.fillDefaults().grab(true, true).hint(150, SWT.DEFAULT).applyTo(description);
	
	IObservableValue descriptionTargetObservable = WidgetProperties.text().observe(description);
	IObservableValue descriptionModelObservable = BeansObservables.observeValue(model, PreferencesPageModel.PN_MAVEN_TO_OSGI_VERSION_MAPPING_STRATEGY_DESCRIPTION);
	dataBindingContext.bindValue(descriptionTargetObservable, descriptionModelObservable, null, null);
	
	model.addPropertyChangeListener(PreferencesPageModel.PN_MAVEN_TO_OSGI_VERSION_MAPPING_STRATEGY_DESCRIPTION, new PropertyChangeListener() {
		@Override
		public void propertyChange(PropertyChangeEvent evt) {
			group.getParent().layout();
		}
	});
}
 
开发者ID:inventage,项目名称:version-tiger,代码行数:31,代码来源:VersionTigerPreferencesPage.java

示例11: createVersionRangeChangeStrategy

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
private void createVersionRangeChangeStrategy(final Composite container) {
	Group group = new Group(container, SWT.BORDER);
	group.setText(Messages.VersionTigerPreferencesPage_DependencyGroup);
	group.setLayout(new GridLayout(1, false));
	group.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
	
	ComboViewer versionRangeChange = new ComboViewer(group);
	versionRangeChange.setContentProvider(new ArrayContentProvider());
	versionRangeChange.setLabelProvider(new LabelProvider() {
		@Override
		public String getText(Object element) {
			return ((VersionRangeChangeStrategy) element).getKey();
		}
	});
	versionRangeChange.setComparator(new ViewerComparator());
	versionRangeChange.setInput(VersionRangeChangeStrategy.values());
	
	IObservableValue versionRangeTargetObservable = ViewerProperties.singleSelection().observe(versionRangeChange);
	IObservableValue versionRangeModelObservable = BeansObservables.observeValue(model, PreferencesPageModel.PN_VERSION_RANGE_CHANGE_STRATEGY);
	dataBindingContext.bindValue(versionRangeTargetObservable, versionRangeModelObservable, null, null);
	
	Label description = new Label(group, SWT.WRAP);
	GridDataFactory.fillDefaults().grab(true, true).hint(150, SWT.DEFAULT).applyTo(description);
	
	IObservableValue descriptionTargetObservable = WidgetProperties.text().observe(description);
	IObservableValue descriptionModelObservable = BeansObservables.observeValue(model, PreferencesPageModel.PN_VERSION_RANGE_CHANGE_STRATEGY_DESCRIPTION);
	dataBindingContext.bindValue(descriptionTargetObservable, descriptionModelObservable, null, null);
	
	model.addPropertyChangeListener(PreferencesPageModel.PN_VERSION_RANGE_CHANGE_STRATEGY_DESCRIPTION, new PropertyChangeListener() {
		@Override
		public void propertyChange(PropertyChangeEvent evt) {
			container.layout();
		}
	});
}
 
开发者ID:inventage,项目名称:version-tiger,代码行数:36,代码来源:VersionTigerPreferencesPage.java


注:本文中的org.eclipse.jface.viewers.ComboViewer.setComparator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。