/** Rename an Editor type panel in Show Panels sub menu */ public void renameEditorPanel(Editor panel) { if (panelsList.size() == 0) { return; } for (int i = 0; i < panelsList.size(); i++) { Object o = panelsList.get(i); if (o == panel) { JCheckBoxMenuItem r = (JCheckBoxMenuItem) panelsSubMenu.getItem(i); r.setText(panel.getTitle()); return; } } }
void createPage0() { try { vEditor = new Editor(); vEditor.init(getEditorSite(), getEditorInput()); if (readOnly) vEditor.setReadOnly(readOnly); int index = addPage(vEditor, getEditorInput()); setPageText(index, "Source"); setPartName(vEditor.getTitle()); } catch (PartInitException e) { ErrorDialog.openError( getSite().getShell(), "Error creating nested text vEditor", null, e.getStatus()); } }
/** Add an Editor panel to Show Panels sub menu */ public void addEditorPanel(final Editor panel) { // If this is the first panel, remove the 'No Panels' menu item if (panelsList.size() == 0) { panelsSubMenu.remove(noPanelsItem); } panelsList.add(panel); ActionListener a = new ActionListener() { public void actionPerformed(ActionEvent e) { if (panel instanceof LayoutEditor) { panel.setVisible(true); panel.repaint(); } else { panel.getTargetFrame().setVisible(true); } updateEditorPanel(panel); } }; JCheckBoxMenuItem r = new JCheckBoxMenuItem(panel.getTitle()); r.addActionListener(a); panelsSubMenu.add(r); updateEditorPanel(panel); }