Java 类com.intellij.openapi.util.Weighted 实例源码

项目:intellij-ce-playground    文件:IdeGlassPaneImpl.java   
@Override
public int compare(EventListener o1, EventListener o2) {
  double weight1 = 0;
  double weight2 = 0;
  if (o1 instanceof Weighted) {
    weight1 = ((Weighted)o1).getWeight();
  }
  if (o2 instanceof Weighted) {
    weight2 = ((Weighted)o2).getWeight();
  }
  return weight1 > weight2 ? 1 : weight1 < weight2 ? -1 : myMouseListeners.indexOf(o1) - myMouseListeners.indexOf(o2);
}
项目:consulo    文件:OptionsTree.java   
private static double getWeight(ConfigurableNode node) {
  Configurable configurable = node.getConfigurable();
  if (configurable instanceof Weighted) {
    return ((Weighted)configurable).getWeight();
  }
  return 0;
}
项目:consulo    文件:ColorAndFontOptions.java   
protected List<ColorAndFontPanelFactory> createPanelFactories() {
  List<ColorAndFontPanelFactory> result = new ArrayList<>();
  result.add(new FontConfigurableFactory());

  List<ColorAndFontPanelFactory> extensions = new ArrayList<>();
  extensions.add(new ConsoleFontConfigurableFactory());
  ColorSettingsPage[] pages = ColorSettingsPages.getInstance().getRegisteredPages();
  for (final ColorSettingsPage page : pages) {
    extensions.add(new ColorAndFontPanelFactoryEx() {
      @Override
      public double getWeight() {
        if (page instanceof Weighted) {
          return ((Weighted)page).getWeight();
        }
        return 0;
      }

      @Override
      @Nonnull
      public NewColorAndFontPanel createPanel(@Nonnull ColorAndFontOptions options) {
        final SimpleEditorPreview preview = new SimpleEditorPreview(options, page);
        return NewColorAndFontPanel.create(preview, page.getDisplayName(), options, null, page);
      }

      @Override
      @Nonnull
      public String getPanelDisplayName() {
        return page.getDisplayName();
      }
    });
  }
  Collections.addAll(extensions, Extensions.getExtensions(ColorAndFontPanelFactory.EP_NAME));
  result.addAll(extensions);
  result.add(new DiffColorsPageFactory());
  result.add(new FileStatusColorsPageFactory());
  result.add(new ScopeColorsPageFactory());

  return result;
}
项目:consulo    文件:ColorAndFontOptions.java   
@Override
public double getWeight() {
  if (myFactory instanceof Weighted) {
    return ((Weighted)myFactory).getWeight();
  }
  return 0;
}