List of usage examples for org.eclipse.jface.operation IRunnableWithProgress IRunnableWithProgress
IRunnableWithProgress
From source file:com.aspose.barcode.maven.examples.AsposeExampleWizardPage.java
License:Open Source License
private void downloadExamplesRepo() { // download code examples with status progress try {/*from w w w .ja v a 2 s.co m*/ new ProgressMonitorDialog(this.getShell()).run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("Downloading latest example categories...", IProgressMonitor.UNKNOWN); AsposeMavenProjectManager.initialize(null); AsposeJavaAPI component = AsposeBarCodeJavaAPI .initialize(AsposeMavenProjectManager.getInstance()); component.checkAndUpdateRepo(); monitor.done(); } }); } catch (InvocationTargetException | InterruptedException e) { e.printStackTrace(); } }
From source file:com.aspose.cells.maven.examples.AsposeExampleWizardPage.java
License:Open Source License
private void downloadExamplesRepo() { // download code examples with status progress try {/*from w ww .j a va2 s . c om*/ new ProgressMonitorDialog(this.getShell()).run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("Downloading latest example categories...", IProgressMonitor.UNKNOWN); AsposeMavenProjectManager.initialize(null); AsposeJavaAPI component = AsposeCellsJavaAPI .initialize(AsposeMavenProjectManager.getInstance()); component.checkAndUpdateRepo(); monitor.done(); } }); } catch (InvocationTargetException | InterruptedException e) { e.printStackTrace(); } }
From source file:com.aspose.eclipse.maven.wizard.AsposeMavenNewProjectWizard.java
License:Open Source License
/** * // w w w. ja v a 2 s . c o m */ @Override public boolean performFinish() { final Model model = getModel(); // final String projectName = importConfiguration.getProjectName(model); final String projectName = model.getName(); IStatus nameStatus = importConfiguration.validateProjectName(model); if (!nameStatus.isOK()) { MessageDialog.openError(getShell(), NLS.bind(Messages.wizardProjectJobFailed, projectName), nameStatus.getMessage()); return false; } if (!AsposeMavenManager.isInternetConnected()) { MessageDialog.openError(getShell(), NLS.bind(AsposeConstants.INTERNET_CONNECTION_REQUIRED_MESSAGE_TITLE, projectName), AsposeConstants.MAVEN_INTERNET_CONNECTION_REQUIRED_MESSAGE); return false; } IWorkspace workspace = ResourcesPlugin.getWorkspace(); final IPath location; if (!_pageTwo.useDefaults()) { location = _pageTwo.getLocationPath(); } else location = null; final IWorkspaceRoot root = workspace.getRoot(); final IProject project = importConfiguration.getProject(root, model); final IPath pomFile; if (location == null || root.getLocation().equals(location)) { pomFile = root.getLocation().append(project.getName()).append(IMavenConstants.POM_FILE_NAME); } else { pomFile = location.append(IMavenConstants.POM_FILE_NAME); } if (pomFile.toFile().exists()) { MessageDialog.openError(getShell(), NLS.bind(Messages.wizardProjectJobFailed, projectName), Messages.wizardProjectErrorPomAlreadyExists); return false; } final AbstractCreateMavenProjectJob job; final String[] folders = _pageOne.getFolders(); ProgressMonitorDialog dialog = new ProgressMonitorDialog(null); try { dialog.run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { monitor.beginTask("Retrieving Aspose Maven Dependencies ...", AsposeMavenProject.getApiList().size()); AsposeMavenManager.retrieveAsposeMavenDependencies(monitor); } }); } catch (InvocationTargetException | InterruptedException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } job = new AbstractCreateMavenProjectJob(NLS.bind(Messages.wizardProjectJobCreatingProject, projectName), workingSets) { @Override protected List<IProject> doCreateMavenProjects(IProgressMonitor monitor) throws CoreException { MavenPlugin.getProjectConfigurationManager().createSimpleProject(project, location, model, folders, // importConfiguration, monitor); try { Document pomDocument = AsposeMavenManager.getXmlDocument(pomFile.toString()); // Get the root element Node projectNode = pomDocument.getFirstChild(); // Adding Aspose Cloud Maven Repository configuration // setting here AsposeMavenManager.addAsposeMavenRepositoryConfiguration(pomDocument, projectNode); // Adding Dependencies here Element dependenciesTag = pomDocument.createElement("dependencies"); projectNode.appendChild(dependenciesTag); for (Metadata dependency : AsposeMavenManager.getAsposeProjectMavenDependencies()) { AsposeMavenManager.addAsposeMavenDependency(pomDocument, dependenciesTag, dependency); } AsposeMavenManager.updatePOM(pomDocument, monitor, project); } catch (ParserConfigurationException | SAXException | IOException | TransformerConfigurationException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (TransformerException e) { // TODO Auto-generated catch block e.printStackTrace(); } return Arrays.asList(project); } }; job.addJobChangeListener(new JobChangeAdapter() { public void done(IJobChangeEvent event) { final IStatus result = event.getResult(); if (!result.isOK()) { Display.getDefault().asyncExec(new Runnable() { public void run() { MessageDialog.openError(getShell(), // NLS.bind(Messages.wizardProjectJobFailed, projectName), result.getMessage()); } }); } MappingDiscoveryJob discoveryJob = new MappingDiscoveryJob(job.getCreatedProjects()); discoveryJob.schedule(); } }); job.setRule(MavenPlugin.getProjectConfigurationManager().getRule()); job.schedule(); return true; }
From source file:com.aspose.email.maven.examples.AsposeExampleWizardPage.java
License:Open Source License
private void downloadExamplesRepo() { // download code examples with status progress try {//from w w w .j a v a2 s . com new ProgressMonitorDialog(this.getShell()).run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("Downloading latest example categories...", IProgressMonitor.UNKNOWN); AsposeMavenProjectManager.initialize(null); AsposeJavaAPI component = AsposeEmailJavaAPI .initialize(AsposeMavenProjectManager.getInstance()); component.checkAndUpdateRepo(); monitor.done(); } }); } catch (InvocationTargetException | InterruptedException e) { e.printStackTrace(); } }
From source file:com.aspose.pdf.maven.examples.AsposeExampleWizardPage.java
License:Open Source License
private void downloadExamplesRepo() { // download code examples with status progress try {// ww w . jav a2 s .c o m new ProgressMonitorDialog(this.getShell()).run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("Downloading latest example categories...", IProgressMonitor.UNKNOWN); AsposeMavenProjectManager.initialize(null); AsposeJavaAPI component = AsposePdfJavaAPI.initialize(AsposeMavenProjectManager.getInstance()); component.checkAndUpdateRepo(); monitor.done(); } }); } catch (InvocationTargetException | InterruptedException e) { e.printStackTrace(); } }
From source file:com.aspose.slides.maven.examples.AsposeExampleWizardPage.java
License:Open Source License
private void downloadExamplesRepo() { // download code examples with status progress try {//from w w w .ja v a 2s .com new ProgressMonitorDialog(this.getShell()).run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("Downloading latest example categories...", IProgressMonitor.UNKNOWN); AsposeMavenProjectManager.initialize(null); AsposeJavaAPI component = AsposeSlidesJavaAPI .initialize(AsposeMavenProjectManager.getInstance()); component.checkAndUpdateRepo(); monitor.done(); } }); } catch (InvocationTargetException | InterruptedException e) { e.printStackTrace(); } }
From source file:com.aspose.tasks.maven.examples.AsposeExampleWizardPage.java
License:Open Source License
private void downloadExamplesRepo() { // download code examples with status progress try {/* ww w. ja v a2 s . co m*/ new ProgressMonitorDialog(this.getShell()).run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("Downloading latest example categories...", IProgressMonitor.UNKNOWN); AsposeMavenProjectManager.initialize(null); AsposeJavaAPI component = AsposeTasksJavaAPI .initialize(AsposeMavenProjectManager.getInstance()); component.checkAndUpdateRepo(); monitor.done(); } }); } catch (InvocationTargetException | InterruptedException e) { e.printStackTrace(); } }
From source file:com.aspose.words.maven.examples.AsposeExampleWizardPage.java
License:Open Source License
private void downloadExamplesRepo() { // download code examples with status progress try {// w w w. ja v a 2s .c o m new ProgressMonitorDialog(this.getShell()).run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("Downloading latest example categories...", IProgressMonitor.UNKNOWN); AsposeMavenProjectManager.initialize(null); AsposeJavaAPI component = AsposeWordsJavaAPI .initialize(AsposeMavenProjectManager.getInstance()); component.checkAndUpdateRepo(); monitor.done(); } }); } catch (InvocationTargetException | InterruptedException e) { e.printStackTrace(); } }
From source file:com.astra.ses.spell.database.db.ui.wizards.DatabaseFileWizard.java
License:Open Source License
/** * This method is called when 'Finish' button is pressed in * the wizard. We will create an operation and run it * using wizard as execution context./* w w w .j a v a 2 s . c o m*/ */ public boolean performFinish() { final String containerName = page.getContainerName(); final String fileName = page.getFileName(); IRunnableWithProgress op = new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException { try { doFinish(containerName, fileName, monitor); } catch (CoreException e) { throw new InvocationTargetException(e); } finally { monitor.done(); } } }; try { getContainer().run(true, false, op); } catch (InterruptedException e) { return false; } catch (InvocationTargetException e) { Throwable realException = e.getTargetException(); MessageDialog.openError(getShell(), "Error", realException.getMessage()); return false; } return true; }
From source file:com.atlassian.connector.eclipse.internal.crucible.ui.wizards.ResourceSelectionPage.java
License:Open Source License
private void populateResourcesTree() { resourcesToShow.clear();// ww w .j av a2 s.c o m IRunnableWithProgress getModifiedResources = new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { SubMonitor.convert(monitor, "Getting workspace resources data", IProgressMonitor.UNKNOWN); final Collection<IResource> resources = MiscUtil.buildLinkedHashSet(); resources.addAll(teamConnector.getResourcesByFilterRecursive( roots.toArray(new IResource[roots.size()]), ITeamUiResourceConnector.State.SF_ALL)); for (IResource resource : resources) { if (resource instanceof IFile) { // collect all scmPaths in order to find missing mappings String path = TeamUiUtils.getScmPath(resource, teamConnector); if (path != null) { scmPaths.add(path); } DecoratedResource dr = TeamUiUtils.getDecoratedResource(resource, teamConnector); if (dr != null) { resourcesToShow.add(dr); } } } } }; try { getContainer().run(false, false, getModifiedResources); } catch (InvocationTargetException e) { StatusHandler.log(new Status(IStatus.WARNING, CrucibleUiPlugin.PLUGIN_ID, "Can't get list of modified resources", e)); } catch (InterruptedException e) { StatusHandler.log(new Status(IStatus.WARNING, CrucibleUiPlugin.PLUGIN_ID, "Can't get list of modified resources", e)); } resourceSelectionTree.setResources(resourcesToShow); resourceSelectionTree.refresh(); resourceSelectionTree.setAllChecked(true); validatePage(); }