當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。