public void init(PsiElement element) {
    myFile = (XmlFile) element.getContainingFile();

    if (element instanceof XmlTag) {
      myTag = (XmlTag) element;
    } else {
      final XmlDocument document = myFile.getDocument();

      if (document != null) {
        myTag = document.getRootTag();
      }
    }

    if (myTag != null) {
      myTargetNamespace = myTag.getAttributeValue("targetNamespace");
    }

    final THashSet<PsiFile> dependenciesSet = new THashSet<PsiFile>();
    final Set<PsiFile> redefineProcessingSet = myRedefinedDescriptorsInProcessing.get();
    if (redefineProcessingSet != null) {
      dependenciesSet.addAll(redefineProcessingSet);
    }
    collectDependencies(myTag, myFile, dependenciesSet);
    dependencies = ArrayUtil.toObjectArray(dependenciesSet);
  }
  @Override
  protected JComponent createNorthPanel() {
    JBLabel descriptionLabel = new JBLabel("<html>" + makeDescription() + "</html>");

    final JComboBox repositorySelector =
        new JComboBox(ArrayUtil.toObjectArray(myRepositories, GitRepository.class));
    repositorySelector.setRenderer(new GitRepositoryComboboxListCellRenderer(repositorySelector));
    repositorySelector.setSelectedItem(myInitialRepository);
    repositorySelector.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            List<GitCommit> commits =
                myCommits.get((GitRepository) repositorySelector.getSelectedItem());
            myCommitListWithDiffPanel.setCommits(new ArrayList<GitCommit>(commits));
          }
        });

    JPanel repoSelectorPanel = new JPanel(new BorderLayout());
    JBLabel label = new JBLabel("Repository: ");
    label.setLabelFor(repoSelectorPanel);
    repoSelectorPanel.add(label, BorderLayout.WEST);
    repoSelectorPanel.add(repositorySelector);

    if (myRepositories.size() < 2) {
      repoSelectorPanel.setVisible(false);
    }

    JPanel northPanel = new JPanel(new BorderLayout());
    northPanel.add(descriptionLabel);
    northPanel.add(repoSelectorPanel, BorderLayout.SOUTH);
    return northPanel;
  }
 public boolean checkConflicts(final ExtractSuperclassDialog dialog) {
   final MemberInfo[] infos =
       ArrayUtil.toObjectArray(dialog.getSelectedMemberInfos(), MemberInfo.class);
   final PsiDirectory targetDirectory = dialog.getTargetDirectory();
   final PsiPackage targetPackage;
   if (targetDirectory != null) {
     targetPackage = JavaDirectoryService.getInstance().getPackage(targetDirectory);
   } else {
     targetPackage = null;
   }
   final MultiMap<PsiElement, String> conflicts = new MultiMap<PsiElement, String>();
   if (!ProgressManager.getInstance()
       .runProcessWithProgressSynchronously(
           new Runnable() {
             public void run() {
               final PsiClass superClass =
                   mySubclass.getExtendsListTypes().length > 0 ? mySubclass.getSuperClass() : null;
               conflicts.putAllValues(
                   PullUpConflictsUtil.checkConflicts(
                       infos,
                       mySubclass,
                       superClass,
                       targetPackage,
                       targetDirectory,
                       dialog.getContainmentVerifier(),
                       false));
             }
           },
           RefactoringBundle.message("detecting.possible.conflicts"),
           true,
           myProject)) return false;
   ExtractSuperClassUtil.checkSuperAccessible(targetDirectory, conflicts, mySubclass);
   return ExtractSuperClassUtil.showConflicts(dialog, conflicts, myProject);
 }
  public Object deserializeInto(@NotNull Object result, @NotNull Element element) {
    Set<Binding> bindings = myPropertyBindings.keySet();
    MultiMap<Binding, Object> data = MultiMap.createSmartList();
    nextNode:
    for (Object child : ContainerUtil.concat(element.getContent(), element.getAttributes())) {
      if (XmlSerializerImpl.isIgnoredNode(child)) {
        continue;
      }

      for (Binding binding : bindings) {
        if (binding.isBoundTo(child)) {
          data.putValue(binding, child);
          continue nextNode;
        }
      }

      final String message = "Format error: no binding for " + child + " inside " + this;
      LOG.debug(message);
      Logger.getInstance(myBeanClass.getName()).debug(message);
      Logger.getInstance("#" + myBeanClass.getName()).debug(message);
    }

    for (Binding binding : data.keySet()) {
      binding.deserialize(result, ArrayUtil.toObjectArray(data.get(binding)));
    }

    return result;
  }
    public Object[] get(final PsiElement context, CompletionContext completionContext) {
      XmlFile containingFile = null;
      XmlFile descriptorFile = null;
      final XmlTag tag = PsiTreeUtil.getParentOfType(context, XmlTag.class);

      if (tag != null) {
        containingFile = (XmlFile) tag.getContainingFile();
        descriptorFile = findDescriptorFile(tag, containingFile);
      } else {
        final XmlDocument document = PsiTreeUtil.getParentOfType(context, XmlDocument.class);

        if (document != null) {
          containingFile = (XmlFile) document.getContainingFile();

          final FileType ft = containingFile.getFileType();

          if (ft != StdFileTypes.XML) {
            final String namespace =
                ft == StdFileTypes.XHTML || ft == StdFileTypes.JSPX
                    ? XmlUtil.XHTML_URI
                    : XmlUtil.HTML_URI;
            final XmlNSDescriptor nsDescriptor = document.getDefaultNSDescriptor(namespace, true);

            if (nsDescriptor != null) {
              descriptorFile = nsDescriptor.getDescriptorFile();
            }
          }
        }
      }

      if (descriptorFile != null) {
        final List<Object> results = new ArrayList<Object>();
        final boolean acceptSystemEntities = containingFile.getFileType() == StdFileTypes.XML;

        final PsiElementProcessor processor =
            new PsiElementProcessor() {
              public boolean execute(@NotNull final PsiElement element) {
                if (element instanceof XmlEntityDecl) {
                  final XmlEntityDecl xmlEntityDecl = (XmlEntityDecl) element;
                  if (xmlEntityDecl.isInternalReference() || acceptSystemEntities) {
                    final String name = xmlEntityDecl.getName();
                    final Object _item = getLookupItem(xmlEntityDecl);
                    results.add(_item == null ? name : _item);
                  }
                }
                return true;
              }
            };

        XmlUtil.processXmlElements(descriptorFile, processor, true);
        if (descriptorFile != containingFile && containingFile.getFileType() == StdFileTypes.XML) {
          final XmlProlog element = containingFile.getDocument().getProlog();
          if (element != null) XmlUtil.processXmlElements(element, processor, true);
        }

        return ArrayUtil.toObjectArray(results);
      }

      return ArrayUtil.EMPTY_OBJECT_ARRAY;
    }
  @Override
  @Nullable
  public Object deserialize(Object o, @NotNull Object... nodes) {
    assert nodes.length > 0;
    Object[] children;
    if (nodes.length == 1) {
      children = JDOMUtil.getContent((Element) nodes[0]);
    } else {
      String name = ((Element) nodes[0]).getName();
      List<Content> childrenList = new SmartList<Content>();
      for (Object node : nodes) {
        assert ((Element) node).getName().equals(name);
        childrenList.addAll(((Element) node).getContent());
      }
      children = ArrayUtil.toObjectArray(childrenList);
    }

    if (children.length == 0) {
      children = new Object[] {new Text(myTagAnnotation.textIfEmpty())};
    }

    assert myBinding != null;
    Object v = myBinding.deserialize(myAccessor.read(o), children);
    Object value = XmlSerializerImpl.convert(v, myAccessor.getValueClass());
    myAccessor.write(o, value);
    return o;
  }
  @NotNull
  public static Object[] getCurrentModalEntities() {
    ApplicationManager.getApplication().assertIsDispatchThread();
    // TODO!
    // LOG.assertTrue(IdeEventQueue.getInstance().isInInputEvent() || isInMyRunnable());

    return ArrayUtil.toObjectArray(ourModalEntities);
  }
    public SimpleNode[] getChildren() {
      final List<SimpleNode> nodes = new ArrayList<SimpleNode>();

      for (final VirtualFilePointer file : mySet.getFiles()) {
        nodes.add(new ConfigFileNode(file, this));
      }
      return ArrayUtil.toObjectArray(nodes, SimpleNode.class);
    }
 @Override
 public void calcData(DataKey key, DataSink sink) {
   super.calcData(key, sink);
   if (key.equals(PlatformDataKeys.DELETE_ELEMENT_PROVIDER) && myDeleteProvider != null) {
     sink.put(key, myDeleteProvider);
   } else if (key.equals(CommonDataKeys.VIRTUAL_FILE_ARRAY)) {
     sink.put(key, ArrayUtil.toObjectArray(getSelectedChanges(), VirtualFile.class));
   }
 }
 @Override
 public Object[] getChildElements(Object element) {
   if (element == RootDescriptor.ROOT) {
     return ArrayUtil.toStringArray(myCertificates.keySet());
   } else if (element instanceof String) {
     return ArrayUtil.toObjectArray(myCertificates.get((String) element));
   }
   return ArrayUtil.EMPTY_OBJECT_ARRAY;
 }
  public Object serialize(Object o, Object context, SerializationFilter filter) {
    Map map = (Map) o;

    Element m;

    if (myMapAnnotation == null || myMapAnnotation.surroundWithTag()) {
      m = new Element(Constants.MAP);
    } else {
      m = (Element) context;
    }

    final Set keySet = map.keySet();
    final Object[] keys = ArrayUtil.toObjectArray(keySet);

    if (myMapAnnotation == null || myMapAnnotation.sortBeforeSave()) {
      Arrays.sort(keys, KEY_COMPARATOR);
    }

    for (Object k : keys) {
      Object v = map.get(k);

      Element entry = new Element(getEntryAttributeName());
      m.addContent(entry);

      Object kNode = myKeyBinding.serialize(k, entry, filter);

      if (kNode instanceof Text) {
        Text text = (Text) kNode;
        entry.setAttribute(getKeyAttributeValue(), text.getText());
      } else {
        if (myMapAnnotation != null && !myMapAnnotation.surroundKeyWithTag()) {
          entry.addContent((Content) kNode);
        } else {
          Element key = new Element(getKeyAttributeValue());
          entry.addContent(key);
          key.addContent((Content) kNode);
        }
      }

      Object vNode = myValueBinding.serialize(v, entry, filter);
      if (vNode instanceof Text) {
        Text text = (Text) vNode;
        entry.setAttribute(getValueAttributeName(), text.getText());
      } else {
        if (myMapAnnotation != null && !myMapAnnotation.surroundValueWithTag()) {
          entry.addContent((Element) vNode);
        } else {
          Element value = new Element(getValueAttributeName());
          entry.addContent(value);
          value.addContent((Content) vNode);
        }
      }
    }

    return m;
  }
 public SimpleNode[] getChildren() {
   final List<SimpleNode> nodes = new ArrayList<SimpleNode>(myBuffer.size());
   for (final OfbizFileSet entry : myBuffer) {
     if (!entry.isRemoved()) {
       final FileSetNode setNode = new FileSetNode(entry);
       nodes.add(setNode);
     }
   }
   return ArrayUtil.toObjectArray(nodes, SimpleNode.class);
 }
 @Override
 public Object[] getCompletionVariants(
     String completionPrefix, PsiElement location, ProcessingContext context) {
   List<Object> result = new ArrayList<Object>();
   Collections.addAll(result, super.getCompletionVariants(completionPrefix, location, context));
   for (String field : myFields) {
     result.add(LookupElementBuilder.create(field));
   }
   return ArrayUtil.toObjectArray(result);
 }
Beispiel #14
0
  @NotNull
  @Override
  public AnAction[] createConsoleActions() {
    List<AnAction> actions = Lists.newArrayList();
    actions.addAll(Arrays.asList(myPrimaryConsoleView.createConsoleActions()));

    actions.add(mySwitchConsoleAction);

    return ArrayUtil.toObjectArray(actions, AnAction.class);
  }
  private ActionCallback processAjusted(
      final Map<Object, Condition> adjusted, final Set<Object> originallySelected) {
    final ActionCallback result = new ActionCallback();

    final Set<Object> allSelected = myUi.getSelectedElements();

    Set<Object> toSelect = new HashSet<Object>();
    for (Map.Entry<Object, Condition> entry : adjusted.entrySet()) {
      if (entry.getValue().value(entry.getKey())) continue;

      for (final Object eachSelected : allSelected) {
        if (isParentOrSame(entry.getKey(), eachSelected)) continue;
        toSelect.add(entry.getKey());
      }
      if (allSelected.isEmpty()) {
        toSelect.add(entry.getKey());
      }
    }

    final Object[] newSelection = ArrayUtil.toObjectArray(toSelect);

    if (newSelection.length > 0) {
      myUi._select(
          newSelection,
          new Runnable() {
            @Override
            public void run() {
              final Set<Object> hangByParent = new HashSet<Object>();
              processUnsuccessfulSelections(
                  newSelection,
                  new Function<Object, Object>() {
                    @Override
                    public Object fun(final Object o) {
                      if (myUi.isInStructure(o) && !adjusted.get(o).value(o)) {
                        hangByParent.add(o);
                      } else {
                        addAdjustedSelection(o, adjusted.get(o), null);
                      }
                      return null;
                    }
                  },
                  originallySelected);

              processHangByParent(hangByParent).notify(result);
            }
          },
          false,
          true,
          true);
    } else {
      result.setDone();
    }

    return result;
  }
 @NotNull
 private ActionGroup createActionGroup(
     @NotNull GitFileRevision rev,
     @NotNull FilePath filePath,
     @NotNull Collection<GitFileRevision> parents) {
   Collection<AnAction> actions = new ArrayList<AnAction>(2);
   for (GitFileRevision parent : parents) {
     actions.add(createParentAction(rev, filePath, parent));
   }
   return new DefaultActionGroup(ArrayUtil.toObjectArray(actions, AnAction.class));
 }
 @Override
 protected ExtractSuperBaseProcessor createProcessor() {
   return new ExtractSuperClassProcessor(
       myProject,
       getTargetDirectory(),
       getExtractedSuperName(),
       mySourceClass,
       ArrayUtil.toObjectArray(getSelectedMemberInfos(), MemberInfo.class),
       false,
       new DocCommentPolicy(getDocCommentPolicy()));
 }
    public Object[] get(final PsiElement context, CompletionContext completionContext) {
      XmlTag tag = PsiTreeUtil.getParentOfType(context, XmlTag.class, false);
      if (tag != null) {
        final XmlTag simpleContent = XmlUtil.getSchemaSimpleContent(tag);
        if (simpleContent != null) {
          final HashSet<String> variants = new HashSet<String>();
          XmlUtil.collectEnumerationValues(simpleContent, variants);
          return ArrayUtil.toObjectArray(variants);
        }
      }

      return ArrayUtil.EMPTY_OBJECT_ARRAY;
    }
  public Object[] getParametersForLookup(LookupElement item, ParameterInfoContext context) {
    final Object o = item.getObject();
    if (o instanceof PsiElement) {
      PsiElement element = (PsiElement) o;

      List<PsiElement> methods = new ArrayList<PsiElement>();
      if (element instanceof CfmlFunction || element instanceof PsiMethod) {
        methods.add(element);
      }
      return ArrayUtil.toObjectArray(methods);
    }
    return ArrayUtil.EMPTY_OBJECT_ARRAY;
  }
 @NotNull
 @Override
 public Object[] getElementsByName(
     String name, boolean checkBoxState, String pattern, @NotNull ProgressIndicator canceled) {
   List<T> classes =
       myTreeClassChooserDialog.getClassesByName(
           name, checkBoxState, pattern, myTreeClassChooserDialog.getScope());
   if (classes.size() == 0) return ArrayUtil.EMPTY_OBJECT_ARRAY;
   if (classes.size() == 1) {
     return isAccepted(classes.get(0))
         ? ArrayUtil.toObjectArray(classes)
         : ArrayUtil.EMPTY_OBJECT_ARRAY;
   }
   Set<String> qNames = ContainerUtil.newHashSet();
   List<T> list = new ArrayList<T>(classes.size());
   for (T aClass : classes) {
     if (qNames.add(getFullName(aClass)) && isAccepted(aClass)) {
       list.add(aClass);
     }
   }
   return ArrayUtil.toObjectArray(list);
 }
 @Override
 public Configurable[] getConfigurables() {
   if (!isInitialized) {
     ArrayList<Configurable> list = new ArrayList<Configurable>();
     if (super.myEp.dynamic) {
       Composite composite = cast(Composite.class, this);
       if (composite != null) {
         Collections.addAll(list, composite.getConfigurables());
       }
     }
     if (super.myEp.children != null) {
       for (ConfigurableEP ep : super.myEp.getChildren()) {
         if (ep.isAvailable()) {
           list.add((Configurable) wrapConfigurable(ep));
         }
       }
     }
     if (super.myEp.childrenEPName != null) {
       Object[] extensions =
           Extensions.getArea(super.myEp.getProject())
               .getExtensionPoint(super.myEp.childrenEPName)
               .getExtensions();
       if (extensions.length > 0) {
         if (extensions[0] instanceof ConfigurableEP) {
           for (Object object : extensions) {
             list.add((Configurable) wrapConfigurable((ConfigurableEP) object));
           }
         } else if (!super.myEp.dynamic) {
           Composite composite = cast(Composite.class, this);
           if (composite != null) {
             Collections.addAll(list, composite.getConfigurables());
           }
         }
       }
     }
     Collections.addAll(list, myKids);
     // sort configurables is needed
     for (Configurable configurable : list) {
       if (configurable instanceof Weighted) {
         if (((Weighted) configurable).getWeight() != 0) {
           myComparator = COMPARATOR;
           Collections.sort(list, myComparator);
           break;
         }
       }
     }
     myKids = ArrayUtil.toObjectArray(list, Configurable.class);
     isInitialized = true;
   }
   return myKids;
 }
 private Object[] getSelectedNodeElements() {
   final FavoritesTreeNodeDescriptor[] selectedNodeDescriptors = getSelectedNodeDescriptors();
   ArrayList<Object> result = new ArrayList<Object>();
   for (FavoritesTreeNodeDescriptor selectedNodeDescriptor : selectedNodeDescriptors) {
     if (selectedNodeDescriptor != null) {
       Object value = selectedNodeDescriptor.getElement().getValue();
       if (value instanceof SmartPsiElementPointer) {
         value = ((SmartPsiElementPointer) value).getElement();
       }
       result.add(value);
     }
   }
   return ArrayUtil.toObjectArray(result);
 }
  public Object[] getSelectedElements() {
    ParameterInfoContext context =
        new ParameterInfoContext() {
          @Override
          public Project getProject() {
            return myProject;
          }

          @Override
          public PsiFile getFile() {
            return myComponent.getParameterOwner().getContainingFile();
          }

          @Override
          public int getOffset() {
            return myEditor.getCaretModel().getOffset();
          }

          @Override
          @NotNull
          public Editor getEditor() {
            return myEditor;
          }
        };

    if (!myHandler.tracksParameterIndex()) {
      return myHandler.getParametersForDocumentation(myComponent.getObjects()[0], context);
    }

    final Object[] objects = myComponent.getObjects();
    int selectedParameterIndex = myComponent.getCurrentParameterIndex();
    List<Object> params = new ArrayList<>(objects.length);

    final Object highlighted = myComponent.getHighlighted();
    for (Object o : objects) {
      if (highlighted != null && !o.equals(highlighted)) continue;
      collectParams(context, selectedParameterIndex, params, o);
    }

    // choose anything when highlighted is not applicable
    if (highlighted != null && params.isEmpty()) {
      for (Object o : objects) {
        collectParams(context, selectedParameterIndex, params, o);
      }
    }

    return ArrayUtil.toObjectArray(params);
  }
 @NotNull
 public final Object[] getSelectedElements() {
   TreePath[] paths = getSelectionPaths();
   if (paths == null) return PsiElement.EMPTY_ARRAY;
   ArrayList<Object> list = new ArrayList<Object>(paths.length);
   for (TreePath path : paths) {
     Object lastPathComponent = path.getLastPathComponent();
     Object element = getElementFromTreeNode(lastPathComponent);
     if (element instanceof Object[]) {
       Collections.addAll(list, (Object[]) element);
     } else if (element != null) {
       list.add(element);
     }
   }
   return ArrayUtil.toObjectArray(list);
 }
  // invoked inside Command and Atomic action
  private void doRefactoring(
      final Project project, final PsiClass subclass, final ExtractSuperclassDialog dialog) {
    final String superclassName = dialog.getExtractedSuperName();
    final PsiDirectory targetDirectory = dialog.getTargetDirectory();
    final MemberInfo[] selectedMemberInfos =
        ArrayUtil.toObjectArray(dialog.getSelectedMemberInfos(), MemberInfo.class);
    final DocCommentPolicy javaDocPolicy = new DocCommentPolicy(dialog.getDocCommentPolicy());
    LocalHistoryAction a =
        LocalHistory.getInstance().startAction(getCommandName(subclass, superclassName));
    try {
      final PsiClass superclass;

      try {
        superclass =
            ExtractSuperClassUtil.extractSuperClass(
                project,
                targetDirectory,
                superclassName,
                subclass,
                selectedMemberInfos,
                javaDocPolicy);
      } finally {
        a.finish();
      }

      // ask whether to search references to subclass and turn them into refs to superclass if
      // possible
      if (superclass != null) {
        final SmartPsiElementPointer<PsiClass> classPointer =
            SmartPointerManager.getInstance(project).createSmartPsiElementPointer(subclass);
        final SmartPsiElementPointer<PsiClass> interfacePointer =
            SmartPointerManager.getInstance(project).createSmartPsiElementPointer(superclass);
        final Runnable turnRefsToSuperRunnable =
            new Runnable() {
              public void run() {
                ExtractClassUtil.askAndTurnRefsToSuper(project, classPointer, interfacePointer);
              }
            };
        SwingUtilities.invokeLater(turnRefsToSuperRunnable);
      }
    } catch (IncorrectOperationException e) {
      LOG.error(e);
    }
  }
    GitCheckinOptions(@NotNull final Project project, @NotNull CheckinProjectPanel panel) {
      super(project, panel);
      myVcs = GitVcs.getInstance(project);
      final Insets insets = new Insets(2, 2, 2, 2);
      // add authors drop down
      GridBagConstraints c = new GridBagConstraints();
      c.gridx = 0;
      c.gridy = 0;
      c.anchor = GridBagConstraints.WEST;
      c.insets = insets;
      final JLabel authorLabel = new JLabel(GitBundle.message("commit.author"));
      myPanel.add(authorLabel, c);

      c = new GridBagConstraints();
      c.anchor = GridBagConstraints.CENTER;
      c.insets = insets;
      c.gridx = 1;
      c.gridy = 0;
      c.weightx = 1;
      c.fill = GridBagConstraints.HORIZONTAL;
      final List<String> usersList = getUsersList(project);
      final Set<String> authors =
          usersList == null ? new HashSet<String>() : new HashSet<String>(usersList);
      ContainerUtil.addAll(authors, mySettings.getCommitAuthors());
      List<String> list = new ArrayList<String>(authors);
      Collections.sort(list);
      list =
          ObjectsConvertor.convert(
              list,
              new Convertor<String, String>() {
                @Override
                public String convert(String o) {
                  return StringUtil.shortenTextWithEllipsis(o, 30, 0);
                }
              });
      myAuthor = new ComboBox(ArrayUtil.toObjectArray(list));
      myAuthor.insertItemAt("", 0);
      myAuthor.setSelectedItem("");
      myAuthor.setEditable(true);
      authorLabel.setLabelFor(myAuthor);
      myAuthor.setToolTipText(GitBundle.getString("commit.author.tooltip"));
      myPanel.add(myAuthor, c);
    }
  private static Object[] convertPathsToValues(TreePath[] selectionPaths) {
    if (selectionPaths != null) {
      List<Object> result = new ArrayList<Object>();

      for (TreePath selectionPath : selectionPaths) {
        final Object userObject =
            ((DefaultMutableTreeNode) selectionPath.getLastPathComponent()).getUserObject();
        if (userObject instanceof AbstractTreeNode) {
          Object value = ((AbstractTreeNode) userObject).getValue();
          if (value instanceof StructureViewTreeElement) {
            value = ((StructureViewTreeElement) value).getValue();
          }
          result.add(value);
        }
      }
      return ArrayUtil.toObjectArray(result);
    } else {
      return null;
    }
  }
  private static int doPrint(
      StringBuilder buffer,
      int currentLevel,
      Object node,
      AbstractTreeStructure structure,
      @Nullable Comparator comparator,
      int maxRowCount,
      int currentLine,
      char paddingChar,
      @Nullable Queryable.PrintInfo printInfo) {
    if (currentLine >= maxRowCount && maxRowCount != -1) return currentLine;

    StringUtil.repeatSymbol(buffer, paddingChar, currentLevel);
    buffer.append(toString(node, printInfo)).append("\n");
    currentLine++;
    Object[] children = structure.getChildElements(node);

    if (comparator != null) {
      ArrayList<?> list = new ArrayList<Object>(Arrays.asList(children));
      @SuppressWarnings({"UnnecessaryLocalVariable", "unchecked"})
      Comparator<Object> c = comparator;
      Collections.sort(list, c);
      children = ArrayUtil.toObjectArray(list);
    }
    for (Object child : children) {
      currentLine =
          doPrint(
              buffer,
              currentLevel + 1,
              child,
              structure,
              comparator,
              maxRowCount,
              currentLine,
              paddingChar,
              printInfo);
    }

    return currentLine;
  }
  @NotNull
  @Override
  public Object[] getVariants() {
    if (PsiTreeUtil.getParentOfType(myElement, ErlangArgumentDefinition.class) != null)
      return new Object[] {};

    final List<LookupElement> result = new ArrayList<LookupElement>();
    if (!(myElement.getParent() instanceof ErlangRecordExpression)) {
      final ErlangFunctionClause clause =
          PsiTreeUtil.getParentOfType(myElement, ErlangFunctionClause.class);
      BaseScopeProcessor processor =
          new BaseScopeProcessor() {
            @Override
            public boolean execute(@NotNull PsiElement psiElement, ResolveState resolveState) {
              if (!psiElement.equals(myElement)
                  && psiElement instanceof ErlangQVar
                  && !psiElement.getText().equals("_")
                  && !inColonQualified(myElement)) {
                if (PsiTreeUtil.isAncestor(clause, psiElement, false)
                    && (inDefinition(psiElement) || isLeftPartOfAssignment(psiElement))) {
                  result.add(
                      LookupElementBuilder.create((PsiNamedElement) psiElement)
                          .setIcon(ErlangIcons.VARIABLE));
                }
              }
              return true;
            }
          };
      ResolveUtil.treeWalkUp(myElement, processor);

      result.addAll(
          ErlangPsiImplUtil.getFunctionLookupElements(
              myElement.getContainingFile(),
              false,
              PsiTreeUtil.getParentOfType(myElement, ErlangColonQualifiedExpression.class)));
    }

    return ArrayUtil.toObjectArray(result);
  }
 private void createUIComponents() {
   myRepositoryURL = new EditorComboBox("");
   final GitRememberedInputs rememberedInputs = GitRememberedInputs.getInstance();
   myRepositoryURL.setHistory(
       ArrayUtil.toObjectArray(rememberedInputs.getVisitedUrls(), String.class));
   myRepositoryURL.addDocumentListener(
       new com.intellij.openapi.editor.event.DocumentAdapter() {
         @Override
         public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) {
           // enable test button only if something is entered in repository URL
           final String url = getCurrentUrlText();
           myTestButton.setEnabled(url.length() != 0);
           if (myDefaultDirectoryName.equals(myDirectoryName.getText())
               || myDirectoryName.getText().length() == 0) {
             // modify field if it was unmodified or blank
             myDefaultDirectoryName = defaultDirectoryName(url);
             myDirectoryName.setText(myDefaultDirectoryName);
           }
           updateButtons();
         }
       });
 }