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


Java ViewerSorter类代码示例

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


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

示例1: inputChanged

import org.eclipse.jface.viewers.ViewerSorter; //导入依赖的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.setSorter(new ViewerSorter() {
            public int compare(Viewer iviewer, Object e1, Object e2) {
                if (e1 == null) {
                    return -1;
                } else if (e2 == null) {
                    return 1;
                } else {
                    return ((EnvironmentVariable)e1).getName().compareToIgnoreCase(((EnvironmentVariable)e2).getName());
                }
            }
        });
    }
}
 
开发者ID:eclipse,项目名称:texlipse,代码行数:23,代码来源:KeyValueListFieldEditor.java

示例2: inputChanged

import org.eclipse.jface.viewers.ViewerSorter; //导入依赖的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.setSorter(new ViewerSorter() {
            public int compare(Viewer iviewer, Object e1, Object e2) {
                if (e1 == null) {
                    return -1;
                } else if (e2 == null) {
                    return 1;
                } else {
                    return ((SmartKeyVariable)e1).getName().compareToIgnoreCase(((SmartKeyVariable)e2).getName());
                }
            }
        });
    }
}
 
开发者ID:eclipse,项目名称:texlipse,代码行数:23,代码来源:StyleListFieldEditor.java

示例3: createListContents

import org.eclipse.jface.viewers.ViewerSorter; //导入依赖的package包/类
private ListDialogField createListContents(PathListElement entryToEdit, String key,
        String label, ImageDescriptor descriptor, String[] buttonLabels) {
    ExclusionPatternAdapter adapter = new ExclusionPatternAdapter();

    ListDialogField patternList = new ListDialogField(adapter, buttonLabels,
            new ExclusionInclusionLabelProvider(key, descriptor));
    patternList.setDialogFieldListener(adapter);
    patternList.setLabelText(label);
    patternList.setRemoveButtonIndex(IDX_REMOVE);
    patternList.enableButton(IDX_EDIT, false);

    IPath[] pattern = (IPath[]) entryToEdit.getAttribute(key);

    ArrayList elements = new ArrayList(pattern.length);
    for (int i = 0; i < pattern.length; i++) {
        elements.add(pattern[i].toString());
    }
    patternList.setElements(elements);
    patternList.selectFirstElement();
    patternList.enableButton(IDX_ADD_MULTIPLE, currSourceFolder != null);
    patternList.setViewerSorter(new ViewerSorter());
    return patternList;
}
 
开发者ID:iloveeclipse,项目名称:filesync4eclipse,代码行数:24,代码来源:InclusionExclusionDialog.java

示例4: sortTable

import org.eclipse.jface.viewers.ViewerSorter; //导入依赖的package包/类
private void sortTable(final TableColumn column, final boolean asc)
{
	Table table = tableViewer.getTable();
	table.setSortColumn(column);
	table.setSortDirection(asc? SWT.UP : SWT.DOWN);
	tableViewer.setSorter(new ViewerSorter() {
		public int compare(Viewer viewer, Object o1, Object o2)
		{
			int result;
			switch(tableViewer.getTable().indexOf(column))
			{
				case 0: default:
					result = ( (ItemContent) o1 ).getDisplayName().compareTo(( (ItemContent) o2 ).getDisplayName());
					break;
				case 1:
					result = ( (ItemContent) o1 ).getCustomName().compareTo(( (ItemContent) o2 ).getCustomName());
					break;
				case 2:
					result = ( (ItemContent) o1 ).getDescription().compareTo(( (ItemContent) o2 ).getDescription());
					break;
			}
			return asc? result : result * -1;
		}
	});
	
}
 
开发者ID:eclipse,项目名称:birt,代码行数:27,代码来源:ElementNamesConfigurationBlock.java

示例5: init

import org.eclipse.jface.viewers.ViewerSorter; //导入依赖的package包/类
@PostConstruct
public void init(final EMenuService inService) {
	inService.registerContextMenu(viewer.getControl(), getPopupID());

	viewer.setContentProvider(new ObservableListContentProvider());
	viewer.setSorter(new ViewerSorter(languageService.getContentLanguage()));
	viewer.setInput(getDBInput());
	viewer.addSelectionChangedListener(new ISelectionChangedListener() {
		@Override
		public void selectionChanged(final SelectionChangedEvent inEvent) {
			selectionService.setSelection(((IStructuredSelection) inEvent
					.getSelection()).getFirstElement());
		}
	});

	hookDoubleClickAction();
	hookDragnDrop();
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:19,代码来源:AbstractSelectionView.java

示例6: createPartControl

import org.eclipse.jface.viewers.ViewerSorter; //导入依赖的package包/类
/**
 * This is a callback that will allow us
 * to create the viewer and initialize it.
 */
public void createPartControl(Composite parent) {
	shell = parent.getShell();
	viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
	viewer.setContentProvider(new MapContentProvider());
	viewer.setLabelProvider(new RegistryLabelProvider());
	viewer.setSorter(new ViewerSorter());
	viewer.setInput(registry);
	makeActions();
	hookContextMenu();
	hookDoubleClickAction();
	contributeToActionBars();
	if (registry instanceof Observable) {
		Observable observable = (Observable) registry;
		observable.addObserver(registryObserver);
	}
	viewer.addSelectionChangedListener(new ISelectionChangedListener() {
		@Override
		public void selectionChanged(SelectionChangedEvent event) {
			unregisterAction.setEnabled(!event.getSelection().isEmpty());
		}
	});
	viewer.refresh();
}
 
开发者ID:abelgomez,项目名称:emf.utils,代码行数:28,代码来源:PackageRegistryView.java

示例7: init

import org.eclipse.jface.viewers.ViewerSorter; //导入依赖的package包/类
@Override
public void init(){
	if (slp == null) {
		slp = (SelectorPanelProvider) cv.getConfigurer().getControlFieldProvider();
	}
	if (filter == null) {
		filter = new TreeFilter(slp.getPanel());
	}
	tv = (TreeViewer) cv.getViewerWidget();
	if (orderBy != null) {
		tv.setSorter(new ViewerSorter() {
			
			@Override
			public int compare(Viewer viewer, Object e1, Object e2){
				String c1 = ((PersistentObject) e1).get(orderBy);
				String c2 = ((PersistentObject) e2).get(orderBy);
				return c1.compareTo(c2);
			}
			
		});
	}
	tv.setFilters(new ViewerFilter[] {
		filter
	});
	
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:27,代码来源:ReadOnceTreeLoader.java

示例8: createListSection

import org.eclipse.jface.viewers.ViewerSorter; //导入依赖的package包/类
public void createListSection ( final ScrolledForm form, final ConfigurationEditorInput input, final String attribute, final String label, final String delimiter, final String pattern )
{
    final IObservableList list = StringSplitListObservable.observeString ( Observables.observeMapEntry ( input.getDataMap (), attribute, String.class ), delimiter, pattern );

    // section

    final Section section = this.toolkit.createSection ( form.getBody (), ExpandableComposite.TITLE_BAR );
    section.setText ( label );

    final Composite client = this.toolkit.createComposite ( section, SWT.NONE );
    section.setClient ( client );
    this.toolkit.paintBordersFor ( client );

    client.setLayout ( new GridLayout ( 1, true ) );
    final GridData gd = new GridData ( GridData.FILL_BOTH );
    gd.horizontalSpan = 2;
    section.setLayoutData ( gd );

    // fields
    final ListViewer viewer = new ListViewer ( client );

    viewer.setContentProvider ( new ObservableListContentProvider () );
    viewer.setInput ( list );

    viewer.getControl ().setLayoutData ( new GridData ( GridData.FILL_BOTH ) );

    viewer.setSorter ( new ViewerSorter () );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:29,代码来源:ConfigurationFormToolkit.java

示例9: run

import org.eclipse.jface.viewers.ViewerSorter; //导入依赖的package包/类
public void run() {
	TreeViewer v = getTreeViewer();
	boolean checked = isChecked();
	if (checked) {
		v.setSorter(new ViewerSorter());
		v.setInput(v.getInput());
	} else {
		v.setSorter(null);
		redraw();
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:12,代码来源:PropertiesOutlinePage.java

示例10: createSorter

import org.eclipse.jface.viewers.ViewerSorter; //导入依赖的package包/类
private ViewerSorter createSorter() {
    final TableViewerSorter sorter = new TableViewerSorter(getViewer());

    sorter.setComparator(0, new RPC());

    sorter.sort(0, SortDirection.ASCENDING);
    return sorter;
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:9,代码来源:RetentionPolicyTableControl.java

示例11: createPartControl

import org.eclipse.jface.viewers.ViewerSorter; //导入依赖的package包/类
@Override
public void createPartControl(final Composite parent) {
	NavigationTreeService navigationTree;
	try {
		viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
		viewer.setContentProvider(new NavigationViewContentProvider());
		ColumnViewerToolTipSupport.enableFor(viewer);
		viewer.setLabelProvider(new NavigationViewLabelProvider());
		viewer.addDoubleClickListener(new TreeCollapseExpandListener(viewer));
		viewer.addDoubleClickListener(new IDoubleClickListener() {

			@Override
			public void doubleClick(final DoubleClickEvent event) {
				CommandExecutor.executeCommand(ICommandIds.CMD_MANAGE_BORROWER_MEDIUM);
			}
		});
		viewer.setSorter(new ViewerSorter());
		viewer.setAutoExpandLevel(2);
		navigationTree = new NavigationTreeService(viewer);
		viewer.setInput(navigationTree.getRoot());

		// popup menu related stuff
		final MenuManager manager = new MenuManager();
		viewer.getTree().setMenu(manager.createContextMenu(viewer.getTree()));
		getSite().registerContextMenu(manager, viewer);
		getSite().setSelectionProvider(viewer);
	} catch (final ConnectException e) {
		e.printStackTrace();
	}

}
 
开发者ID:FI13,项目名称:afbb-bibo,代码行数:32,代码来源:NavigationView.java

示例12: createPartControl

import org.eclipse.jface.viewers.ViewerSorter; //导入依赖的package包/类
/**
 * This is a callback that will allow us to create the viewer and initialize
 * it.
 */
@Override
public void createPartControl(Composite parent) {
    // | SWT.VIRTUAL
    setViewer(new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL));
    updateFilter(DataHierarchyPlugin.getDefault().getPreferenceStore().getString(
            IPrefConstants.PREF_ACTIVE_FILTERS_LIST));
    setLabelProvider(new ViewLabelProvider());
    contentProvider = new ViewContentProvider(this);
    getViewer().setContentProvider(contentProvider);
    selectionProvider = new SelectionListener(getViewer());
    getSite().setSelectionProvider(selectionProvider);

    getViewer().setLabelProvider(getLabelProvider());
    getViewer().setSorter(new ViewerSorter(){

        @Override
        public int category(Object element) {
            if(element instanceof TreeElement<?, ?>){
                TreeElement<?, ?> treeElement = (TreeElement<?, ?>) element;
                if(treeElement.isVirtual()){
                    return 42;
                }
                Object data = treeElement.getData();
                if(data instanceof IJavaElement){
                    IJavaElement javaElement = (IJavaElement) data;
                    return javaElement.getElementType();
                }
            }
            return 0;
        }
    });
    getViewer().setInput(DataHierarchyView.class);

    makeActions();
    hookContextMenu();
    hookDoubleClickAction();
    contributeToActionBars();
}
 
开发者ID:iloveeclipse,项目名称:datahierarchy,代码行数:43,代码来源:DataHierarchyView.java

示例13: setTreeViewerAlphabeticalSorter

import org.eclipse.jface.viewers.ViewerSorter; //导入依赖的package包/类
protected void setTreeViewerAlphabeticalSorter() {
	treeViewer.setSorter(new ViewerSorter() {
		@Override
		protected Comparator getComparator() {
			return new Comparator() {
				@Override
				public int compare(Object o1, Object o2) {
						return String.CASE_INSENSITIVE_ORDER.compare(String.valueOf(o1), String.valueOf(o2));
				}
			};
		}
	});
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:14,代码来源:TreeViewerPage.java

示例14: createPartControl

import org.eclipse.jface.viewers.ViewerSorter; //导入依赖的package包/类
public void createPartControl(final Composite parent) {
    viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    vcp = new ViewContentProvider();
    viewer.setContentProvider(vcp);
    viewer.setLabelProvider(new ViewLabelProvider());
    viewer.setSorter(new ViewerSorter());
    viewer.setInput(getViewSite());

    // Create the help context id for the viewer's control
    PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), HELP_TEXT);
    makeActions();
    hookContextMenu();
    hookDoubleClickAction();
    contributeToActionBars();
}
 
开发者ID:apache,项目名称:syncope,代码行数:16,代码来源:SyncopeView.java

示例15: configure

import org.eclipse.jface.viewers.ViewerSorter; //导入依赖的package包/类
final void configure() {
    adapterFactory = createAdapterFactory();
    viewer.addDoubleClickListener(listener);
    viewer.setSorter(new ViewerSorter());
    ColumnViewerToolTipSupport.enableFor(viewer);
    doConfigure();
}
 
开发者ID:GRA-UML,项目名称:tool,代码行数:8,代码来源:ReferenceLibrarySearchResultPage.java


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