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


Java ViewerComparator類代碼示例

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


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

示例1: showJobDetails

import org.eclipse.jface.viewers.ViewerComparator; //導入依賴的package包/類
/**
 * This method creates a dialog area in the parent composite and displays a
 * progress tree viewer of the running jobs.
 *
 * @param parent
 *            The parent Composite.
 */
void showJobDetails(Composite parent) {
	viewer = new DetailedProgressViewer(parent, SWT.MULTI | SWT.H_SCROLL
			| SWT.V_SCROLL | SWT.BORDER, progressService, finishedJobs);
	viewer.setComparator(new ViewerComparator() {
		@Override
		@SuppressWarnings("unchecked")
           public int compare(Viewer testViewer, Object e1, Object e2) {
			return ((Comparable<Object>) e1).compareTo(e2);
		}
	});
	ProgressViewerContentProvider provider = getContentProvider();
	viewer.setContentProvider(provider);
	viewer.setInput(provider);
	viewer.setLabelProvider(new ProgressLabelProvider());
	GridData data = new GridData(GridData.GRAB_HORIZONTAL
			| GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
	data.horizontalSpan = 2;
	int heightHint = convertHeightInCharsToPixels(10);
	data.heightHint = heightHint;
	viewer.getControl().setLayoutData(data);
}
 
開發者ID:termsuite,項目名稱:termsuite-ui,代碼行數:29,代碼來源:BlockedJobsDialog.java

示例2: setSortColumn

import org.eclipse.jface.viewers.ViewerComparator; //導入依賴的package包/類
private void setSortColumn(
    TreeColumn column, int colIndex, int direction) {

  ViewerComparator sorter = buildColumnSorter(colIndex);
  if (SWT.UP == direction) {
    sorter = new InverseSorter(sorter);
  }

  Tree tree = propViewer.getTree();
  tree.setSortColumn(column);
  tree.setSortDirection(direction);

  propViewer.setComparator(sorter);
}
 
開發者ID:google,項目名稱:depan,代碼行數:15,代碼來源:NodeStatsTableControl.java

示例3: createDialogArea

import org.eclipse.jface.viewers.ViewerComparator; //導入依賴的package包/類
@Override
protected Control createDialogArea(Composite parent)
{
	Composite dialogArea = (Composite) super.createDialogArea(parent);
	Composite composite = new Composite(dialogArea, SWT.NONE);
	createMessageArea(composite);
	listViewer = new TableViewer(composite, SWT.TOP | SWT.BORDER);

	GridData data = new GridData(GridData.FILL_BOTH);
	data.widthHint = 400;
	data.heightHint = 400;
	listViewer.getTable().setLayoutData(data);
	listViewer.setLabelProvider(WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider());
	listViewer.setContentProvider(new JarProjectContentProvider(null));
	listViewer.setComparator(new ViewerComparator());
	listViewer.setInput(ResourcesPlugin.getWorkspace());
	applyDialogFont(composite);

	listViewer.setSelection(new StructuredSelection(initialSelection));
	GridLayoutFactory.fillDefaults().generateLayout(composite);
	return dialogArea;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:23,代碼來源:JPFProjectSelectionDialog.java

示例4: inputChanged

import org.eclipse.jface.viewers.ViewerComparator; //導入依賴的package包/類
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
	if (newInput == null) {
		return;
	}
	if (viewer instanceof TableViewer) {
		TableViewer tableViewer = (TableViewer) viewer;
		if (tableViewer.getTable().isDisposed()) {
			return;
		}
		tableViewer.setComparator(new ViewerComparator() {
			public int compare(Viewer iviewer, Object e1, Object e2) {
				if (e1 == null) {
					return -1;
				} else if (e2 == null) {
					return 1;
				} else {
					return ((PropertyVariable) e1).getName()
							.compareToIgnoreCase(((PropertyVariable) e2).getName());
				}
			}
		});
	}
}
 
開發者ID:de-jcup,項目名稱:egradle,代碼行數:24,代碼來源:EGradleLaunchConfigurationPropertiesTab.java

示例5: create

import org.eclipse.jface.viewers.ViewerComparator; //導入依賴的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

示例6: ProjectSelector

import org.eclipse.jface.viewers.ViewerComparator; //導入依賴的package包/類
public ProjectSelector(Composite parent) {
  super(parent, SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(2).spacing(0, 0).applyTo(this);

  Composite tableComposite = new Composite(this, SWT.NONE);
  TableColumnLayout tableColumnLayout = new TableColumnLayout();
  tableComposite.setLayout(tableColumnLayout);
  GridDataFactory.fillDefaults().grab(true, true).applyTo(tableComposite);
  viewer = new TableViewer(tableComposite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
  createColumns(tableColumnLayout);
  viewer.getTable().setHeaderVisible(true);
  viewer.getTable().setLinesVisible(false);

  input = WritableList.withElementType(GcpProject.class);
  projectProperties = PojoProperties.values(new String[] {"name", "id"}); //$NON-NLS-1$ //$NON-NLS-2$
  ViewerSupport.bind(viewer, input, projectProperties);
  viewer.setComparator(new ViewerComparator());

  Composite linkComposite = new Composite(this, SWT.NONE);
  statusLink = new Link(linkComposite, SWT.WRAP);
  statusLink.addSelectionListener(
      new OpenUriSelectionListener(new ErrorDialogErrorHandler(getShell())));
  statusLink.setText("");
  GridDataFactory.fillDefaults().span(2, 1).applyTo(linkComposite);
  GridLayoutFactory.fillDefaults().generateLayout(linkComposite);
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:27,代碼來源:ProjectSelector.java

示例7: addMappingBaseCombo

import org.eclipse.jface.viewers.ViewerComparator; //導入依賴的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

示例8: execute

import org.eclipse.jface.viewers.ViewerComparator; //導入依賴的package包/類
@Execute
	public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,  E4PreferenceRegistry prefReg, 
			@Optional @Named("preferencePageId") String pageId)
	{
		PreferenceManager pm = prefReg.getPreferenceManager();
		PreferenceDialog dialog = new PreferenceDialog(shell, pm);
		if (pageId != null)
		{
			dialog.setSelectedNode(pageId);
		}

		dialog.create();
		dialog.getTreeViewer().setComparator(new ViewerComparator());
//		dialog.getTreeViewer().expandAll();
		dialog.open();
		
	}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:18,代碼來源:E4PreferencesHandler.java

示例9: buildColumnSorter

import org.eclipse.jface.viewers.ViewerComparator; //導入依賴的package包/類
private ViewerComparator buildColumnSorter(int columnIndex) {
  switch (columnIndex) {
  case INDEX_ROOT:
    return new RootSorter();
  case INDEX_RANK:
    return new RankSorter();
  case INDEX_PREDS:
    return new PredecessorCountSorter();
  case INDEX_SUCCS:
    return new SuccessorCountSorter();
  }

  // By default, use an alphabetic sort over the column labels.
  ITableLabelProvider labelProvider =
      (ITableLabelProvider) propViewer.getLabelProvider();
  ViewerComparator result = new AlphabeticSorter(
      new LabelProviderToString(labelProvider, columnIndex));
  return result;
}
 
開發者ID:google,項目名稱:depan,代碼行數:20,代碼來源:NodeStatsTableControl.java

示例10: setSortColumn

import org.eclipse.jface.viewers.ViewerComparator; //導入依賴的package包/類
private void setSortColumn(
    TableColumn column, int colIndex, int direction) {

  ITableLabelProvider labelProvider =
      (ITableLabelProvider) kindViewer.getLabelProvider();
  ViewerComparator sorter = new AlphabeticSorter(
      new LabelProviderToString(labelProvider, colIndex));
  if (SWT.UP == direction) {
    sorter = new InverseSorter(sorter);
  }

  Table tableControl = (Table) kindViewer.getControl();
  kindViewer.setComparator(sorter);
  tableControl.setSortColumn(column);
  tableControl.setSortDirection(direction);
}
 
開發者ID:google,項目名稱:depan,代碼行數:17,代碼來源:NodeKindTableControl.java

示例11: buildColumnSorter

import org.eclipse.jface.viewers.ViewerComparator; //導入依賴的package包/類
private ViewerComparator buildColumnSorter(int colIndex) {
  if (INDEX_VISIBLE == colIndex) {
    return new BooleanVisibleSorter();
  }
  if (INDEX_XPOS == colIndex) {
    return new PositionSorter(true);
  }
  if (INDEX_YPOS == colIndex) {
    return new PositionSorter(false);
  }

  // By default, use an alphabetic sort over the column labels.
  ITableLabelProvider labelProvider =
      (ITableLabelProvider) propViewer.getLabelProvider();
  ViewerComparator result = new AlphabeticSorter(
      new LabelProviderToString(labelProvider, colIndex));
  return result;
}
 
開發者ID:google,項目名稱:depan,代碼行數:19,代碼來源:NodeDisplayTableControl.java

示例12: LegacyGWTHostPageSelectionDialog

import org.eclipse.jface.viewers.ViewerComparator; //導入依賴的package包/類
private LegacyGWTHostPageSelectionDialog(Shell parent, IProject project,
    Map<String, Set<String>> hostPagesByModule, boolean isExternal) {
  super(parent, new LegacyHostPageSelectionLabelProvider(),
      new LegacyGWTHostPageSelectionContentProvider());

  this.isExternal = isExternal;
  this.project = project;
  this.isEmpty = hostPagesByModule.isEmpty();
  this.useHostPage = !isEmpty;

  setValidator(new LegacyHostPageSelectionStatusValidator());
  setTitle("Host page selection");
  setMessage("Choose a host page to launch the application with:");

  setInput(LegacyGWTHostPageSelectionTreeItem.buildTree(hostPagesByModule));
  setComparator(new ViewerComparator());
}
 
開發者ID:gwt-plugins,項目名稱:gwt-eclipse-plugin,代碼行數:18,代碼來源:LegacyGWTHostPageSelectionDialog.java

示例13: getViewerComperator

import org.eclipse.jface.viewers.ViewerComparator; //導入依賴的package包/類
private ViewerComparator getViewerComperator()
{
	return new ViewerComparator(new Comparator<String>()
	{

		public int compare(String o1, String o2)
		{
			// set Aptana natures ahead of others
			if (ResourceUtil.isAptanaNature(o1))
			{
				return ResourceUtil.isAptanaNature(o2) ? o1.compareTo(o2) : -1;
			}
			return ResourceUtil.isAptanaNature(o2) ? 1 : o1.compareTo(o2);
		}
	});
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:17,代碼來源:ProjectNaturesPage.java

示例14: createTable

import org.eclipse.jface.viewers.ViewerComparator; //導入依賴的package包/類
private void createTable(Composite parent)
{
	tableViewer = new TableViewer(parent, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
	tableViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

	tableViewer.setContentProvider(ArrayContentProvider.getInstance());
	tableViewer.setLabelProvider(new LabelProvider());
	tableViewer.setComparator(new ViewerComparator());
	tableViewer.setInput(items);
	tableViewer.addSelectionChangedListener(new ISelectionChangedListener()
	{

		public void selectionChanged(SelectionChangedEvent event)
		{
			updateStates();
		}

	});
	updateStates();
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:21,代碼來源:CListTable.java

示例15: propertyChange

import org.eclipse.jface.viewers.ViewerComparator; //導入依賴的package包/類
public void propertyChange(PropertyChangeEvent event)
{
	String property = event.getProperty();

	if (property.equals(IPreferenceConstants.LINK_OUTLINE_WITH_EDITOR))
	{
		boolean isLinked = Boolean.parseBoolean(StringUtil.getStringValue(event.getNewValue()));

		fToggleLinkingAction.setChecked(isLinked);
		TreeViewer viewer = getTreeViewer();
		if (isLinked)
		{
			setEditorSelection((IStructuredSelection) viewer.getSelection(), false);
		}
	}
	else if (property.equals(IPreferenceConstants.SORT_OUTLINE_ALPHABETIC))
	{
		boolean sort = Boolean.parseBoolean(StringUtil.getStringValue(event.getNewValue()));
		getTreeViewer().setComparator(sort ? new ViewerComparator() : null);
	}
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:22,代碼來源:CommonOutlinePage.java


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