// {{{ updatePluginList() method private void updatePluginList() { if (jEdit.getSettingsDirectory() == null && jEdit.getJEditHome() == null) { GUIUtilities.error(this, "no-settings", null); return; } if (!shouldUpdatePluginList()) { return; } ThreadUtilities.runInBackground( new Task() { @Override public void _run() { try { downloadingPluginList = true; setStatus(jEdit.getProperty("plugin-manager.list-download-connect")); pluginList = new PluginList(this); } finally { downloadingPluginList = false; } ThreadUtilities.runInDispatchThread( new Runnable() { public void run() { pluginListUpdated(); } }); } }); } // }}}
// {{{ loadDirectory() method public void loadDirectory( final Object node, String path, final boolean addToHistory, final Runnable delayedAWTTask) { path = MiscUtilities.constructPath(browser.getDirectory(), path); VFS vfs = VFSManager.getVFSForPath(path); Object session = vfs.createVFSSession(path, this); if (session == null) { if (delayedAWTTask != null) ThreadUtilities.runInDispatchThread(delayedAWTTask); return; } if (node == null) { parentDirectories.setListData(new Object[] {new LoadingPlaceholder()}); } final Object[] loadInfo = new Object[2]; Runnable awtRunnable = new Runnable() { public void run() { browser.directoryLoaded(node, loadInfo, addToHistory); if (delayedAWTTask != null) delayedAWTTask.run(); } }; ThreadUtilities.runInBackground( new ListDirectoryBrowserTask(browser, session, vfs, path, loadInfo, awtRunnable)); } // }}}
// {{{ copy() method private void copy( Object vfsSession, VFS vfs, String sourcePath, String sourceName, String targetPath) throws IOException, InterruptedException { String name = getTargetName(vfsSession, vfs, targetPath, sourceName); if (name == null) { return; } String targetName = MiscUtilities.constructPath(targetPath, name); CountDownLatch latch = new CountDownLatch(1); ThreadUtilities.runInBackground(new CopyFileWorker(comp, sourcePath, targetName, latch)); latch.await(); } // }}}
/** * Performs a HyperSearch. * * @param view The view * @param selection If true, will only search in the current selection. Note that the file set * must be the current buffer file set for this to work. * @since jEdit 4.0pre1 */ public static boolean hyperSearch(View view, boolean selection) { // component that will parent any dialog boxes Component comp = SearchDialog.getSearchDialog(view); if (comp == null) comp = view; record(view, "hyperSearch(view," + selection + ')', false, !selection); view.getDockableWindowManager().addDockableWindow(HyperSearchResults.NAME); HyperSearchResults results = (HyperSearchResults) view.getDockableWindowManager().getDockable(HyperSearchResults.NAME); results.searchStarted(); try { SearchMatcher matcher = getSearchMatcher(); if (matcher == null) { view.getToolkit().beep(); results.searchFailed(); return false; } Selection[] s; if (selection) { s = view.getTextArea().getSelection(); if (s == null) { results.searchFailed(); return false; } } else s = null; ThreadUtilities.runInBackground(new HyperSearchRequest(view, matcher, results, s)); return true; } catch (Exception e) { results.searchFailed(); handleError(comp, e); return false; } } // }}}