// {{{ init() method private void init() { EditBus.addToBus(this); /* Setup panes */ JPanel content = new JPanel(new BorderLayout(12, 12)); content.setBorder(new EmptyBorder(12, 12, 12, 12)); setContentPane(content); tabPane = new JTabbedPane(); tabPane.addTab(jEdit.getProperty("manage-plugins.title"), manager = new ManagePanel(this)); tabPane.addTab( jEdit.getProperty("update-plugins.title"), updater = new InstallPanel(this, true)); tabPane.addTab( jEdit.getProperty("install-plugins.title"), installer = new InstallPanel(this, false)); EditBus.addToBus(installer); content.add(BorderLayout.CENTER, tabPane); tabPane.addChangeListener(new ListUpdater()); /* Create the buttons */ Box buttons = new Box(BoxLayout.X_AXIS); ActionListener al = new ActionHandler(); mgrOptions = new JButton(jEdit.getProperty("plugin-manager.mgr-options")); mgrOptions.addActionListener(al); pluginOptions = new JButton(jEdit.getProperty("plugin-manager.plugin-options")); pluginOptions.addActionListener(al); done = new JButton(jEdit.getProperty("plugin-manager.done")); done.addActionListener(al); buttons.add(Box.createGlue()); buttons.add(mgrOptions); buttons.add(Box.createHorizontalStrut(6)); buttons.add(pluginOptions); buttons.add(Box.createHorizontalStrut(6)); buttons.add(done); buttons.add(Box.createGlue()); getRootPane().setDefaultButton(done); content.add(BorderLayout.SOUTH, buttons); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setIconImage(GUIUtilities.getPluginIcon()); pack(); GUIUtilities.loadGeometry(this, parent, "plugin-manager"); GUIUtilities.addSizeSaver(this, parent, "plugin-manager"); setVisible(true); } // }}}
/** * Creates a new help viewer for the specified URL. * * @param url The URL */ public HelpViewer(String url) { super(jEdit.getProperty("helpviewer.title")); setIconImage(GUIUtilities.getEditorIcon()); try { baseURL = new File(MiscUtilities.constructPath(jEdit.getJEditHome(), "doc")).toURL().toString(); } catch (MalformedURLException mu) { Log.log(Log.ERROR, this, mu); // what to do? } ActionHandler actionListener = new ActionHandler(); JTabbedPane tabs = new JTabbedPane(); tabs.addTab(jEdit.getProperty("helpviewer.toc.label"), toc = new HelpTOCPanel(this)); tabs.addTab(jEdit.getProperty("helpviewer.search.label"), new HelpSearchPanel(this)); tabs.setMinimumSize(new Dimension(0, 0)); JPanel rightPanel = new JPanel(new BorderLayout()); Box toolBar = new Box(BoxLayout.X_AXIS); // toolBar.setFloatable(false); toolBar.add(title = new JLabel()); toolBar.add(Box.createGlue()); historyModel = new HelpHistoryModel(25); back = new HistoryButton(HistoryButton.BACK, historyModel); back.addActionListener(actionListener); toolBar.add(back); forward = new HistoryButton(HistoryButton.FORWARD, historyModel); forward.addActionListener(actionListener); toolBar.add(forward); back.setPreferredSize(forward.getPreferredSize()); rightPanel.add(BorderLayout.NORTH, toolBar); viewer = new JEditorPane(); viewer.setEditable(false); viewer.addHyperlinkListener(new LinkHandler()); viewer.setFont(new Font("Monospaced", Font.PLAIN, 12)); viewer.addPropertyChangeListener(new PropertyChangeHandler()); viewer.addKeyListener(new KeyHandler()); viewerScrollPane = new JScrollPane(viewer); rightPanel.add(BorderLayout.CENTER, viewerScrollPane); splitter = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, jEdit.getBooleanProperty("appearance.continuousLayout"), tabs, rightPanel); splitter.setBorder(null); getContentPane().add(BorderLayout.CENTER, splitter); historyModel.addHelpHistoryModelListener(this); historyUpdated(); gotoURL(url, true, 0); setDefaultCloseOperation(DISPOSE_ON_CLOSE); getRootPane().setPreferredSize(new Dimension(750, 500)); pack(); GUIUtilities.loadGeometry(this, "helpviewer"); GUIUtilities.addSizeSaver(this, "helpviewer"); EditBus.addToBus(this); setVisible(true); SwingUtilities.invokeLater( new Runnable() { public void run() { splitter.setDividerLocation(jEdit.getIntegerProperty("helpviewer.splitter", 250)); viewer.requestFocus(); } }); } // }}}