@Override
 public void cleanup() {
   myOpenProjectSettingsAfter = false;
   myProjectRoot = null;
   myFoundOtpApps = Collections.emptyList();
   mySelectedOtpApps = Collections.emptyList();
 }
  @NotNull
  @Override
  public Collection<String> suggestHomePaths() {
    if (!SystemInfo.isWindows) return Collections.singletonList(suggestHomePath());

    String property = System.getProperty("java.home");
    if (property == null) return Collections.emptyList();

    File javaHome = new File(property).getParentFile(); // actually java.home points to to jre home
    if (javaHome == null || !javaHome.isDirectory() || javaHome.getParentFile() == null) {
      return Collections.emptyList();
    }
    ArrayList<String> result = new ArrayList<>();
    File javasFolder = javaHome.getParentFile();
    scanFolder(javasFolder, result);
    File parentFile = javasFolder.getParentFile();
    File root = parentFile != null ? parentFile.getParentFile() : null;
    String name = parentFile != null ? parentFile.getName() : "";
    if (name.contains("Program Files") && root != null) {
      String x86Suffix = " (x86)";
      boolean x86 = name.endsWith(x86Suffix) && name.length() > x86Suffix.length();
      File anotherJavasFolder;
      if (x86) {
        anotherJavasFolder = new File(root, name.substring(0, name.length() - x86Suffix.length()));
      } else {
        anotherJavasFolder = new File(root, name + x86Suffix);
      }
      if (anotherJavasFolder.isDirectory()) {
        scanFolder(new File(anotherJavasFolder, javasFolder.getName()), result);
      }
    }
    return result;
  }
  private RepositoryChangesBrowser createRepositoryChangesBrowser(final Project project) {
    TableView<ChangeInfo> table = changeListPanel.getTable();

    RepositoryChangesBrowser repositoryChangesBrowser =
        new RepositoryChangesBrowser(
            project,
            Collections.<CommittedChangeList>emptyList(),
            Collections.<Change>emptyList(),
            null);
    repositoryChangesBrowser
        .getDiffAction()
        .registerCustomShortcutSet(CommonShortcuts.getDiff(), table);
    repositoryChangesBrowser
        .getViewer()
        .setScrollPaneBorder(IdeBorderFactory.createBorder(SideBorder.LEFT | SideBorder.TOP));

    changeListPanel.addListSelectionListener(
        new Consumer<ChangeInfo>() {
          @Override
          public void consume(ChangeInfo changeInfo) {
            changeSelected(changeInfo, project);
          }
        });
    return repositoryChangesBrowser;
  }
  private static List<XmlElementDescriptor> computeRequiredSubTags(XmlElementsGroup group) {

    if (group.getMinOccurs() < 1) return Collections.emptyList();
    switch (group.getGroupType()) {
      case LEAF:
        XmlElementDescriptor descriptor = group.getLeafDescriptor();
        return descriptor == null
            ? Collections.<XmlElementDescriptor>emptyList()
            : Collections.singletonList(descriptor);
      case CHOICE:
        LinkedHashSet<XmlElementDescriptor> set = null;
        for (XmlElementsGroup subGroup : group.getSubGroups()) {
          List<XmlElementDescriptor> descriptors = computeRequiredSubTags(subGroup);
          if (set == null) {
            set = new LinkedHashSet<XmlElementDescriptor>(descriptors);
          } else {
            set.retainAll(descriptors);
          }
        }
        if (set == null || set.isEmpty()) {
          return Collections.singletonList(null); // placeholder for smart completion
        }
        return new ArrayList<XmlElementDescriptor>(set);

      default:
        ArrayList<XmlElementDescriptor> list = new ArrayList<XmlElementDescriptor>();
        for (XmlElementsGroup subGroup : group.getSubGroups()) {
          list.addAll(computeRequiredSubTags(subGroup));
        }
        return list;
    }
  }
Beispiel #5
0
  /**
   * Constructs a new game.
   *
   * @param web <code>true</code> if this game is meant to be an applet (which can be played
   *     online), and <code>false</code> otherwise. Note: this doesn't work yet.
   */
  public Game() {
    Game.applet = false;
    canvas = new Canvas(this);
    solidShapes = Collections.newSetFromMap(new ConcurrentHashMap<Shape, Boolean>());
    allShapes = Collections.newSetFromMap(new ConcurrentHashMap<Shape, Boolean>());

    // TODO: sort out which data structures actually have to support concurrency
    layerContents = new ConcurrentHashMap<Integer, java.util.List<Shape>>();
    layers = new CopyOnWriteArrayList<Integer>();
    layerOf = new ConcurrentHashMap<Shape, Integer>();

    counters = new ArrayList<Counter>();

    Mouse mouse = new Mouse();
    if (applet) {
      addMouseMotionListener(mouse);
      addMouseListener(mouse);
      addKeyListener(new Keyboard());
    } else {
      frame = new JFrame();
      frame.addMouseMotionListener(mouse);
      frame.addMouseListener(mouse);
      frame.addKeyListener(new Keyboard());
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    setDefaults();
  }
  @NotNull
  public static List<SymfonyInstallerVersion> getVersions(@NotNull String jsonContent) {

    JsonObject jsonObject = new JsonParser().parse(jsonContent).getAsJsonObject();

    List<SymfonyInstallerVersion> symfonyInstallerVersions = new ArrayList<>();

    // prevent adding duplicate version on alias names
    Set<String> aliasBranches = new HashSet<>();

    // get alias version, in most common order
    for (String s : new String[] {"latest", "lts"}) {
      JsonElement asJsonObject = jsonObject.get(s);
      if (asJsonObject == null) {
        continue;
      }

      String asString = asJsonObject.getAsString();
      aliasBranches.add(asString);

      symfonyInstallerVersions.add(
          new SymfonyInstallerVersion(s, String.format("%s (%s)", asString, s)));
    }

    List<SymfonyInstallerVersion> branches = new ArrayList<>();
    Set<Map.Entry<String, JsonElement>> entries = jsonObject.entrySet();
    for (Map.Entry<String, JsonElement> entry : entries) {
      if (!entry.getKey().matches("^\\d+\\.\\d+$")) {
        continue;
      }

      // "2.8.0-dev", "2.8.0-DEV" is not supported
      String asString = entry.getValue().getAsString();
      if (asString.matches(".*[a-zA-Z].*") || aliasBranches.contains(asString)) {
        continue;
      }

      branches.add(
          new SymfonyInstallerVersion(
              asString, String.format("%s (%s)", entry.getKey(), asString)));
    }

    branches.sort(Comparator.comparing(SymfonyInstallerVersion::getVersion));

    Collections.reverse(branches);

    symfonyInstallerVersions.addAll(branches);

    // we need reverse order for sorting them on version string
    List<SymfonyInstallerVersion> installableVersions = new ArrayList<>();
    for (JsonElement installable : jsonObject.getAsJsonArray("installable")) {
      installableVersions.add(new SymfonyInstallerVersion(installable.getAsString()));
    }
    Collections.reverse(installableVersions);

    symfonyInstallerVersions.addAll(installableVersions);
    return symfonyInstallerVersions;
  }
  private void sortList(List<PatientModel> list) {

    boolean sorted = true;
    for (int i = 0; i < COLUMN_NAMES.length; i++) {
      if (sorter.getSortingStatus(i) == 0) {
        Log.outputFuncLog(
            Log.LOG_LEVEL_0, Log.FUNCTIONLOG_KIND_INFORMATION, "ソート済み", String.valueOf(i));
        sorted = false;
        break;
      }
    }

    if (!sorted) {

      switch (sortItem) {
        case 0:
          Log.outputFuncLog(Log.LOG_LEVEL_0, Log.FUNCTIONLOG_KIND_INFORMATION, "患者IDでソート");
          Comparator c =
              new Comparator<PatientModel>() {

                @Override
                public int compare(PatientModel o1, PatientModel o2) {
                  return o1.getPatientId().compareTo(o2.getPatientId());
                }
              };
          Collections.sort(list, c);
          break;
        case 1:
          Log.outputFuncLog(Log.LOG_LEVEL_0, Log.FUNCTIONLOG_KIND_INFORMATION, "患者カナでソート");
          Comparator c2 =
              new Comparator<PatientModel>() {

                @Override
                public int compare(PatientModel p1, PatientModel p2) {
                  String kana1 = p1.getKanaName();
                  String kana2 = p2.getKanaName();
                  if (kana1 != null && kana2 != null) {
                    return p1.getKanaName().compareTo(p2.getKanaName());
                  } else if (kana1 != null && kana2 == null) {
                    return -1;
                  } else if (kana1 == null && kana2 != null) {
                    return 1;
                  } else {
                    return 0;
                  }
                }
              };
          Collections.sort(list, c2);
          break;
      }
    }
  }
    @NotNull
    @Override
    public Collection<VcsRef> getItems(
        String prefix, boolean cached, CompletionParameters parameters) {
      if (prefix == null) {
        return Collections.emptyList();
      }

      List<VcsRef> items = new ArrayList<VcsRef>(getMatched(myVariants, prefix));
      Collections.sort(items, this);

      return items;
    }
 @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;
 }
  @NotNull
  public List<Pair<TaskInfo, ProgressIndicator>> getBackgroundProcesses() {
    synchronized (myOriginals) {
      if (myOriginals.isEmpty()) return Collections.emptyList();

      List<Pair<TaskInfo, ProgressIndicator>> result =
          new ArrayList<Pair<TaskInfo, ProgressIndicator>>(myOriginals.size());
      for (int i = 0; i < myOriginals.size(); i++) {
        result.add(Pair.<TaskInfo, ProgressIndicator>create(myInfos.get(i), myOriginals.get(i)));
      }

      return Collections.unmodifiableList(result);
    }
  }
  private void replaceUsagesUnderCommand(
      @NotNull final ReplaceContext replaceContext, @Nullable final Set<Usage> usagesSet) {
    if (usagesSet == null) {
      return;
    }

    final List<Usage> usages = new ArrayList<Usage>(usagesSet);
    Collections.sort(usages, UsageViewImpl.USAGE_COMPARATOR);

    if (!ensureUsagesWritable(replaceContext, usages)) return;

    CommandProcessor.getInstance()
        .executeCommand(
            myProject,
            new Runnable() {
              @Override
              public void run() {
                final boolean success = replaceUsages(replaceContext, usages);
                final UsageView usageView = replaceContext.getUsageView();

                if (closeUsageViewIfEmpty(usageView, success)) return;
                usageView.getComponent().requestFocus();
              }
            },
            FindBundle.message("find.replace.command"),
            null);

    replaceContext.invalidateExcludedSetCache();
  }
  /**
   * @param type
   * @param min
   * @param createDef
   * @param manager - must not be null if min is not null
   * @param scope - must not be null if min is not null
   */
  private GrTypeComboBox(
      @Nullable PsiType type,
      @Nullable PsiType min,
      boolean createDef,
      @Nullable PsiManager manager,
      @Nullable GlobalSearchScope scope) {
    LOG.assertTrue(min == null || manager != null);
    LOG.assertTrue(min == null || scope != null);

    if (type instanceof PsiDisjunctionType) type = ((PsiDisjunctionType) type).getLeastUpperBound();

    Map<String, PsiType> types = Collections.emptyMap();
    if (type != null) {
      types = getCompatibleTypeNames(type, min, manager, scope);
    }

    if (createDef || types.isEmpty()) {
      addItem(new PsiTypeItem(null));
    }

    for (String typeName : types.keySet()) {
      addItem(new PsiTypeItem(types.get(typeName)));
    }

    if (createDef && getItemCount() > 1) {
      setSelectedIndex(1);
    }
  }
  /*-------------------------------------------------------------------------*/
  public FoeTypeSelection(int dirtyFlag) {
    this.dirtyFlag = dirtyFlag;
    List<String> foeTypesList =
        new ArrayList<String>(Database.getInstance().getFoeTypes().keySet());

    Collections.sort(foeTypesList);
    int max = foeTypesList.size();
    checkBoxes = new HashMap<String, JCheckBox>();

    JPanel panel = new JPanel(new GridLayout(max / 2 + 2, 2, 3, 3));

    selectAll = new JButton("Select All");
    selectAll.addActionListener(this);
    selectNone = new JButton("Select None");
    selectNone.addActionListener(this);

    panel.add(selectAll);
    panel.add(selectNone);

    for (String s : foeTypesList) {
      JCheckBox cb = new JCheckBox(s);
      checkBoxes.put(s, cb);
      cb.addActionListener(this);
      panel.add(cb);
    }

    JScrollPane scroller = new JScrollPane(panel);
    this.add(scroller);
  }
 /**
  * Prepare branch descriptors for existing configuration
  *
  * @param target the target
  * @param roots the vcs root
  * @return the list of branch descriptors
  * @throws VcsException in case of error
  */
 private List<BranchDescriptor> prepareBranchDescriptors(
     BranchConfiguration target, List<VirtualFile> roots) throws VcsException {
   Map<String, String> map =
       target == null ? Collections.<String, String>emptyMap() : target.getReferences();
   List<BranchDescriptor> rc = new ArrayList<BranchDescriptor>();
   for (VirtualFile root : roots) {
     BranchDescriptor d = new BranchDescriptor();
     d.root = root;
     d.storedReference = map.remove(root.getPath());
     if (d.storedReference != null) {
       d.storedRoot = d.root.getPath();
     }
     d.currentReference = myConfig.describeRoot(root);
     if (d.storedReference != null && !myModify) {
       d.referenceToCheckout = d.storedReference;
     } else {
       d.referenceToCheckout = d.currentReference;
     }
     Branch.listAsStrings(myProject, root, false, true, d.existingBranches, null);
     Branch.listAsStrings(myProject, root, true, true, d.referencesToSelect, null);
     d.updateStatus();
     rc.add(d);
   }
   for (Map.Entry<String, String> m : map.entrySet()) {
     String root = m.getKey();
     String ref = m.getValue();
     BranchDescriptor d = new BranchDescriptor();
     d.storedReference = ref;
     d.storedRoot = root;
     d.referenceToCheckout = ref;
     d.updateStatus();
     rc.add(d);
   }
   return rc;
 }
 public UpdateOrStatusOptionsDialog(Project project, Map<Configurable, AbstractVcs> confs) {
   super(project);
   setTitle(getRealTitle());
   myProject = project;
   if (confs.size() == 1) {
     myMainPanel = new JPanel(new BorderLayout());
     final Configurable configurable = confs.keySet().iterator().next();
     addComponent(confs.get(configurable), configurable, BorderLayout.CENTER);
     myMainPanel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH);
   } else {
     myMainPanel = new JBTabbedPane();
     final ArrayList<AbstractVcs> vcses = new ArrayList<>(confs.values());
     Collections.sort(
         vcses,
         new Comparator<AbstractVcs>() {
           public int compare(final AbstractVcs o1, final AbstractVcs o2) {
             return o1.getDisplayName().compareTo(o2.getDisplayName());
           }
         });
     Map<AbstractVcs, Configurable> vcsToConfigurable = revertMap(confs);
     for (AbstractVcs vcs : vcses) {
       addComponent(vcs, vcsToConfigurable.get(vcs), vcs.getDisplayName());
     }
   }
   init();
 }
Beispiel #16
0
 static {
   HashMap<String, TextAlign> m = new HashMap<String, TextAlign>();
   m.put("start", TextAlign.START);
   m.put("center", TextAlign.CENTER);
   m.put("end", TextAlign.END);
   SVG_TEXT_ALIGNS = Collections.unmodifiableMap(m);
 }
Beispiel #17
0
 // Metoden makeBoard - Skapar de grafiska komponenterna för spelplanen
 public void makeBoard() {
   int k = 0;
   // Laddar in bilderna för kortens baksida till programmet
   for (int j = 1; j < 33; j++) {
     for (int i = 0; i < 2; i++) {
       bilder.add(new ImageIcon("Memorypics/" + j + ".gif"));
     }
   }
   // Skapar korten med bilder och id, blandar sedan korten
   for (int i = 0; i < 64; i++) {
     cards.add(new Card(bilder.get(i), k));
     if (i % 2 == 1) {
       k++;
     }
     Collections.shuffle(cards);
   }
   // Lägger ut korten på spelplanen
   for (int i = 0; i < 64; i++) {
     panel.add(cards.get(i));
     cards.get(i).addActionListener(this);
     cards.get(i).setBorder(new LineBorder(Color.WHITE, 1));
     cards.get(i).pos = i;
   }
   // Lägger till labels för nick och poängställning
   for (int i = 0; i < players.size(); i++) {
     playerlabels.add(new JLabel(players.get(i).nick + ": "));
     scorelabels.add(new JLabel(players.get(i).score + ""));
     panel.add(playerlabels.get(i));
     panel.add(scorelabels.get(i));
   }
 }
  void handleScanFiles(JTextField field, String[] extensions) {
    String[] dataFiles = scanDataFolderForFilesByType(extensions);
    if (dataFiles == null || dataFiles.length == 0) return;

    String[] oldFileList = field.getText().trim().split(",");
    ArrayList<String> newFileList = new ArrayList<String>();
    for (String c : oldFileList) {
      c = c.trim();
      if (!c.equals("") && newFileList.indexOf(c) == -1) // TODO check exists() here?
      {
        newFileList.add(c);
      }
    }
    for (String c : dataFiles) {
      c = c.trim();
      if (!c.equals("") && newFileList.indexOf(c) == -1) {
        newFileList.add(c);
      }
    }
    Collections.sort(newFileList);
    String finalFileList = "";
    int i = 0;
    for (String s : newFileList) {
      finalFileList += (i > 0 ? ", " : "") + s;
      i++;
    }
    field.setText(finalFileList);
  }
 public List<BeforeRunTask> getTasks(boolean applyCurrentState) {
   if (applyCurrentState) {
     originalTasks.clear();
     originalTasks.addAll(myModel.getItems());
   }
   return Collections.unmodifiableList(originalTasks);
 }
Beispiel #20
0
 @Nullable
 public static TextRange findNext(
     @NotNull Editor editor,
     @NotNull String pattern,
     final int offset,
     boolean ignoreCase,
     final boolean forwards) {
   final List<TextRange> results =
       findAll(editor, pattern, 0, -1, shouldIgnoreCase(pattern, ignoreCase));
   if (results.isEmpty()) {
     return null;
   }
   final int size = EditorHelper.getFileSize(editor);
   final TextRange max =
       Collections.max(
           results,
           new Comparator<TextRange>() {
             @Override
             public int compare(TextRange r1, TextRange r2) {
               final int d1 = distance(r1, offset, forwards, size);
               final int d2 = distance(r2, offset, forwards, size);
               if (d1 < 0 && d2 >= 0) {
                 return Integer.MAX_VALUE;
               }
               return d2 - d1;
             }
           });
   if (!Options.getInstance().isSet("wrapscan")) {
     final int start = max.getStartOffset();
     if (forwards && start < offset || start >= offset) {
       return null;
     }
   }
   return max;
 }
  @NotNull
  private static List<VirtualFile> findClasses(File file, boolean isJre) {
    List<VirtualFile> result = ContainerUtil.newArrayList();
    VirtualFileManager fileManager = VirtualFileManager.getInstance();

    String path = file.getPath();
    if (JrtFileSystem.isModularJdk(path)) {
      String url =
          VirtualFileManager.constructUrl(
              JrtFileSystem.PROTOCOL,
              FileUtil.toSystemIndependentName(path) + JrtFileSystem.SEPARATOR);
      for (String module : JrtFileSystem.listModules(path)) {
        ContainerUtil.addIfNotNull(result, fileManager.findFileByUrl(url + module));
      }
    }

    for (File root : JavaSdkUtil.getJdkClassesRoots(file, isJre)) {
      String url = VfsUtil.getUrlForLibraryRoot(root);
      ContainerUtil.addIfNotNull(result, fileManager.findFileByUrl(url));
    }

    Collections.sort(result, (o1, o2) -> o1.getPath().compareTo(o2.getPath()));

    return result;
  }
  /** Shuffle the numbers on the buttons */
  private void shuffle() {
    // Randomize the order
    if (solution) solution = false;
    else Collections.shuffle(current);

    // Reset the stats
    moves = 0;
    solved = false;

    // Reset each of the buttons to reflect the randomized
    // order
    for (int i = 0; i < buttons.size(); i++) {
      JButton b = (JButton) buttons.get(i);
      String value = (String) current.get(i);
      int val = Integer.parseInt(value) - 1;
      b.setText(value);
      b.setBackground(java.awt.Color.orange);
      b.setIcon(icons[val]);
      if (value.equals("16")) {
        b.setVisible(false);
        hiddenIndex = i;
      } else {
        b.setVisible(true);
      }
    }

    // Reset the status line
    getStatusLabel().setText("Number of moves: " + moves);
  }
Beispiel #23
0
 private GroovyTreeNode(GroovyTreeNode parent, GroovyNode node) {
   this.parent = parent;
   this.node = node;
   for (Map.Entry<String, String> entry : node.attributes().entrySet()) {
     children.add(new GroovyTreeNode(this, entry.getKey(), entry.getValue()));
   }
   if (node.getNodeValue() instanceof List) {
     string = node.getNodeName();
     toolTip = String.format("Size: %d", ((List) node.getNodeValue()).size());
   } else {
     String truncated = node.text();
     if (truncated.contains("\n") || truncated.length() >= MAX_LENGTH) {
       int index = truncated.indexOf('\n');
       if (index > 0) truncated = truncated.substring(0, index);
       if (truncated.length() >= MAX_LENGTH) truncated = truncated.substring(0, MAX_LENGTH);
       string = String.format("<html><b>%s</b> = %s ...</html>", node.getNodeName(), truncated);
       toolTip = tameTooltipText(node.text());
     } else {
       string = String.format("<html><b>%s</b> = %s</html>", node.getNodeName(), truncated);
       toolTip = truncated;
     }
   }
   if (this.node.getNodeValue() instanceof List) {
     for (Object sub : ((List) this.node.getNodeValue())) {
       GroovyNode subnode = (GroovyNode) sub;
       children.add(new GroovyTreeNode(this, subnode));
     }
     Collections.sort(children);
   }
 }
  protected static class DaemonCodeAnalyzerStatus {
    public boolean errorAnalyzingFinished; // all passes done
    List<ProgressableTextEditorHighlightingPass> passStati = Collections.emptyList();
    public int[] errorCount = ArrayUtil.EMPTY_INT_ARRAY;
    private String reasonWhyDisabled;
    private String reasonWhySuspended;

    public DaemonCodeAnalyzerStatus() {}

    @Override
    public String toString() {
      @NonNls String s = "DS: finished=" + errorAnalyzingFinished;
      s += "; pass statuses: " + passStati.size() + "; ";
      for (ProgressableTextEditorHighlightingPass passStatus : passStati) {
        s +=
            String.format(
                "(%s %2.0f%% %b)",
                passStatus.getPresentableName(),
                passStatus.getProgress() * 100,
                passStatus.isFinished());
      }
      s += "; error count: " + errorCount.length + ": " + new TIntArrayList(errorCount);
      return s;
    }
  }
  @Override
  public void writeExternal(Element element) throws WriteExternalException {
    List<HighlightSeverity> list = getOrderAsList(getOrderMap());
    for (HighlightSeverity severity : list) {
      Element info = new Element(INFO_TAG);
      String severityName = severity.getName();
      final SeverityBasedTextAttributes infoType = getAttributesBySeverity(severity);
      if (infoType != null) {
        infoType.writeExternal(info);
        final Color color = myRendererColors.get(severityName);
        if (color != null) {
          info.setAttribute(COLOR_ATTRIBUTE, Integer.toString(color.getRGB() & 0xFFFFFF, 16));
        }
        element.addContent(info);
      }
    }

    if (myReadOrder != null && !myReadOrder.isEmpty()) {
      myReadOrder.writeExternal(element);
    } else if (!getDefaultOrder().equals(list)) {
      final JDOMExternalizableStringList ext =
          new JDOMExternalizableStringList(Collections.nCopies(getOrderMap().size(), ""));
      getOrderMap()
          .forEachEntry(
              new TObjectIntProcedure<HighlightSeverity>() {
                @Override
                public boolean execute(HighlightSeverity orderSeverity, int oIdx) {
                  ext.set(oIdx, orderSeverity.getName());
                  return true;
                }
              });
      ext.writeExternal(element);
    }
  }
  public DiffContentPanel(EditableDiffView master, boolean isFirst) {
    this.master = master;
    this.isFirst = isFirst;

    setLayout(new BorderLayout());

    editorPane = new DecoratedEditorPane(this);
    editorPane.setEditable(false);
    scrollPane = new JScrollPane(editorPane);
    add(scrollPane);

    linesActions = new LineNumbersActionsBar(this, master.isActionsEnabled());
    actionsScrollPane = new JScrollPane(linesActions);
    actionsScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    actionsScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    actionsScrollPane.setBorder(null);
    add(actionsScrollPane, isFirst ? BorderLayout.LINE_END : BorderLayout.LINE_START);

    editorPane.putClientProperty(DiffHighlightsLayerFactory.HIGHLITING_LAYER_ID, this);
    if (!isFirst) {
      // disable focus traversal, but permit just the up-cycle on ESC key
      editorPane.setFocusTraversalKeys(
          KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET);
      editorPane.setFocusTraversalKeys(
          KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET);
      editorPane.setFocusTraversalKeys(
          KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS,
          Collections.singleton(KeyStroke.getAWTKeyStroke(KeyEvent.VK_ESCAPE, 0)));

      editorPane.putClientProperty("errorStripeOnly", Boolean.TRUE);
      editorPane.putClientProperty("code-folding-enable", false);
    }
  }
 public static void findUsages(
     @NotNull FindModel findModel,
     @NotNull final Project project,
     @NotNull final Processor<UsageInfo> consumer,
     @NotNull FindUsagesProcessPresentation processPresentation) {
   findUsages(findModel, project, consumer, processPresentation, Collections.emptySet());
 }
 private void processDependencies(
     final Set<PsiFile> searchIn,
     final Set<PsiFile> searchFor,
     Processor<List<PsiFile>> processor) {
   if (myTransitiveBorder == 0) return;
   Set<PsiFile> initialSearchFor = new HashSet<PsiFile>(searchFor);
   for (DependenciesBuilder builder : myBuilders) {
     for (PsiFile from : searchIn) {
       for (PsiFile to : initialSearchFor) {
         final List<List<PsiFile>> paths = builder.findPaths(from, to);
         Collections.sort(
             paths,
             new Comparator<List<PsiFile>>() {
               public int compare(final List<PsiFile> p1, final List<PsiFile> p2) {
                 return p1.size() - p2.size();
               }
             });
         for (List<PsiFile> path : paths) {
           if (!path.isEmpty()) {
             path.add(0, from);
             path.add(to);
             if (!processor.process(path)) return;
           }
         }
       }
     }
   }
 }
 public String getReportText() {
   final Element rootElement = new Element("root");
   rootElement.setAttribute("isBackward", String.valueOf(!myForward));
   final List<PsiFile> files = new ArrayList<PsiFile>(myDependencies.keySet());
   Collections.sort(
       files,
       new Comparator<PsiFile>() {
         @Override
         public int compare(PsiFile f1, PsiFile f2) {
           final VirtualFile virtualFile1 = f1.getVirtualFile();
           final VirtualFile virtualFile2 = f2.getVirtualFile();
           if (virtualFile1 != null && virtualFile2 != null) {
             return virtualFile1.getPath().compareToIgnoreCase(virtualFile2.getPath());
           }
           return 0;
         }
       });
   for (PsiFile file : files) {
     final Element fileElement = new Element("file");
     fileElement.setAttribute("path", file.getVirtualFile().getPath());
     for (PsiFile dep : myDependencies.get(file)) {
       Element depElement = new Element("dependency");
       depElement.setAttribute("path", dep.getVirtualFile().getPath());
       fileElement.addContent(depElement);
     }
     rootElement.addContent(fileElement);
   }
   PathMacroManager.getInstance(myProject).collapsePaths(rootElement);
   return JDOMUtil.writeDocument(new Document(rootElement), SystemProperties.getLineSeparator());
 }
  private JPanel getClickableTagsPanel() {
    JPanel pnl = new JPanel();

    pnl.setLayout(new GridLayout(0, 3));

    ArrayList<Commontags> listTags = new ArrayList<>(mapAllTags.values());
    Collections.sort(listTags);

    for (final Commontags ctag : listTags) {
      JCheckBox cb = new JCheckBox(ctag.getText());

      cb.setForeground(GUITools.getColor(ctag.getColor()));
      cb.setFont(ctag.getType() == 0 ? SYSConst.ARIAL12 : SYSConst.ARIAL12BOLD);

      cb.setSelected(listSelectedTags.contains(ctag));

      cb.addItemListener(
          e -> {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              listSelectedTags.add(ctag);
              add(createButton(ctag));
            } else {
              listSelectedTags.remove(ctag);
              mapButtons.remove(ctag);
            }
            notifyListeners(ctag);
          });

      pnl.add(cb);
    }
    return pnl;
  }