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


Java ComboViewer.setLabelProvider方法代码示例

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


在下文中一共展示了ComboViewer.setLabelProvider方法的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: 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

示例3: createUI

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
@Override
	protected void createUI(Composite parent) {
		GridLayout layout = new GridLayout(2, false);
		layout.marginWidth = 0;
		layout.marginHeight = 0;
		this.setLayout(layout);

//		itemsPerPageLabel = new Label(parent, SWT.NONE);
//		itemsPerPageLabel.setText(Resources.getText(
//				Resources.PaginationRenderer_itemsPerPage, getLocale()));
//		itemsPerPageLabel.setLayoutData(new GridData());

		comboViewer = new ComboViewer(parent, SWT.READ_ONLY);
		comboViewer.setContentProvider(ArrayContentProvider.getInstance());
		comboViewer.setLabelProvider(InternalLabelProvider.getInstance());
		comboViewer.getCombo().setLayoutData(
				new GridData(GridData.FILL_HORIZONTAL));
		comboViewer.getCombo().addSelectionListener(this);

	}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:21,代码来源:MyPageSizeComboRenderer.java

示例4: addProblemTypeRow

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
private void addProblemTypeRow(Composite categoryProblemsPanel, IGdtProblemType problemType) {
  GridData problemLabelLayout = new GridData(SWT.FILL, SWT.CENTER, true, false);

  Label problemLabel = new Label(categoryProblemsPanel, SWT.NONE);
  problemLabel.setLayoutData(problemLabelLayout);
  problemLabel.setText(problemType.getDescription());

  ComboViewer severityCombo = new ComboViewer(categoryProblemsPanel, SWT.READ_ONLY);
  GridData severityComboLayout = new GridData(SWT.FILL, SWT.CENTER, false, false);
  severityCombo.getCombo().setLayoutData(severityComboLayout);
  severityCombo.setContentProvider(new ArrayContentProvider());
  severityCombo.setLabelProvider(severityLabelProvider);
  severityCombo.setSorter(severityViewerSorter);
  severityCombo.setInput(GdtProblemSeverity.values());

  // Save the association between the problem type and this combo
  problemSeverityCombos.put(problemType, severityCombo);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:19,代码来源:ErrorsWarningsPage.java

示例5: createRepositoryPart

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
private ComboViewer createRepositoryPart(Composite container, final List<ITeamRepository> repos) {
	Label repoLabel= new Label(container, SWT.NONE);
	repoLabel.setText("Repository:");

	Combo repoCombo= new Combo(container, SWT.SINGLE | SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY);
	repoCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	ComboViewer comboViewer= new ComboViewer(repoCombo);
	comboViewer.setContentProvider(new ArrayContentProvider());
	comboViewer.setLabelProvider(new RepositoryLabelProvider());
	comboViewer.setInput(repos);
	comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
		@Override
		public void selectionChanged(SelectionChangedEvent event) {
			withRepository((ITeamRepository)((IStructuredSelection)event.getSelection()).getFirstElement());
		}
	});
	return comboViewer;
}
 
开发者ID:sandy081,项目名称:Copy-Work-Items,代码行数:19,代码来源:ProjectAreaSelectionPage.java

示例6: createEmbeddedTslintPluginField

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
private void createEmbeddedTslintPluginField(Composite parent) {
	useEmbeddedTslintPluginButton = new Button(parent, SWT.RADIO);
	useEmbeddedTslintPluginButton.setText(TypeScriptUIMessages.TSLintWizardPage_useEmbeddedTslintPlugin_label);
	useEmbeddedTslintPluginButton.addListener(SWT.Selection, this);
	useEmbeddedTslintPluginButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			updateTslintPluginMode();
		}
	});

	embeddedTslintPlugin = new Combo(parent, SWT.READ_ONLY);
	embeddedTslintPlugin.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	ComboViewer viewer = new ComboViewer(embeddedTslintPlugin);
	viewer.setContentProvider(ArrayContentProvider.getInstance());
	viewer.setLabelProvider(new TypeScriptRepositoryLabelProvider(false, true));
	List<ITypeScriptRepository> repositories = Arrays
			.stream(TypeScriptCorePlugin.getTypeScriptRepositoryManager().getRepositories())
			.filter(r -> r.getTslintLanguageServiceName() != null).collect(Collectors.toList());
	viewer.setInput(repositories);
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:23,代码来源:TSLintWizardPage.java

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

示例8: createFieldEditors

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
/**
 * Create contents of the preference page.
 */
@Override
protected void createFieldEditors() {
	// Create the field editors
	IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.bbaw.bts.app");
	Composite container = (Composite) this.getControl();
	container.setLayout(new GridLayout(1, false));

	Label activeConfigLB = new Label(container, SWT.NONE);
	activeConfigLB.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false,
			false, 1, 1));
	activeConfigLB.setText("Currently active Configuration");

	activeConfigcomboViewer = new ComboViewer(container, SWT.READ_ONLY);
	activeConfigcomboViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
			false, 1, 1));
	ComposedAdapterFactory factory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
	AdapterFactoryLabelProvider labelProvider = new AdapterFactoryLabelProvider(factory);
	activeConfigcomboViewer.setContentProvider(new AdapterFactoryContentProvider(factory));
	activeConfigcomboViewer.setLabelProvider(labelProvider);		
	
	
	init(null);
	loaded = true;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:28,代码来源:ConfigurationPage.java

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

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

示例11: createDomainCombo

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
protected void createDomainCombo(Composite leftColumn) {

		Label label = getToolkit().createLabel(leftColumn, "Statechart domain");
		GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).applyTo(label);
		domainCombo = new ComboViewer(leftColumn);
		GridDataFactory.fillDefaults().span(1, 1).align(SWT.FILL, SWT.CENTER).applyTo(domainCombo.getCombo());
		Label spacer = getToolkit().createLabel(leftColumn, "");
		GridDataFactory.fillDefaults().applyTo(spacer);
		domainCombo.setContentProvider(new ArrayContentProvider());
		domainCombo.setLabelProvider(new LabelProvider() {
			@Override
			public String getText(Object element) {
				return ((IDomain) element).getName();
			}
		});

		List<IDomain> domains = DomainRegistry.getDomains();
		for (IDomain domainDescriptor : domains) {
			domainCombo.add(domainDescriptor);
		}

		if (domains.size() <= 1) {
			domainCombo.getControl().setEnabled(false);
		}

	}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:27,代码来源:StatechartPropertySection.java

示例12: createCurrencyRow

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的package包/类
private void createCurrencyRow(Composite body, FormToolkit tk) {
	Combo widget = UI.formCombo(body, tk, M.Currency);
	currencyCombo = new ComboViewer(widget);
	currencyCombo.setLabelProvider(new LabelProvider() {
		@Override
		public String getText(Object obj) {
			if (!(obj instanceof Currency))
				return super.getText(obj);
			return ((Currency) obj).getName();
		}
	});
	setCurrencyContent(currencyCombo);
	currencyCombo.addSelectionChangedListener(e -> {
		currency = Viewers.getFirst(e.getSelection());
		exchange.currency = currency;
		updateCurrencyLabels();
	});
	UI.filler(body, tk);
}
 
开发者ID:GreenDelta,项目名称:olca-app,代码行数:20,代码来源:CostDialog.java

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

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

示例15: createTestContainerSelectionGroup

import org.eclipse.jface.viewers.ComboViewer; //导入方法依赖的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


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