Beispiel #1
0
  private static JPanel makePanel(String title, String href) {
    JPanel p = new JPanel(new GridBagLayout());
    p.setBorder(BorderFactory.createTitledBorder(title));

    JLabel label = new JLabel(href);

    JEditorPane editor = new JEditorPane("text/html", href);
    editor.setOpaque(false);
    editor.setEditable(false);
    editor.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);

    GridBagConstraints c = new GridBagConstraints();
    c.gridheight = 1;

    c.gridx = 0;
    c.insets = new Insets(5, 5, 5, 0);
    c.anchor = GridBagConstraints.EAST;
    c.gridy = 0;
    p.add(new JLabel("JLabel: "), c);
    c.gridy = 2;
    p.add(new JLabel("JEditorPane: "), c);

    c.gridx = 1;
    c.weightx = 1d;
    c.anchor = GridBagConstraints.WEST;
    c.gridy = 0;
    p.add(label, c);
    c.gridy = 2;
    p.add(editor, c);

    return p;
  }
 public MainPanel() {
   super(new BorderLayout());
   JEditorPane editor =
       new JEditorPane("text/html", String.format("<html><a href='%s'>%s</a>", MYSITE, MYSITE));
   editor.setOpaque(false);
   editor.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
   editor.setEditable(false);
   editor.addHyperlinkListener(
       new HyperlinkListener() {
         @Override
         public void hyperlinkUpdate(HyperlinkEvent e) {
           if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED
               && Desktop.isDesktopSupported()) {
             try {
               Desktop.getDesktop().browse(new URI(MYSITE));
             } catch (IOException | URISyntaxException ex) {
               ex.printStackTrace();
             }
             textArea.setText(e.toString());
           }
         }
       });
   JPanel p = new JPanel();
   p.add(editor);
   p.setBorder(BorderFactory.createTitledBorder("Desktop.getDesktop().browse(URI)"));
   add(p, BorderLayout.NORTH);
   add(new JScrollPane(textArea));
   setPreferredSize(new Dimension(320, 240));
 }
 public void actionPerformed(final AnActionEvent e) {
   @NonNls final String delim = "&nbsp;-&gt;&nbsp;";
   final StringBuffer buf = new StringBuffer();
   processDependencies(
       getSelectedScope(myLeftTree),
       getSelectedScope(myRightTree),
       new Processor<List<PsiFile>>() {
         public boolean process(final List<PsiFile> path) {
           if (buf.length() > 0) buf.append("<br>");
           buf.append(
               StringUtil.join(
                   path,
                   new Function<PsiFile, String>() {
                     public String fun(final PsiFile psiFile) {
                       return psiFile.getName();
                     }
                   },
                   delim));
           return true;
         }
       });
   final JEditorPane pane =
       new JEditorPane(UIUtil.HTML_MIME, "<html>" + buf.toString() + "</html>");
   pane.setForeground(Color.black);
   pane.setBackground(HintUtil.INFORMATION_COLOR);
   pane.setOpaque(true);
   final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(pane);
   final Dimension dimension = pane.getPreferredSize();
   scrollPane.setMinimumSize(new Dimension(dimension.width, dimension.height + 20));
   scrollPane.setPreferredSize(new Dimension(dimension.width, dimension.height + 20));
   JBPopupFactory.getInstance()
       .createComponentPopupBuilder(scrollPane, pane)
       .setTitle("Dependencies")
       .setMovable(true)
       .createPopup()
       .showInBestPositionFor(e.getDataContext());
 }
  public static JEditorPane initPane(
      @NonNls Html html, final HintHint hintHint, @Nullable final JLayeredPane layeredPane) {
    final Ref<Dimension> prefSize = new Ref<Dimension>(null);
    String htmlBody = UIUtil.getHtmlBody(html);
    @NonNls
    String text =
        "<html><head>"
            + UIUtil.getCssFontDeclaration(
                hintHint.getTextFont(),
                hintHint.getTextForeground(),
                hintHint.getLinkForeground(),
                hintHint.getUlImg())
            + "</head><body>"
            + htmlBody
            + "</body></html>";

    final boolean[] prefSizeWasComputed = {false};
    final JEditorPane pane =
        new JEditorPane() {
          @Override
          public Dimension getPreferredSize() {
            if (!prefSizeWasComputed[0] && hintHint.isAwtTooltip()) {
              JLayeredPane lp = layeredPane;
              if (lp == null) {
                JRootPane rootPane = UIUtil.getRootPane(this);
                if (rootPane != null) {
                  lp = rootPane.getLayeredPane();
                }
              }

              Dimension size;
              if (lp != null) {
                size = lp.getSize();
                prefSizeWasComputed[0] = true;
              } else {
                size = ScreenUtil.getScreenRectangle(0, 0).getSize();
              }
              int fitWidth = (int) (size.width * 0.8);
              Dimension prefSizeOriginal = super.getPreferredSize();
              if (prefSizeOriginal.width > fitWidth) {
                setSize(new Dimension(fitWidth, Integer.MAX_VALUE));
                Dimension fixedWidthSize = super.getPreferredSize();
                Dimension minSize = super.getMinimumSize();
                prefSize.set(
                    new Dimension(
                        fitWidth > minSize.width ? fitWidth : minSize.width,
                        fixedWidthSize.height));
              } else {
                prefSize.set(new Dimension(prefSizeOriginal));
              }
            }

            Dimension s =
                prefSize.get() != null ? new Dimension(prefSize.get()) : super.getPreferredSize();
            Border b = getBorder();
            if (b != null) {
              Insets insets = b.getBorderInsets(this);
              if (insets != null) {
                s.width += insets.left + insets.right;
                s.height += insets.top + insets.bottom;
              }
            }
            return s;
          }
        };

    final HTMLEditorKit.HTMLFactory factory =
        new HTMLEditorKit.HTMLFactory() {
          @Override
          public View create(Element elem) {
            AttributeSet attrs = elem.getAttributes();
            Object elementName = attrs.getAttribute(AbstractDocument.ElementNameAttribute);
            Object o =
                elementName != null ? null : attrs.getAttribute(StyleConstants.NameAttribute);
            if (o instanceof HTML.Tag) {
              HTML.Tag kind = (HTML.Tag) o;
              if (kind == HTML.Tag.HR) {
                return new CustomHrView(elem, hintHint.getTextForeground());
              }
            }
            return super.create(elem);
          }
        };

    HTMLEditorKit kit =
        new HTMLEditorKit() {
          @Override
          public ViewFactory getViewFactory() {
            return factory;
          }
        };
    pane.setEditorKit(kit);
    pane.setText(text);

    pane.setCaretPosition(0);
    pane.setEditable(false);

    if (hintHint.isOwnBorderAllowed()) {
      setBorder(pane);
      setColors(pane);
    } else {
      pane.setBorder(null);
    }

    if (!hintHint.isAwtTooltip()) {
      prefSizeWasComputed[0] = true;
    }

    final boolean opaque = hintHint.isOpaqueAllowed();
    pane.setOpaque(opaque);
    if (UIUtil.isUnderNimbusLookAndFeel() && !opaque) {
      pane.setBackground(UIUtil.TRANSPARENT_COLOR);
    } else {
      pane.setBackground(hintHint.getTextBackground());
    }

    return pane;
  }
  public AboutDialog(JConsole jConsole) {
    super(jConsole, Resources.getText("Help.AboutDialog.title"), false);

    setAccessibleDescription(this, getText("Help.AboutDialog.accessibleDescription"));
    setDefaultCloseOperation(HIDE_ON_CLOSE);
    setResizable(false);
    JComponent cp = (JComponent) getContentPane();

    createActions();

    JLabel mastheadLabel = new JLabel(mastheadIcon);
    setAccessibleName(mastheadLabel, getText("Help.AboutDialog.masthead.accessibleName"));

    JPanel mainPanel = new TPanel(0, 0);
    mainPanel.add(mastheadLabel, NORTH);

    String jConsoleVersion = Version.getVersion();
    String vmName = System.getProperty("java.vm.name");
    String vmVersion = System.getProperty("java.vm.version");
    String urlStr = getText("Help.AboutDialog.userGuideLink.url");
    if (isBrowseSupported()) {
      urlStr = "<a style='color:#35556b' href=\"" + urlStr + "\">" + urlStr + "</a>";
    }

    JPanel infoAndLogoPanel = new JPanel(new BorderLayout(10, 10));
    infoAndLogoPanel.setBackground(bgColor);

    String colorStr = String.format("%06x", textColor.getRGB() & 0xFFFFFF);
    JEditorPane helpLink =
        new JEditorPane(
            "text/html",
            "<html><font color=#"
                + colorStr
                + ">"
                + getText("Help.AboutDialog.jConsoleVersion", jConsoleVersion)
                + "<p>"
                + getText("Help.AboutDialog.javaVersion", (vmName + ", " + vmVersion))
                + "<p>"
                + getText("Help.AboutDialog.userGuideLink", urlStr)
                + "</html>");
    helpLink.setOpaque(false);
    helpLink.setEditable(false);
    helpLink.setForeground(textColor);
    mainPanel.setBorder(BorderFactory.createLineBorder(borderColor));
    infoAndLogoPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    helpLink.addHyperlinkListener(
        new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              browse(e.getDescription());
            }
          }
        });
    infoAndLogoPanel.add(helpLink, NORTH);

    ImageIcon brandLogoIcon = new ImageIcon(getClass().getResource("resources/brandlogo.png"));
    JLabel brandLogo = new JLabel(brandLogoIcon, JLabel.LEADING);

    JButton closeButton = new JButton(closeAction);

    JPanel bottomPanel = new TPanel(0, 0);
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING));
    buttonPanel.setOpaque(false);

    mainPanel.add(infoAndLogoPanel, CENTER);
    cp.add(bottomPanel, SOUTH);

    infoAndLogoPanel.add(brandLogo, SOUTH);

    buttonPanel.setBorder(new EmptyBorder(2, 12, 2, 12));
    buttonPanel.add(closeButton);
    bottomPanel.add(buttonPanel, NORTH);

    statusBar = new JLabel(" ");
    bottomPanel.add(statusBar, SOUTH);

    cp.add(mainPanel, NORTH);

    pack();
    setLocationRelativeTo(jConsole);
    Utilities.updateTransparency(this);
  }
  /**
   * Constructs a X509 certificate panel.
   *
   * @param certificates <tt>X509Certificate</tt> objects
   */
  public X509CertificatePanel(Certificate[] certificates) {
    setLayout(new BorderLayout(5, 5));

    // Certificate chain list
    TransparentPanel topPanel = new TransparentPanel(new BorderLayout());
    topPanel.add(
        new JLabel(
            "<html><body><b>"
                + R.getI18NString("service.gui.CERT_INFO_CHAIN")
                + "</b></body></html>"),
        BorderLayout.NORTH);

    DefaultMutableTreeNode top = new DefaultMutableTreeNode();
    DefaultMutableTreeNode previous = top;
    for (int i = certificates.length - 1; i >= 0; i--) {
      Certificate cert = certificates[i];
      DefaultMutableTreeNode next = new DefaultMutableTreeNode(cert);
      previous.add(next);
      previous = next;
    }
    JTree tree = new JTree(top);
    tree.setBorder(new BevelBorder(BevelBorder.LOWERED));
    tree.setRootVisible(false);
    tree.setExpandsSelectedPaths(true);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setCellRenderer(
        new DefaultTreeCellRenderer() {

          @Override
          public Component getTreeCellRendererComponent(
              JTree tree,
              Object value,
              boolean sel,
              boolean expanded,
              boolean leaf,
              int row,
              boolean hasFocus) {
            JLabel component =
                (JLabel)
                    super.getTreeCellRendererComponent(
                        tree, value, sel, expanded, leaf, row, hasFocus);
            if (value instanceof DefaultMutableTreeNode) {
              Object o = ((DefaultMutableTreeNode) value).getUserObject();
              if (o instanceof X509Certificate) {
                component.setText(getSimplifiedName((X509Certificate) o));
              } else {
                // We don't know how to represent this certificate type,
                // let's use the first 20 characters
                String text = o.toString();
                if (text.length() > 20) {
                  text = text.substring(0, 20);
                }
                component.setText(text);
              }
            }
            return component;
          }
        });
    tree.getSelectionModel()
        .addTreeSelectionListener(
            new TreeSelectionListener() {

              @Override
              public void valueChanged(TreeSelectionEvent e) {
                valueChangedPerformed(e);
              }
            });
    tree.setSelectionPath(
        new TreePath((((DefaultTreeModel) tree.getModel()).getPathToRoot(previous))));
    topPanel.add(tree, BorderLayout.CENTER);

    add(topPanel, BorderLayout.NORTH);

    // Certificate details pane
    Caret caret = infoTextPane.getCaret();
    if (caret instanceof DefaultCaret) {
      ((DefaultCaret) caret).setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
    }

    /*
     * Make JEditorPane respect our default font because we will be using it
     * to just display text.
     */
    infoTextPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);

    infoTextPane.setOpaque(false);
    infoTextPane.setEditable(false);
    infoTextPane.setContentType("text/html");
    infoTextPane.setText(toString(certificates[0]));

    final JScrollPane certScroll = new JScrollPane(infoTextPane);
    certScroll.setPreferredSize(new Dimension(300, 500));
    add(certScroll, BorderLayout.CENTER);
  }
  public JBLabel setCopyable(boolean copyable) {
    if (copyable ^ myEditorPane != null) {
      if (myEditorPane == null) {
        final JLabel ellipsisLabel = new JBLabel("...");
        myIconLabel = new JLabel(getIcon());
        myEditorPane =
            new JEditorPane() {
              @Override
              public void paint(Graphics g) {
                Dimension size = getSize();
                boolean paintEllipsis = getPreferredSize().width > size.width && !myMultiline;

                if (!paintEllipsis) {
                  super.paint(g);
                } else {
                  Dimension ellipsisSize = ellipsisLabel.getPreferredSize();
                  int endOffset = size.width - ellipsisSize.width;
                  try {
                    // do not paint half of the letter
                    endOffset = modelToView(viewToModel(new Point(endOffset, 0)) - 1).x;
                  } catch (BadLocationException ignore) {
                  }
                  Shape oldClip = g.getClip();
                  g.clipRect(0, 0, endOffset, size.height);

                  super.paint(g);
                  g.setClip(oldClip);

                  g.translate(endOffset, 0);
                  ellipsisLabel.setSize(ellipsisSize);
                  ellipsisLabel.paint(g);
                  g.translate(-endOffset, 0);
                }
              }
            };
        myEditorPane.addFocusListener(
            new FocusAdapter() {
              @Override
              public void focusLost(FocusEvent e) {
                if (myEditorPane == null) return;
                int caretPosition = myEditorPane.getCaretPosition();
                myEditorPane.setSelectionStart(caretPosition);
                myEditorPane.setSelectionEnd(caretPosition);
              }
            });
        myEditorPane.setContentType("text/html");
        myEditorPane.setEditable(false);
        myEditorPane.setBackground(UIUtil.TRANSPARENT_COLOR);
        myEditorPane.setOpaque(false);
        myEditorPane.setBorder(null);
        myEditorPane.setText(getText());
        checkMultiline();
        myEditorPane.setCaretPosition(0);
        UIUtil.putClientProperty(
            myEditorPane, UIUtil.NOT_IN_HIERARCHY_COMPONENTS, Collections.singleton(ellipsisLabel));
        updateStyle(myEditorPane);
        setLayout(new BorderLayout(getIconTextGap(), 0));
        add(myIconLabel, BorderLayout.WEST);
        add(myEditorPane, BorderLayout.CENTER);
      } else {
        removeAll();
        myEditorPane = null;
        myIconLabel = null;
      }
    }
    return this;
  }
  public BeastDialog(final JFrame frame, final String titleString, final Icon icon) {
    this.frame = frame;

    optionPanel = new OptionsPanel(12, 12);

    // this.frame = frame;

    JPanel panel = new JPanel(new BorderLayout());
    panel.setOpaque(false);

    final OptionsPanel optionPanel3 = new OptionsPanel(0, 3);

    final JLabel titleIcon = new JLabel();
    titleIcon.setIcon(icon);

    final JLabel titleText = new JLabel(titleString);
    optionPanel3.addComponent(titleText);

    //        final JButton aboutButton = new JButton("About BEAST...");
    //        //aboutButton.setAction();
    //        optionPanel3.addComponent(aboutButton);

    optionPanel.addComponents(titleIcon, optionPanel3);

    final JButton inputFileButton = new JButton("Choose File...");
    final JTextField inputFileNameText = new JTextField("not selected", 16);

    inputFileButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            FileDialog dialog = new FileDialog(frame, "Select target file...", FileDialog.LOAD);

            dialog.setVisible(true);
            if (dialog.getFile() == null) {
              // the dialog was cancelled...
              return;
            }

            inputFile = new File(dialog.getDirectory(), dialog.getFile());
            inputFileNameText.setText(inputFile.getName());
          }
        });
    inputFileNameText.setEditable(false);

    JPanel panel1 = new JPanel(new BorderLayout(0, 0));
    panel1.add(inputFileNameText, BorderLayout.CENTER);
    panel1.add(inputFileButton, BorderLayout.EAST);
    inputFileNameText.setToolTipText(
        "<html>Drag a BEAST XML file here or use the button to<br>"
            + "select one from a file dialog box.</html>");
    inputFileButton.setToolTipText(
        "<html>Drag a BEAST XML file here or use the button to<br>"
            + "select one from a file dialog box.</html>");
    optionPanel.addComponentWithLabel("BEAST XML File: ", panel1);

    Color focusColor = UIManager.getColor("Focus.color");
    Border focusBorder = BorderFactory.createMatteBorder(2, 2, 2, 2, focusColor);
    new FileDrop(
        null,
        inputFileNameText,
        focusBorder,
        new FileDrop.Listener() {
          public void filesDropped(java.io.File[] files) {
            inputFile = files[0];
            inputFileNameText.setText(inputFile.getName());
          } // end filesDropped
        }); // end FileDrop.Listener

    overwriteCheckBox.setToolTipText(
        "<html>Specify whether BEAST will overwrite existing log files<br>"
            + "with the same name.</html>");
    optionPanel.addComponent(overwriteCheckBox);

    optionPanel.addSeparator();

    seedText.setColumns(12);
    seedText.setToolTipText(
        "<html>Specify a particular random number seed to replicate<br>"
            + "precisely the sequence of steps in the MCMC chain. By<br>"
            + "default this uses system information to provide a new<br>"
            + "seed each run.</html>");

    optionPanel.addComponentWithLabel("Random number seed: ", seedText);

    threadsCombo.setToolTipText(
        "<html>Specify how large a thread pool to use.<br>"
            + "In most circumstances this should be set to 'automatic'<br>"
            + "but in some circumstances it may be desirable to restict<br>"
            + "the number of cores being used. 0 will turn off threading</html>");

    optionPanel.addComponentWithLabel("Thread pool size: ", threadsCombo);

    optionPanel.addSeparator();

    optionPanel.addSpanningComponent(beagleCheckBox);
    beagleCheckBox.setSelected(true);

    final OptionsPanel optionPanel1 = new OptionsPanel(0, 6);
    //        optionPanel1.setBorder(BorderFactory.createEmptyBorder());
    optionPanel1.setBorder(new TitledBorder(""));

    OptionsPanel optionPanel2 = new OptionsPanel(0, 3);
    optionPanel2.setBorder(BorderFactory.createEmptyBorder());
    final JLabel label1 =
        optionPanel2.addComponentWithLabel("Prefer use of: ", beagleResourceCombo);
    optionPanel2.addComponent(beagleSSECheckBox);
    beagleSSECheckBox.setSelected(true);
    final JLabel label2 =
        optionPanel2.addComponentWithLabel("Prefer precision: ", beaglePrecisionCombo);
    final JLabel label3 =
        optionPanel2.addComponentWithLabel("Rescaling scheme: ", beagleScalingCombo);
    optionPanel2.addComponent(beagleInfoCheckBox);
    optionPanel2.setBorder(BorderFactory.createEmptyBorder());

    optionPanel1.addComponent(optionPanel2);

    final JEditorPane beagleInfo =
        new JEditorPane(
            "text/html",
            "<html><div style=\"font-family:'helvetica neue light',helvetica,sans-serif;font-size:12;\"><p>BEAGLE is a high-performance phylogenetic library that can make use of<br>"
                + "additional computational resources such as graphics boards. It must be<br>"
                + "downloaded and installed independently of BEAST:</p>"
                + "<pre><a href=\"http://beagle-lib.googlecode.com/\">http://beagle-lib.googlecode.com/</a></pre></div>");
    beagleInfo.setOpaque(false);
    beagleInfo.setEditable(false);
    beagleInfo.addHyperlinkListener(new SimpleLinkListener());
    optionPanel1.addComponent(beagleInfo);
    optionPanel1.setBorder(BorderFactory.createEmptyBorder());
    optionPanel.addSpanningComponent(optionPanel1);

    beagleInfoCheckBox.setEnabled(false);
    beagleCheckBox.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            beagleInfo.setEnabled(beagleCheckBox.isSelected());
            beagleInfoCheckBox.setEnabled(beagleCheckBox.isSelected());
            label1.setEnabled(beagleCheckBox.isSelected());
            beagleResourceCombo.setEnabled(beagleCheckBox.isSelected());
            beagleSSECheckBox.setEnabled(beagleCheckBox.isSelected());
            label2.setEnabled(beagleCheckBox.isSelected());
            beaglePrecisionCombo.setEnabled(beagleCheckBox.isSelected());
            label3.setEnabled(beagleCheckBox.isSelected());
            beagleScalingCombo.setEnabled(beagleCheckBox.isSelected());
          }
        });

    beagleCheckBox.setSelected(false);
    beagleResourceCombo.setSelectedItem("CPU");
  }
  public EditorPaneHTMLHelp(String htmlFile) {
    if (GlobalValues.useSystemBrowserForHelp) {
      Desktop d = GlobalValues.desktop;
      try {
        // create a temp file
        GlobalValues.forHTMLHelptempFile = new File("tempHTMLHelpSynthetic.html");
        FileWriter fw = new FileWriter(GlobalValues.forHTMLHelptempFile);

        java.util.List<String> list = readTextFromJar(htmlFile);
        Iterator<String> it = list.iterator();
        while (it.hasNext()) {
          fw.write(it.next() + "\n");
        }

        String canonicalPathOfFile = GlobalValues.forHTMLHelptempFile.getCanonicalPath();
        URL urlFile = new URL("file://" + canonicalPathOfFile);
        URI uriOfFile = urlFile.toURI();

        fw.close();

        d.browse(uriOfFile);

      } catch (Exception e) {
        e.printStackTrace();
      }

    } else {
      URL initialURL = getClass().getResource(htmlFile);

      font = GlobalValues.htmlfont;

      String title = "HTML Help";
      setTitle(title);

      final Stack<String> urlStack = new Stack<String>();
      final JEditorPane editorPane;

      editorPane = new JEditorPane(new HTMLEditorKit().getContentType(), " ");

      editorPane.setOpaque(false);
      editorPane.setBorder(null);
      editorPane.setEditable(false);

      JPanel magPanel = new JPanel();

      magnificationFactor = GlobalValues.helpMagnificationFactor;
      magFactor = new JTextField(Double.toString(magnificationFactor));

      JButton magButton = new JButton("Set Magnification: ");
      magButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              magnificationFactor = Double.parseDouble(magFactor.getText());
              GlobalValues.helpMagnificationFactor = magnificationFactor;
            }
          });

      magPanel.setLayout(new GridLayout(1, 2));
      magPanel.add(magButton);
      magPanel.add(magFactor);

      final JTextField url = new JTextField(initialURL.toString());

      // set up hyperlink listener
      editorPane.setEditable(false);

      try {
        // remember URL for back button
        urlStack.push(initialURL.toString());
        // show URL in text field
        url.setText(initialURL.toString());

        // add a CSS rule to force body tags to use the default label font
        // instead of the value in javax.swing.text.html.default.csss

        String bodyRule =
            "body { font-family: "
                + font.getFamily()
                + "; "
                + "font-size: "
                + font.getSize() * GlobalValues.helpMagnificationFactor
                + "pt; }";
        ((HTMLDocument) editorPane.getDocument()).getStyleSheet().addRule(bodyRule);

        editorPane.setPage(initialURL);

        editorPane.firePropertyChange("dummyProp", true, false);

      } catch (IOException e) {
        editorPane.setText("Exception: " + e);
      }

      editorPane.addPropertyChangeListener(
          new PropertyChangeListener() {

            public void propertyChange(PropertyChangeEvent evt) {

              String bodyRule =
                  "body { font-family: "
                      + font.getFamily()
                      + "; "
                      + "font-size: "
                      + font.getSize() * GlobalValues.helpMagnificationFactor
                      + "pt; }";
              ((HTMLDocument) editorPane.getDocument()).getStyleSheet().addRule(bodyRule);
            }
          });

      editorPane.addHyperlinkListener(
          new HyperlinkListener() {
            public void hyperlinkUpdate(HyperlinkEvent event) {
              if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                try {
                  // remember URL for back button
                  urlStack.push(event.getURL().toString());
                  // show URL in text field
                  url.setText(event.getURL().toString());
                  editorPane.setPage(event.getURL());

                  editorPane.firePropertyChange("dummyProp", true, false);

                } catch (IOException e) {
                  editorPane.setText("Exception: " + e);
                }
              }
            }
          });

      // set up checkbox for toggling edit mode
      final JCheckBox editable = new JCheckBox();
      editable.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent event) {
              editorPane.setEditable(editable.isSelected());
            }
          });

      // set up load button for loading URL
      ActionListener listener =
          new ActionListener() {
            public void actionPerformed(ActionEvent event) {
              try {
                // remember URL for back button
                urlStack.push(url.getText());
                editorPane.setPage(url.getText());

                editorPane.firePropertyChange("dummyProp", true, false);

              } catch (IOException e) {
                editorPane.setText("Exception: " + e);
              }
            }
          };

      JButton loadButton = new JButton("Load/Magnify");
      loadButton.addActionListener(listener);
      url.addActionListener(listener);

      // set up back button and button action

      JButton backButton = new JButton("Back");
      backButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent event) {
              if (urlStack.size() <= 1) return;
              try {
                // get URL from back button
                urlStack.pop();
                // show URL in text field
                String urlString = urlStack.peek();
                url.setText(urlString);
                editorPane.setPage(urlString);

                editorPane.firePropertyChange("dummyProp", true, false);

              } catch (IOException e) {
                editorPane.setText("Exception: " + e);
              }
            }
          });

      JPanel allPanel = new JPanel(new BorderLayout());

      // put all control components in a panel

      JPanel ctrlPanel = new JPanel(new BorderLayout());
      JPanel urlPanel = new JPanel();
      urlPanel.add(new JLabel("URL"));
      urlPanel.add(url);
      JPanel buttonPanel = new JPanel();
      buttonPanel.add(loadButton);
      buttonPanel.add(backButton);
      buttonPanel.add(new JLabel("Editable"));
      buttonPanel.add(magPanel);
      buttonPanel.add(editable);
      ctrlPanel.add(buttonPanel, BorderLayout.NORTH);
      ctrlPanel.add(urlPanel, BorderLayout.CENTER);

      allPanel.add(ctrlPanel, BorderLayout.NORTH);
      allPanel.add(new JScrollPane(editorPane), BorderLayout.CENTER);

      add(allPanel);
    }
  }
  private void updateList(
      @NotNull final List<WCInfo> infoList,
      @NotNull final List<WorkingCopyFormat> supportedFormats) {
    myPanel.removeAll();
    final Insets nullIndent = new Insets(1, 3, 1, 0);
    final GridBagConstraints gb =
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0,
            0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(2, 2, 0, 0),
            0,
            0);
    gb.insets.left = 4;
    myPanel.add(myRefreshLabel, gb);
    gb.insets.left = 1;

    final LocalFileSystem lfs = LocalFileSystem.getInstance();
    final Insets topIndent = new Insets(10, 3, 0, 0);
    for (final WCInfo wcInfo : infoList) {
      final Collection<WorkingCopyFormat> upgradeFormats =
          getUpgradeFormats(wcInfo, supportedFormats);

      final VirtualFile vf = lfs.refreshAndFindFileByIoFile(new File(wcInfo.getPath()));
      final VirtualFile root = (vf == null) ? wcInfo.getVcsRoot() : vf;

      final JEditorPane editorPane = new JEditorPane(UIUtil.HTML_MIME, "");
      editorPane.setEditable(false);
      editorPane.setFocusable(true);
      editorPane.setBackground(UIUtil.getPanelBackground());
      editorPane.setOpaque(false);
      editorPane.addHyperlinkListener(
          new HyperlinkListener() {
            @Override
            public void hyperlinkUpdate(HyperlinkEvent e) {
              if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                if (CONFIGURE_BRANCHES.equals(e.getDescription())) {
                  if (!checkRoot(root, wcInfo.getPath(), " invoke Configure Branches")) return;
                  BranchConfigurationDialog.configureBranches(myProject, root, true);
                } else if (FIX_DEPTH.equals(e.getDescription())) {
                  final int result =
                      Messages.showOkCancelDialog(
                          myVcs.getProject(),
                          "You are going to checkout into '"
                              + wcInfo.getPath()
                              + "' with 'infinity' depth.\n"
                              + "This will update your working copy to HEAD revision as well.",
                          "Set Working Copy Infinity Depth",
                          Messages.getWarningIcon());
                  if (result == Messages.OK) {
                    // update of view will be triggered by roots changed event
                    SvnCheckoutProvider.checkout(
                        myVcs.getProject(),
                        new File(wcInfo.getPath()),
                        wcInfo.getRootUrl(),
                        SVNRevision.HEAD,
                        Depth.INFINITY,
                        false,
                        null,
                        wcInfo.getFormat());
                  }
                } else if (CHANGE_FORMAT.equals(e.getDescription())) {
                  changeFormat(wcInfo, upgradeFormats);
                } else if (MERGE_FROM.equals(e.getDescription())) {
                  if (!checkRoot(root, wcInfo.getPath(), " invoke Merge From")) return;
                  mergeFrom(wcInfo, root, editorPane);
                } else if (CLEANUP.equals(e.getDescription())) {
                  if (!checkRoot(root, wcInfo.getPath(), " invoke Cleanup")) return;
                  new CleanupWorker(
                          new VirtualFile[] {root},
                          myVcs.getProject(),
                          "action.Subversion.cleanup.progress.title")
                      .execute();
                }
              }
            }

            private boolean checkRoot(
                VirtualFile root, final String path, final String actionName) {
              if (root == null) {
                Messages.showWarningDialog(
                    myProject, "Invalid working copy root: " + path, "Can not " + actionName);
                return false;
              }
              return true;
            }
          });
      editorPane.setBorder(null);
      editorPane.setText(formatWc(wcInfo, upgradeFormats));

      final JPanel copyPanel = new JPanel(new GridBagLayout());

      final GridBagConstraints gb1 =
          new GridBagConstraints(
              0,
              0,
              1,
              1,
              0,
              0,
              GridBagConstraints.NORTHWEST,
              GridBagConstraints.NONE,
              nullIndent,
              0,
              0);
      gb1.insets.top = 1;
      gb1.gridwidth = 3;

      gb.insets = topIndent;
      gb.fill = GridBagConstraints.HORIZONTAL;
      ++gb.gridy;

      final JPanel contForCopy = new JPanel(new BorderLayout());
      contForCopy.add(copyPanel, BorderLayout.WEST);
      myPanel.add(contForCopy, gb);

      copyPanel.add(editorPane, gb1);
      gb1.insets = nullIndent;
    }

    myPanel.revalidate();
    myPanel.repaint();
  }