List of usage examples for java.awt Desktop getDesktop
public static synchronized Desktop getDesktop()
From source file:org.nuclos.client.main.MainController.java
public void cmdShowAboutDialog() { try {/*from ww w . j av a 2s .co m*/ final MainFrameTab internalFrame = newMainFrameTab(null, "Info"); String html = IOUtils.readFromTextStream( getClass().getClassLoader().getResourceAsStream("org/nuclos/client/help/about/about.html"), null); Pair<String, String> clientLogFile = StartUp.getLogFile(); String logDir = ""; String logFilename = clientLogFile.x; String logDatePattern = clientLogFile.y; try { // try to extract dir and filename... logDir = clientLogFile.x.substring(0, clientLogFile.x.lastIndexOf("/")); logFilename = clientLogFile.x.substring(clientLogFile.x.lastIndexOf("/") + 1) + logDatePattern.replace("'", ""); } catch (Exception ex) { // do nothing } HtmlPanel htmlPanel = new HtmlPanel( String.format(html, ApplicationProperties.getInstance().getCurrentVersion(), // %1$s getUserName(), // %2$s getNuclosServerName(), // %3$s System.getProperty("java.version"), // %4$s logDir, // %5$s logFilename // %6$s )); htmlPanel.btnClose.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { internalFrame.dispose(); } }); htmlPanel.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == EventType.ACTIVATED) { try { Desktop.getDesktop().browse(e.getURL().toURI()); } catch (IOException e1) { LOG.warn("cmdShowAboutDialog " + e1 + ": " + e1, e1); } catch (URISyntaxException e1) { LOG.warn("cmdShowAboutDialog " + e1 + ": " + e1, e1); } } } }); internalFrame.setLayeredComponent(htmlPanel); Main.getInstance().getMainFrame().getHomePane().add(internalFrame); internalFrame.setVisible(true); } catch (Exception e) { Errors.getInstance().showExceptionDialog(Main.getInstance().getMainFrame(), getSpringLocaleDelegate() .getMessage("MainController.26", "Die Infos k\u00f6nnen nicht angezeigt werden."), e); } }
From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java
protected void openBaseDir() { try {// w w w.j a v a 2 s . c o m Desktop.getDesktop().open(new File(iliasProperties.getBaseDirectory())); } catch (IOException e) { showError("Fehler beim ffnen von " + iliasProperties.getBaseDirectory(), e); } }
From source file:savant.view.swing.Savant.java
private void tutorialsItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tutorialsItemActionPerformed try {//from ww w .j av a 2s. c om Desktop.getDesktop().browse(BrowserSettings.MEDIA_URL.toURI()); } catch (Exception ex) { LOG.error("Unable to access online tutorials.", ex); } }
From source file:gtu._work.mvn.MavenRepositoryUI.java
void defaultPopupMenu(final List<PomFile> pomFileList, Component component, MouseEvent evt) { if (pomFileList == null || pomFileList.isEmpty()) { return;//from w w w.ja v a2 s . com } final PomFile pomFile = pomFileList.size() == 1 ? pomFileList.get(0) : null; if (pomFileList.size() > 0) { final JMenuItem copyAllMenu = new JMenuItem(); { final Set<File> jarList = new HashSet<File>(); final StringBuilder sb = new StringBuilder(); for (PomFile _pomFile : pomFileList) { if (_pomFile.jarFile != null) { sb.append(_pomFile.jarFile.getName() + "\n"); jarList.add(_pomFile.jarFile); } } if (sb.length() > 200) { sb.delete(200, sb.length() - 1); sb.append("...etc"); } final String title = "COPY SELECTED JAR : " + jarList.size(); copyAllMenu.setText(title); copyAllMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent paramActionEvent) { System.out.println("# copyMenu action ..."); JOptionPaneUtil.ComfirmDialogResult result = JOptionPaneUtil.newInstance() .confirmButtonYesNoCancel().showConfirmDialog(// "are you sure copy file : \n" + sb + "\tto \n" + copyTo + "\n\t???", title); if (result != JOptionPaneUtil.ComfirmDialogResult.YES_OK_OPTION) { return; } new Thread(Thread.currentThread().getThreadGroup(), new Runnable() { public void run() { long startTime = System.currentTimeMillis(); File copyToFile = null; int successCount = 0; int errorCount = 0; StringBuilder err = new StringBuilder(); for (File jar : jarList) { copyToFile = new File(copyTo, jar.getName()); try { FileUtil.copyFile(jar, copyToFile); successCount++; } catch (IOException e) { e.printStackTrace(); errorCount++; err.append(jar + "\n"); } } JOptionPaneUtil.newInstance().iconInformationMessage().showMessageDialog(// "copy completed!! \n" + // "during : " + (System.currentTimeMillis() - startTime) + "\n" + "success : " + successCount + "\n" + // "fail : " + errorCount + "\n" + // "fail list : \n" + err, "COMPLETED"); } }, "copy all jar to target " + hashCode()).start(); } }); } final JMenuItem copyAllNewMenu = new JMenuItem(); { final Set<File> jarList = new HashSet<File>(); final StringBuilder sb = new StringBuilder(); DependencyKey depenKey = null; PomFile _newPomFile = null; for (PomFile _pomFile : pomFileList) { if (_pomFile.jarFile != null) { depenKey = new DependencyKey(_pomFile.pom.groupId, _pomFile.pom.artifactId); if (pomFileMap.containsKey(depenKey)) { _newPomFile = pomFileMap.get(depenKey); System.out.println("find new success: " + _pomFile + " --> " + _newPomFile); _pomFile = _newPomFile; } else { System.out.println("find new faild!!: " + _pomFile); } if (_pomFile.jarFile != null) { sb.append(_pomFile.jarFile.getName() + "\n"); jarList.add(_pomFile.jarFile); } } } if (sb.length() > 200) { sb.delete(200, sb.length() - 1); sb.append("...etc"); } final String title = "COPY SELECTED JAR(newest) : " + jarList.size(); copyAllNewMenu.setText(title); copyAllNewMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent paramActionEvent) { System.out.println("# copyMenu action ..."); JOptionPaneUtil.ComfirmDialogResult result = JOptionPaneUtil.newInstance() .confirmButtonYesNoCancel().showConfirmDialog(// "are you sure copy file : \n" + sb + "\tto \n" + copyTo + "\n\t???", title); if (result != JOptionPaneUtil.ComfirmDialogResult.YES_OK_OPTION) { return; } new Thread(Thread.currentThread().getThreadGroup(), new Runnable() { public void run() { long startTime = System.currentTimeMillis(); File copyToFile = null; int successCount = 0; int errorCount = 0; StringBuilder err = new StringBuilder(); for (File jar : jarList) { copyToFile = new File(copyTo, jar.getName()); try { FileUtil.copyFile(jar, copyToFile); successCount++; } catch (IOException e) { e.printStackTrace(); errorCount++; err.append(jar + "\n"); } } JOptionPaneUtil.newInstance().iconInformationMessage().showMessageDialog(// "copy completed!! \n" + // "during : " + (System.currentTimeMillis() - startTime) + "\n" + "success : " + successCount + "\n" + // "fail : " + errorCount + "\n" + // "fail list : \n" + err, "COMPLETED"); } }, "copy all jar to target " + hashCode()).start(); } }); } JPopupMenuUtil.newInstance(component).applyEvent(evt).addJMenuItem(copyAllMenu, copyAllNewMenu).show(); } if (pomFile != null) { final JMenuItem copyMenu = new JMenuItem(); { if (pomFile.jarFile == null) { copyMenu.setText("COPY : no jar file"); copyMenu.setEnabled(false); } else if (copyTo == null) { copyMenu.setText("COPY : copy to not set"); copyMenu.setEnabled(false); } else { copyMenu.setText("COPY : " + this.getJarName(pomFile)); copyMenu.setEnabled(true); } copyMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent paramActionEvent) { System.out.println("# copyMenu action ..."); File copyToFile = new File(copyTo, pomFile.jarFile.getName()); JOptionPaneUtil.ComfirmDialogResult result = JOptionPaneUtil.newInstance() .confirmButtonYesNoCancel().showConfirmDialog(// "are you sure copy file : \n" + // pomFile.jarFile.getParent() + "\nto\n" + // copyToFile.getParent() + "\n" + // "\t???", getJarName(pomFile)); if (result == JOptionPaneUtil.ComfirmDialogResult.YES_OK_OPTION) { try { FileUtil.copyFile(pomFile.jarFile, copyToFile); } catch (IOException e) { e.printStackTrace(); JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog(e.toString(), "ERROR"); } JOptionPaneUtil.newInstance().iconInformationMessage() .showMessageDialog("copy success!!", "SUCCESS"); } } }); } final JMenuItem updateSnapshotMenu = new JMenuItem(); { updateSnapshotMenu.setText("update snapshot"); updateSnapshotMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent paramActionEvent) { new Thread(Thread.currentThread().getThreadGroup(), new Runnable() { public void run() { try { String command = String.format("cmd /c mvn -U -f \"%s\"", pomFile.xmlFile); System.out.println(command); final ProcessWatcher watcher = ProcessWatcher .newInstance(Runtime.getRuntime().exec("cmd /c @echo TODO!!")); //TODO //FIXME //XXX JOptionPaneUtil.newInstance().iconInformationMessage().showMessageDialog("TODO", "MAVEN UPDATE"); } catch (Exception ex) { JCommonUtil.handleException(ex); } } }, "execute Maven update").start(); } }); } final JMenuItem jdJarMenu = new JMenuItem(); { jdJarMenu.setText("jd-gui"); if (pomFile.jarFile == null) { jdJarMenu.setEnabled(false); } jdJarMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent paramActionEvent) { try { Runtime.getRuntime().exec(String.format("cmd /c call \"%s\" \"%s\"", // "C:/apps/jd-gui-0.3.1.windows/jd-gui.exe", pomFile.jarFile)); } catch (IOException ex) { JCommonUtil.handleException(ex); } } }); } final JMenuItem openJarDirMenu = new JMenuItem(); { openJarDirMenu.setText("open dir"); openJarDirMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent paramActionEvent) { try { Desktop.getDesktop().open(pomFile.xmlFile.getParentFile()); } catch (IOException ex) { JCommonUtil.handleException(ex); } } }); } final JMenuItem showDepedencyMessage = new JMenuItem(); { showDepedencyMessage.setText("show dependency"); showDepedencyMessage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent paramActionEvent) { clipboardPomJarConfig(pomFile, true); } }); } JPopupMenuUtil.newInstance(component).applyEvent(evt) .addJMenuItem(copyMenu, updateSnapshotMenu, jdJarMenu, openJarDirMenu, showDepedencyMessage) .show(); } }
From source file:savant.view.swing.Savant.java
private void userManualItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_userManualItemActionPerformed try {/*from w w w .jav a2 s . c om*/ Desktop.getDesktop().browse(BrowserSettings.DOCUMENTATION_URL.toURI()); } catch (Exception ex) { LOG.error("Unable to access online user manual.", ex); } }
From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java
private void openInIlias(final FileObject f) { String s = syncService.getIliasSoapService().getURLInIlias(f.getXmlObject()); try {//from w w w . ja va2 s. c o m Desktop.getDesktop().browse(new URI(s)); } catch (IOException | URISyntaxException e1) { JOptionPane.showMessageDialog(mainFrame, "Fehler beim ffnen von " + s); } }
From source file:org.ohdsi.whiteRabbit.WhiteRabbitMain.java
private void doOpenWiki() { try {/*w w w . j a v a 2s .c o m*/ Desktop desktop = Desktop.getDesktop(); desktop.browse(new URI(WIKI_URL)); } catch (URISyntaxException | IOException ex) { } }
From source file:gdt.jgui.entity.index.JIndexPanel.java
private void initPopup() { try {/*from w ww . j av a 2 s.c om*/ //System.out.println("IndexPanel:initPopup:selection="+selection$); Properties locator = Locator.toProperties(selection$); String nodeType$ = locator.getProperty(NODE_TYPE); //System.out.println("IndexPanel:initPopup:node type="+nodeType$); if (NODE_TYPE_ROOT.equals(nodeType$)) { popup = null; return; } if (NODE_TYPE_GROUP.equals(nodeType$)) { popup = new JPopupMenu(); JMenuItem newGroupItem = new JMenuItem("New group"); newGroupItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { // System.out.println("JIndexPanel:popup:new parent group: selection="+selection$); Properties locator = Locator.toProperties(selection$); String entihome$ = locator.getProperty(Entigrator.ENTIHOME); String title$ = "New group" + Identity.key().substring(0, 4); JTextEditor te = new JTextEditor(); String teLocator$ = te.getLocator(); teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$); teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, title$); teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT_TITLE, "Create group"); String ipLocator$ = getLocator(); ipLocator$ = Locator.append(ipLocator$, JRequester.REQUESTER_ACTION, ACTION_CREATE_GROUP); ipLocator$ = Locator.append(ipLocator$, SELECTION, Locator.compressText(selection$)); ipLocator$ = Locator.append(ipLocator$, BaseHandler.HANDLER_METHOD, "response"); teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR, Locator.compressText(ipLocator$)); JConsoleHandler.execute(console, teLocator$); } catch (Exception ee) { Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString()); } } }); popup.add(newGroupItem); popup.addSeparator(); JMenuItem renameItem = new JMenuItem("Rename"); renameItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { Properties locator = Locator.toProperties(selection$); String entihome$ = locator.getProperty(Entigrator.ENTIHOME); String title$ = locator.getProperty(Locator.LOCATOR_TITLE); JTextEditor te = new JTextEditor(); String teLocator$ = te.getLocator(); teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$); teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, title$); String ipLocator$ = getLocator(); ipLocator$ = Locator.append(ipLocator$, JRequester.REQUESTER_ACTION, ACTION_RENAME_GROUP); ipLocator$ = Locator.append(ipLocator$, SELECTION, Locator.compressText(selection$)); ipLocator$ = Locator.append(ipLocator$, BaseHandler.HANDLER_METHOD, "response"); teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR, Locator.compressText(ipLocator$)); JConsoleHandler.execute(console, teLocator$); } catch (Exception ee) { Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString()); } } }); popup.add(renameItem); JMenuItem setIconItem = new JMenuItem("Set icon"); setIconItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { Properties locator = Locator.toProperties(selection$); JIconSelector is = new JIconSelector(); String isLocator$ = is.getLocator(); isLocator$ = Locator.append(isLocator$, Entigrator.ENTIHOME, entihome$); String ipLocator$ = getLocator(); ipLocator$ = Locator.append(ipLocator$, JRequester.REQUESTER_ACTION, ACTION_SET_ICON_GROUP); ipLocator$ = Locator.append(ipLocator$, SELECTION, Locator.compressText(selection$)); ipLocator$ = Locator.append(ipLocator$, BaseHandler.HANDLER_METHOD, "response"); isLocator$ = Locator.append(isLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR, Locator.compressText(ipLocator$)); JConsoleHandler.execute(console, isLocator$); } catch (Exception ee) { Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString()); } } }); popup.add(setIconItem); JMenuItem orderItem = new JMenuItem("Order"); orderItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { Properties locator = Locator.toProperties(selection$); Entigrator entigrator = console.getEntigrator(entihome$); Sack index = entigrator.getEntityAtKey(entityKey$); String nodeKey$ = locator.getProperty(NODE_KEY); index = orderGroupDefault(index, nodeKey$); index.putElementItem("index.selection", new Core(null, "selection", nodeKey$)); entigrator.save(index); JConsoleHandler.execute(console, getLocator()); } catch (Exception ee) { Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString()); } } }); popup.add(orderItem); popup.addSeparator(); JMenuItem copyItem = new JMenuItem("Copy"); copyItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { cut = false; console.clipboard.clear(); if (selection$ != null) console.clipboard.putString(selection$); } catch (Exception ee) { Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString()); } } }); popup.add(copyItem); JMenuItem cutItem = new JMenuItem("Cut"); cutItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { cut = true; console.clipboard.clear(); if (selection$ != null) console.clipboard.putString(selection$); } catch (Exception ee) { Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString()); } } }); popup.add(cutItem); final String[] sa = console.clipboard.getContent(); if (sa != null && sa.length > 0) { JMenuItem pasteItem = new JMenuItem("Paste"); pasteItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { // System.out.println("JIndexPanel:popup:new parent group: selection="+selection$); Properties selectionLocator = Locator.toProperties(selection$); String indexLocator$ = getLocator(); String groupKey$ = selectionLocator.getProperty(NODE_KEY); Properties indexLocator = Locator.toProperties(indexLocator$); String entihome$ = indexLocator.getProperty(Entigrator.ENTIHOME); String entityKey$ = indexLocator.getProperty(EntityHandler.ENTITY_KEY); Entigrator entigrator = console.getEntigrator(entihome$); Sack index = entigrator.getEntityAtKey(entityKey$); for (String aSa : sa) { index = pasteItemToGroup(index, groupKey$, aSa); } entigrator.save(index); cut = false; JConsoleHandler.execute(console, getLocator()); } catch (Exception ee) { Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString()); } } }); popup.add(pasteItem); } popup.addSeparator(); JMenuItem deleteItem = new JMenuItem("Delete"); deleteItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Delete ?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.YES_OPTION) { try { Properties locator = Locator.toProperties(selection$); Entigrator entigrator = console.getEntigrator(entihome$); Sack index = entigrator.getEntityAtKey(entityKey$); String nodeKey$ = locator.getProperty(NODE_KEY); String groupKey$ = locator.getProperty(NODE_GROUP_KEY); index = removeNode(index, nodeKey$); index.putElementItem("index.selection", new Core(null, "selection", groupKey$)); entigrator.save(index); JConsoleHandler.execute(console, getLocator()); } catch (Exception ee) { Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString()); } } } }); popup.add(deleteItem); return; } if (NODE_TYPE_REFERENCE.equals(nodeType$)) { popup = new JPopupMenu(); final String locatorType$ = locator.getProperty(Locator.LOCATOR_TYPE); JMenuItem openItem = new JMenuItem("Open"); openItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Properties locator = Locator.toProperties(selection$); // String locatorType$=locator.getProperty(Locator.LOCATOR_TYPE); // System.out.println("IndexPanel:open:node type="+locatorType$); if (JFolderPanel.LOCATOR_TYPE_FILE.equals(locatorType$)) { String filePath$ = locator.getProperty(JFolderPanel.FILE_PATH); File itemFile = new File(filePath$); try { Desktop.getDesktop().open(itemFile); } catch (Exception ee) { LOGGER.info(ee.toString()); } return; } if (JWeblinksPanel.LOCATOR_TYPE_WEB_LINK.equals(locatorType$)) { try { String url$ = locator.getProperty(JWeblinksPanel.WEB_LINK_URL); Desktop.getDesktop().browse(new URI(url$)); } catch (Exception ee) { LOGGER.info(ee.toString()); } return; } String responseLocator$ = getLocator(); // System.out.println("IndexPanel:open:response locator="+Locator.remove(responseLocator$,Locator.LOCATOR_ICON)); selection$ = Locator.append(selection$, JRequester.REQUESTER_RESPONSE_LOCATOR, Locator.compressText(responseLocator$)); // System.out.println("IndexPanel:open:selection="+Locator.remove(Locator.remove(selection$, Locator.LOCATOR_ICON),JRequester.REQUESTER_RESPONSE_LOCATOR)); selection$ = Locator.append(selection$, Entigrator.ENTIHOME, entihome$); JConsoleHandler.execute(console, selection$); } }); popup.add(openItem); if (JFolderPanel.LOCATOR_TYPE_FILE.equals(locator.getProperty(Locator.LOCATOR_TYPE))) { JMenuItem openFolderItem = new JMenuItem("Open folder"); openFolderItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Properties locator = Locator.toProperties(selection$); String filePath$ = locator.getProperty(JFolderPanel.FILE_PATH); File itemFile = new File(filePath$); try { Desktop.getDesktop().open(itemFile.getParentFile()); } catch (Exception ee) { LOGGER.info(ee.toString()); } return; } }); popup.add(openFolderItem); } JMenuItem deleteItem = new JMenuItem("Delete"); deleteItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Delete ?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.YES_OPTION) { Properties selectionLocator = Locator.toProperties(selection$); String indexLocator$ = getLocator(); Properties indexLocator = Locator.toProperties(indexLocator$); String entihome$ = indexLocator.getProperty(Entigrator.ENTIHOME); String entityKey$ = indexLocator.getProperty(EntityHandler.ENTITY_KEY); Entigrator entigrator = console.getEntigrator(entihome$); Sack index = entigrator.getEntityAtKey(entityKey$); String nodeKey$ = selectionLocator.getProperty(NODE_KEY); String groupKey$ = selectionLocator.getProperty(NODE_GROUP_KEY); index.removeElementItem("index.jlocator", nodeKey$); index.putElementItem("index.selection", new Core(null, "selection", groupKey$)); entigrator.save(index); JConsoleHandler.execute(console, getLocator()); } } }); popup.add(deleteItem); popup.addSeparator(); JMenuItem renameItem = new JMenuItem("Rename"); renameItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JConsoleHandler.execute(console, selection$); try { Properties locator = Locator.toProperties(selection$); String entihome$ = locator.getProperty(Entigrator.ENTIHOME); String nodeKey$ = locator.getProperty(NODE_KEY); String title$; Core title = index.getElementItem("index.title", nodeKey$); if (title != null && title.value != null) title$ = title.value; else title$ = locator.getProperty(Locator.LOCATOR_TITLE); JTextEditor te = new JTextEditor(); String teLocator$ = te.getLocator(); teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$); teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, title$); String ipLocator$ = getLocator(); ipLocator$ = Locator.append(ipLocator$, JRequester.REQUESTER_ACTION, ACTION_RENAME_REFERENCE); ipLocator$ = Locator.append(ipLocator$, SELECTION, Locator.compressText(selection$)); ipLocator$ = Locator.append(ipLocator$, BaseHandler.HANDLER_METHOD, "response"); teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR, Locator.compressText(ipLocator$)); JConsoleHandler.execute(console, teLocator$); } catch (Exception ee) { Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString()); } } }); popup.add(renameItem); JMenuItem setIconItem = new JMenuItem("Set icon"); setIconItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JConsoleHandler.execute(console, selection$); try { Properties locator = Locator.toProperties(selection$); JIconSelector is = new JIconSelector(); String isLocator$ = is.getLocator(); isLocator$ = Locator.append(isLocator$, Entigrator.ENTIHOME, entihome$); String ipLocator$ = getLocator(); ipLocator$ = Locator.append(ipLocator$, JRequester.REQUESTER_ACTION, ACTION_SET_ICON_REFERENCE); ipLocator$ = Locator.append(ipLocator$, SELECTION, Locator.compressText(selection$)); ipLocator$ = Locator.append(ipLocator$, BaseHandler.HANDLER_METHOD, "response"); isLocator$ = Locator.append(isLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR, Locator.compressText(ipLocator$)); JConsoleHandler.execute(console, isLocator$); } catch (Exception ee) { Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString()); } } }); popup.add(setIconItem); JMenuItem resetItem = new JMenuItem("Reset"); resetItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JConsoleHandler.execute(console, selection$); try { Properties locator = Locator.toProperties(selection$); String nodeKey$ = locator.getProperty(NODE_KEY); Core title = index.getElementItem("index.title", nodeKey$); if (title != null) { index.removeElementItem("index.title", nodeKey$); Entigrator entigrator = console.getEntigrator(entihome$); entigrator.save(index); JConsoleHandler.execute(console, getLocator()); } } catch (Exception ee) { Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString()); } } }); popup.add(resetItem); popup.addSeparator(); JMenuItem copyItem = new JMenuItem("Copy"); copyItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cut = false; console.clipboard.clear(); console.clipboard.putString(selection$); } }); popup.add(copyItem); JMenuItem cutItem = new JMenuItem("Cut"); cutItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cut = true; console.clipboard.clear(); console.clipboard.putString(selection$); } }); popup.add(cutItem); } } catch (Exception e) { Logger.getLogger(getClass().getName()).severe(e.toString()); } }
From source file:com.freedomotic.jfrontend.MainWindow.java
private void mnuTutorialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuTutorialActionPerformed String url = "http://freedomotic-user-manual.readthedocs.io/"; if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); if (desktop.isSupported(java.awt.Desktop.Action.BROWSE)) { try { URI uri = new URI(url); // url is a string containing the URL desktop.browse(uri);// w ww.ja v a 2s .co m } catch (IOException | URISyntaxException ex) { LOG.error(ex.getLocalizedMessage()); } } } else { //open popup with link JOptionPane.showMessageDialog(this, i18n.msg("goto") + url); } }
From source file:com.omertron.yamjtrakttv.view.MainWindow.java
private void lblCredApiUrlMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblCredApiUrlMouseClicked try {//from ww w. j av a 2s.c o m URI uri = new URI("http://trakt.tv/settings/api"); Desktop.getDesktop().browse(uri); } catch (IOException | URISyntaxException ex) { LOG.error("Failed to open URL - " + ex.getMessage()); } }