本文整理匯總了Java中org.eclipse.ui.texteditor.ConfigurationElementSorter.sort方法的典型用法代碼示例。如果您正苦於以下問題:Java ConfigurationElementSorter.sort方法的具體用法?Java ConfigurationElementSorter.sort怎麽用?Java ConfigurationElementSorter.sort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.ui.texteditor.ConfigurationElementSorter
的用法示例。
在下文中一共展示了ConfigurationElementSorter.sort方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getJavaEditorTextHoverDescriptors
import org.eclipse.ui.texteditor.ConfigurationElementSorter; //導入方法依賴的package包/類
/**
* Returns all Java editor text hovers contributed to the workbench.
*
* @return an array of JavaEditorTextHoverDescriptor
* @since 2.1
*/
public synchronized JavaEditorTextHoverDescriptor[] getJavaEditorTextHoverDescriptors() {
if (fJavaEditorTextHoverDescriptors == null) {
fJavaEditorTextHoverDescriptors= JavaEditorTextHoverDescriptor.getContributedHovers();
ConfigurationElementSorter sorter= new ConfigurationElementSorter() {
/*
* @see org.eclipse.ui.texteditor.ConfigurationElementSorter#getConfigurationElement(java.lang.Object)
*/
@Override
public IConfigurationElement getConfigurationElement(Object object) {
return ((JavaEditorTextHoverDescriptor)object).getConfigurationElement();
}
};
sorter.sort(fJavaEditorTextHoverDescriptors);
// Move Best Match hover to front
for (int i= 0; i < fJavaEditorTextHoverDescriptors.length - 1; i++) {
if (PreferenceConstants.ID_BESTMATCH_HOVER.equals(fJavaEditorTextHoverDescriptors[i].getId())) {
JavaEditorTextHoverDescriptor hoverDescriptor= fJavaEditorTextHoverDescriptors[i];
for (int j= i; j > 0; j--)
fJavaEditorTextHoverDescriptors[j]= fJavaEditorTextHoverDescriptors[j-1];
fJavaEditorTextHoverDescriptors[0]= hoverDescriptor;
break;
}
}
}
return fJavaEditorTextHoverDescriptors;
}