/** * Gets the custom editor component. * * @return a value of type 'java.awt.Component' */ public java.awt.Component getCustomEditor() { if (this.m_Panel == null) { ResourceBundleInjector.getInjector().inject(this); JButton chooseButton = new JButton(); chooseButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { ExtensionFilter[] filters = fileNamingService.getFileFilters(); IFileReader fileOpener = fileChooserService.chooseAndGetFileReader(filters); IFile selectedFile = fileOpener.getFileDefinition(); if (selectedFile == null) return; DiagramLink diagramLink = (DiagramLink) AbstractDiagramLinkEditor.this.getValue(); diagramLink.setFile(selectedFile); AbstractDiagramLinkEditor.this.setValue(diagramLink); firePropertyChange(); } catch (Exception ex) { throw new RuntimeException(ex); } } }); // this.getResourceBundle().getString("file.link.open.text") JButton goButton = new JButton(); goButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { DiagramLink diagramLink = (DiagramLink) AbstractDiagramLinkEditor.this.getValue(); IFile file = diagramLink.getFile(); if (file == null) return; IGraphFile graphFile = new GraphFile(file); IWorkspace workspace = new Workspace(graphFile); show(workspace); } catch (Exception ex) { throw new RuntimeException(ex); } } }); this.m_Panel = new JPanel(); this.m_Panel.add(chooseButton); this.m_Panel.add(goButton); } return this.m_Panel; }
/** * Default constructor * * @param mainFrame where is attached this menu * @param factory for accessing to external resources */ @ResourceBundleBean(key = "edit") public EditMenu(final MainFrame mainFrame) { ResourceBundleInjector.getInjector().inject(this); this.mainFrame = mainFrame; this.createMenu(); }