下面列出了怎么用org.eclipse.ui.model.WorkbenchViewerComparator的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Create the import source selection widget. (Copied from
* WizardResourceImportPage but instead always uses the internal
* ResourceTreeAndListGroup to keep compatibility with Kepler)
*/
@Override
protected void createFileSelectionGroup(Composite parent) {
// Just create with a dummy root.
fSelectionGroup = new ResourceTreeAndListGroup(parent,
new FileSystemElement("Dummy", null, true), //$NON-NLS-1$
getFolderProvider(), new WorkbenchLabelProvider(),
getFileProvider(), new WorkbenchLabelProvider(), SWT.NONE,
DialogUtil.inRegularFontMode(parent));
ICheckStateListener listener = event -> updateWidgetEnablements();
WorkbenchViewerComparator comparator = new WorkbenchViewerComparator();
fSelectionGroup.setTreeComparator(comparator);
fSelectionGroup.setListComparator(comparator);
fSelectionGroup.addCheckStateListener(listener);
}
private void createPageControls( Composite parent ) {
cleanupButton = new Button( parent, SWT.CHECK );
cleanupButton.setText( "Remove on-the-fly generated launch configurations when no longer needed" );
cleanupButton.addListener( SWT.Selection, this::cleanupButtonSelected );
cleanupTypesLabel = new Label( parent, SWT.NONE );
cleanupTypesLabel.setText( "Select the launch configuration types to clean up" );
cleanupTypesViewer = CheckboxTableViewer.newCheckList( parent, SWT.BORDER );
cleanupTypesViewer.setLabelProvider( DebugUITools.newDebugModelPresentation() );
cleanupTypesViewer.setContentProvider( ArrayContentProvider.getInstance() );
cleanupTypesViewer.setComparator( new WorkbenchViewerComparator() );
cleanupTypesViewer.addFilter( new LaunchConfigTypeFilter() );
cleanupTypesViewer.setInput( launchManager.getLaunchConfigurationTypes() );
selectAllButton = new Button( parent, SWT.PUSH );
selectAllButton.addListener( SWT.Selection, event -> cleanupTypesViewer.setAllChecked( true ) );
selectAllButton.setText( "&Select All" );
deselectAllButton = new Button( parent, SWT.PUSH );
deselectAllButton.setText( "&Deselect All" );
deselectAllButton.addListener( SWT.Selection, event -> cleanupTypesViewer.setAllChecked( false ) );
notelabel = new Label( parent, SWT.WRAP );
String text
= "Note: Launch configurations are considered as on-the-fly generated if "
+ "they were created outside the Run Configurations dialog without further "
+ "manual changes. For example with Run As > JUnit Test";
notelabel.setText( text );
}