本文整理汇总了Java中com.intellij.ide.util.treeView.NodeDescriptor.getWeight方法的典型用法代码示例。如果您正苦于以下问题:Java NodeDescriptor.getWeight方法的具体用法?Java NodeDescriptor.getWeight怎么用?Java NodeDescriptor.getWeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ide.util.treeView.NodeDescriptor
的用法示例。
在下文中一共展示了NodeDescriptor.getWeight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compare
import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
@Override
public int compare(NodeDescriptor obj1, NodeDescriptor obj2){
final int weight1 = obj1.getWeight();
final int weight2 = obj2.getWeight();
if (weight1 != weight2) return weight1 - weight2;
if (obj1 instanceof ProjectViewNode && obj2 instanceof ProjectViewNode) {
return ((ProjectViewNode)obj1).getTitle().compareToIgnoreCase(((ProjectViewNode)obj2).getTitle());
}
if (obj1 instanceof ModuleToDoNode && obj2 instanceof ModuleToDoNode){
return ((ModuleToDoNode)obj1).getValue().getName().compareToIgnoreCase(((ModuleToDoNode)obj2).getValue().getName());
} else if(obj1 instanceof ModuleToDoNode) {
return -1;
} else if(obj2 instanceof ModuleToDoNode) {
return 1;
} else{
throw new IllegalArgumentException(obj1.getClass().getName()+","+obj2.getClass().getName());
}
}
示例2: compare
import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
@Override
public int compare(NodeDescriptor nodeDescriptor1, NodeDescriptor nodeDescriptor2) {
int weight1 = nodeDescriptor1.getWeight();
int weight2 = nodeDescriptor2.getWeight();
if (weight1 != weight2) {
return weight1 - weight2;
}
String s1 = nodeDescriptor1.toString();
String s2 = nodeDescriptor2.toString();
if (s1 == null) return s2 == null ? 0 : -1;
if (s2 == null) return +1;
return StringUtil.naturalCompare(s1, s2);
}
示例3: getWeight
import com.intellij.ide.util.treeView.NodeDescriptor; //导入方法依赖的package包/类
protected int getWeight(final NodeDescriptor o1) {
return o1.getWeight();
}