List of usage examples for org.eclipse.jface.dialogs ProgressMonitorDialog setCancelable
public void setCancelable(boolean cancelable)
From source file:BMVirtualFindAction.java
License:Open Source License
public void run() { final VirtualViewerListener listener = new VirtualViewerListener(); VirtualTreeModelViewer virtualViewer = initVirtualViewer(fClientViewer, listener); ProgressMonitorDialog dialog = new TimeTriggeredProgressMonitorDialog(fClientViewer.getControl().getShell(), 500);//from w w w .j a v a 2 s . c o m final IProgressMonitor monitor = dialog.getProgressMonitor(); dialog.setCancelable(true); try { dialog.run(true, true, new IRunnableWithProgress() { public void run(final IProgressMonitor m) throws InvocationTargetException, InterruptedException { synchronized (listener) { listener.fProgressMonitor = m; listener.fProgressMonitor.beginTask(DebugUIPlugin.removeAccelerators(getText()), listener.fRemainingUpdatesCount); } while ((!listener.fLabelUpdatesComplete || !listener.fViewerUpdatesComplete) && !listener.fProgressMonitor.isCanceled()) { Thread.sleep(1); } synchronized (listener) { listener.fProgressMonitor = null; } } }); } catch (InvocationTargetException e) { DebugUIPlugin.log(e); return; } catch (InterruptedException e) { return; } VirtualItem root = virtualViewer.getTree(); if (!monitor.isCanceled()) { List<VirtualItem> list = new ArrayList<VirtualItem>(); collectAllChildren(root, list); FindLabelProvider labelProvider = new FindLabelProvider(virtualViewer, list); VirtualItem result = performFind(list, labelProvider); if (result != null) { setSelectionToClient(virtualViewer, labelProvider, result); } } virtualViewer.removeLabelUpdateListener(listener); virtualViewer.removeViewerUpdateListener(listener); virtualViewer.dispose(); }
From source file:com.astra.ses.spell.dev.database.DatabaseManager.java
License:Open Source License
/*************************************************************************** * Load the database for the given project * //from ww w. j a v a2 s.c o m * @param project * @throws DatabaseLoadException **************************************************************************/ private void loadProjectdatabase(IProject project, IProgressMonitor monitor) throws DatabaseLoadException { DatabasePropertiesManager manager = new DatabasePropertiesManager(project); String driver = manager.getDatabaseDriverName(); String path = manager.getDatabasePath(); DatabaseLoadJob dbLoad = new DatabaseLoadJob(project, driver, path); IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell()); try { dialog.setCancelable(false); dialog.run(true, false, dbLoad); if (dbLoad.result.getSeverity() == IStatus.ERROR) { throw new DatabaseLoadException(dbLoad.result.getMessage()); } } catch (Exception ex) { ex.printStackTrace(); } } else { dbLoad.run(monitor); if (dbLoad.result.getSeverity() == IStatus.ERROR) { throw new DatabaseLoadException(dbLoad.result.getMessage()); } } }
From source file:com.astra.ses.spell.dev.wizards.ProcedureWizard.java
License:Open Source License
@Override public boolean performFinish() { Path path = m_infoPage.getAbsoluteFilePath(); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); boolean result = false; try {/* w ww. j a v a 2 s. co m*/ final IFile file = root.getFile(path); InputStream header = getSourceCodeHeader(); file.create(header, true, null); /* * Perform extended actions */ final ArrayList<IRunnableWithProgress> runnables = new ArrayList<IRunnableWithProgress>(); for (IProcedureCreationExtension extension : m_procedureExtensions) { IRunnableWithProgress job = extension.prepareJob(file); if (job != null) { runnables.add(job); } } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { ProgressMonitorDialog dialog = new ProgressMonitorDialog(new Shell()); try { dialog.setCancelable(true); for (IRunnableWithProgress job : runnables) { dialog.run(false, true, job); } } catch (InvocationTargetException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } }); /* * Open the editor if possible */ IWorkbenchWindow dw = m_workbench.getActiveWorkbenchWindow(); if (dw != null) { IWorkbenchPage page = dw.getActivePage(); if (page != null) { IDE.openEditor(page, file, true); } } result = true; } catch (CoreException e) { e.printStackTrace(); } return result; }
From source file:com.astra.ses.spell.dev.wizards.procs.pages.ProcedureControlVersionWizardPage.java
License:Open Source License
@Override public void performActions() { if (m_controlVersionJob == null) return;// www .ja v a2s . c o m ProgressMonitorDialog dialog = new ProgressMonitorDialog(new Shell()); try { dialog.setCancelable(true); dialog.run(false, true, m_controlVersionJob); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:com.astra.ses.spell.gui.model.commands.helpers.CommandHelper.java
License:Open Source License
public static void executeInProgress(IRunnableWithProgress job, boolean cancellable, boolean fork) { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell()); try {//w w w .j a v a 2 s .co m dialog.setCancelable(cancellable); dialog.run(fork, cancellable, job); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:com.beck.ep.team.internal.TeamListBuilder.java
License:BSD License
public String[] createList(Shell shell, IProject project) throws Exception { error = null;//from www. j ava 2 s .c om RepositoryProvider provider = RepositoryProvider.getProvider(project); if (provider == null) { error = "No Repository provider exist. Project: " + project.getName(); return null; } IListBuilder lb = newListBuilder(provider.getID()); if (lb != null) { String[] sa = lb.createList(shell, project); error = lb.getError(); return sa; } Subscriber subscriber = provider.getSubscriber(); SyncInfoSet set = new SyncInfoSet(); //set.add(SyncInfo.CONFLICTING); Filter filter = new Filter(); ProgressMonitorDialog monitor = new ProgressMonitorDialog(shell); monitor.setCancelable(true); monitor.open(); IResource[] members = project.members(); subscriber.collectOutOfSync(members, IResource.DEPTH_INFINITE, set, monitor.getProgressMonitor()); monitor.close(); SyncInfo[] infos = set.getNodes(filter); String[] sa = new String[infos.length]; for (int i = 0; i < infos.length; i++) { sa[i] = infos[i].getLocal().getProjectRelativePath().toString(); } return sa; }
From source file:com.google.gdt.eclipse.appsmarketplace.job.BackendJob.java
License:Open Source License
public static ProgressMonitorDialog launchBackendJob(BackendJob job, Shell shell) { ProgressMonitorDialog pdlg = new ProgressMonitorDialog(shell); job.setProgressDialog(pdlg);/*from w w w .j a v a2s .c o m*/ pdlg.open(); pdlg.setCancelable(true); Thread thread = new Thread(job); thread.start(); pdlg.setBlockOnOpen(true); return pdlg; }
From source file:com.quantcomponents.ui.marketdata.NewHistoricalData.java
License:Open Source License
private List<IContract> searchContracts() { final List<IContract> contractList = new ArrayList<IContract>(); try {/*w w w . j ava 2 s.c om*/ ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); dialog.setCancelable(true); dialog.run(true, true, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { contractList.addAll(marketDataManager.searchContracts(contractCriteria, new TaskMonitorAdapter(monitor, "Searching contracts..."))); } catch (ConnectException e) { throw new InvocationTargetException(e); } catch (RequestFailedException e) { throw new InvocationTargetException(e); } } }); } catch (Exception e) { MessageDialog.openError(getShell(), "Error", "Contract search error: " + LangUtils.exceptionMessage(e)); return Collections.emptyList(); } if (contractList == null || contractList.isEmpty()) { MessageDialog.openError(this.getShell(), "No results", "Search for contracts returned empty set. Please revise your criteria"); return Collections.emptyList(); } return contractList; }
From source file:com.quantcomponents.ui.marketdata.NewHistoricalData.java
License:Open Source License
private void retrieveHistoricalData(final IStockDatabase stockDatabase, final Date startDateTime, final Date endDateTime) throws InvocationTargetException, InterruptedException { ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); dialog.setCancelable(true); dialog.run(true, true, new IRunnableWithProgress() { @Override//from w ww . j ava 2 s . c o m public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { ITaskMonitor taskMonitor = new TaskMonitorAdapter(monitor, "Retrieving historical data..."); marketDataManager.fillHistoricalData(stockDatabase, startDateTime, endDateTime, taskMonitor); } catch (Exception e) { throw new InvocationTargetException(e); } } }); }
From source file:com.quantcomponents.ui.marketdata.NewHistoricalData.java
License:Open Source License
private void startAutoUpdate(final IStockDatabase stockDatabase) throws InvocationTargetException, InterruptedException { ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); dialog.setCancelable(true); final IRealTimeMarketDataManager realTimeMarketDataManager = (IRealTimeMarketDataManager) marketDataManager; dialog.run(true, true, new IRunnableWithProgress() { @Override/*from ww w. j av a2 s.com*/ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { ITaskMonitor taskMonitor = new TaskMonitorAdapter(monitor, "Starting auto-update..."); realTimeMarketDataManager.startRealtimeUpdate(stockDatabase, true, taskMonitor); } catch (Exception e) { throw new InvocationTargetException(e); } } }); }