Java 类com.intellij.ui.PanelWithAnchor 实例源码

项目:intellij-ce-playground    文件:ProjectSpecificSettingsStep.java   
@Override
protected JPanel createBasePanel() {
  final JPanel panel = super.createBasePanel();

  final Project project = ProjectManager.getInstance().getDefaultProject();
  final List<Sdk> sdks = PyConfigurableInterpreterList.getInstance(project).getAllPythonSdks();
  VirtualEnvProjectFilter.removeAllAssociated(sdks);
  Sdk compatibleSdk = sdks.isEmpty() ? null : sdks.iterator().next();
  DirectoryProjectGenerator generator = getProjectGenerator();
  if (generator instanceof PyFrameworkProjectGenerator && !((PyFrameworkProjectGenerator)generator).supportsPython3()) {
    if (compatibleSdk != null && PythonSdkType.getLanguageLevelForSdk(compatibleSdk).isPy3K()) {
      Sdk python2Sdk = PythonSdkType.findPython2Sdk(sdks);
      if (python2Sdk != null) {
        compatibleSdk = python2Sdk;
      }
    }
  }

  final Sdk preferred = compatibleSdk;
  mySdkCombo = new PythonSdkChooserCombo(project, sdks, new Condition<Sdk>() {
    @Override
    public boolean value(Sdk sdk) {
      return sdk == preferred;
    }
  });
  mySdkCombo.setButtonIcon(PythonIcons.Python.InterpreterGear);

  final LabeledComponent<PythonSdkChooserCombo> labeled = LabeledComponent.create(mySdkCombo, "Interpreter");
  labeled.setLabelLocation(BorderLayout.WEST);
  UIUtil.mergeComponentsWithAnchor(labeled, (PanelWithAnchor)panel.getComponent(0));
  panel.add(labeled);
  final JPanel basePanelExtension = extendBasePanel();
  if (basePanelExtension != null) {
    panel.add(basePanelExtension);
  }

  return panel;
}
项目:consulo-java    文件:ApplicationConfigurable.java   
private JComponent labeled(JComponent component, String label, List<PanelWithAnchor> list)
{
    LabeledComponent labeledComponent = LabeledComponent.create(component, label);
    list.add(labeledComponent);
    return labeledComponent;
}