Java Code Examples for org.eclipse.core.runtime.IProgressMonitor#beginTask()
The following examples show how to use
org.eclipse.core.runtime.IProgressMonitor#beginTask() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SearchFieldsProgressDialog.java From hop with Apache License 2.0 | 6 votes |
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException { int size = pipelineMeta.findNrPrevTransforms( transformMeta ); try { if ( before ) { monitor.beginTask( BaseMessages.getString( PKG, "SearchFieldsProgressDialog.Dialog.SearchInputFields.Message" ), size ); // Searching // for // input // fields... fields = pipelineMeta.getPrevTransformFields( transformMeta, new ProgressMonitorAdapter( monitor ) ); } else { monitor.beginTask( BaseMessages.getString( PKG, "SearchFieldsProgressDialog.Dialog.SearchOutputFields.Message" ), size ); // Searching // for // output // fields... fields = pipelineMeta.getTransformFields( transformMeta, new ProgressMonitorAdapter( monitor ) ); } } catch ( HopTransformException kse ) { throw new InvocationTargetException( kse, BaseMessages.getString( PKG, "SearchFieldsProgressDialog.Log.UnableToGetFields", transformMeta.toString(), kse.getMessage() ) ); } monitor.done(); }
Example 2
Source File: CleanUpPostSaveListener.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private long getDocumentStamp(IFile file, IProgressMonitor monitor) throws CoreException { final ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager(); final IPath path= file.getFullPath(); monitor.beginTask("", 2); //$NON-NLS-1$ ITextFileBuffer buffer= null; try { manager.connect(path, LocationKind.IFILE, new SubProgressMonitor(monitor, 1)); buffer= manager.getTextFileBuffer(path, LocationKind.IFILE); IDocument document= buffer.getDocument(); if (document instanceof IDocumentExtension4) { return ((IDocumentExtension4)document).getModificationStamp(); } else { return file.getModificationStamp(); } } finally { if (buffer != null) manager.disconnect(path, LocationKind.IFILE, new SubProgressMonitor(monitor, 1)); monitor.done(); } }
Example 3
Source File: ReplaceConditionalWithPolymorphism.java From JDeodorant with MIT License | 6 votes |
@Override public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException { try { pm.beginTask("Creating change...", 1); final Collection<CompilationUnitChange> changes = compilationUnitChanges.values(); CompositeChange change = new CompositeChange(getName(), changes.toArray(new Change[changes.size()])) { @Override public ChangeDescriptor getDescriptor() { ICompilationUnit sourceICompilationUnit = (ICompilationUnit)sourceCompilationUnit.getJavaElement(); String project = sourceICompilationUnit.getJavaProject().getElementName(); String description = MessageFormat.format("Replace Conditional with Polymorphism in method ''{0}''", new Object[] { typeCheckElimination.getTypeCheckMethod().getName().getIdentifier()}); String comment = null; return new RefactoringChangeDescriptor(new ReplaceConditionalWithPolymorphismDescriptor(project, description, comment, sourceFile, sourceCompilationUnit, sourceTypeDeclaration, typeCheckElimination)); } }; return change; } finally { pm.done(); } }
Example 4
Source File: SuperTypeRefactoringProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Performs the first pass of processing the affected compilation units. * * @param creator * the constraints creator to use * @param units * the compilation unit map (element type: * <code><IJavaProject, Set<ICompilationUnit>></code>) * @param groups * the search result group map (element type: * <code><ICompilationUnit, SearchResultGroup></code>) * @param unit * the compilation unit of the subtype * @param node * the compilation unit node of the subtype * @param monitor * the progress monitor to use */ protected final void performFirstPass(final SuperTypeConstraintsCreator creator, final Map<IJavaProject, Set<ICompilationUnit>> units, final Map<ICompilationUnit, SearchResultGroup> groups, final ICompilationUnit unit, final CompilationUnit node, final IProgressMonitor monitor) { try { monitor.beginTask("", 100); //$NON-NLS-1$ monitor.setTaskName(RefactoringCoreMessages.SuperTypeRefactoringProcessor_creating); node.accept(creator); monitor.worked(20); final SearchResultGroup group= groups.get(unit); if (group != null) { final ASTNode[] nodes= ASTNodeSearchUtil.getAstNodes(group.getSearchResults(), node); try { getMethodReferencingCompilationUnits(units, nodes); monitor.worked(40); getFieldReferencingCompilationUnits(units, nodes); monitor.worked(40); } catch (JavaModelException exception) { JavaPlugin.log(exception); } } } finally { monitor.done(); } }
Example 5
Source File: ImportConnectorArchiveOperation.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public void run(final IProgressMonitor monitor) { monitor.beginTask(Messages.importingConnectorArchive, IProgressMonitor.UNKNOWN); if (zipFile == null) { status = ValidationStatus.error("input file not set"); return; } final File tmp = new File(ProjectUtil.getBonitaStudioWorkFolder(), "tmpImportConnectorDir"); tmp.delete(); tmp.mkdir(); try { PlatformUtil.unzipZipFiles(zipFile, tmp, monitor); } catch (final Exception e) { BonitaStudioLog.error(e); } try { FileActionDialog.activateYesNoToAll(); importConnectorDefinition(tmp); importConnectorImplementation(tmp); PlatformUtil.delete(tmp, monitor); } finally { FileActionDialog.deactivateYesNoToAll(); } }
Example 6
Source File: KonsZumVerrechnenView.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
/** * Auwahl der Konsultationen, die verrechnet werden sollen, nach Datum. Es erscheint ein Dialog, * wo man den gewünschten Bereich wählen kann. */ @SuppressWarnings("unchecked") private void doSelectByDate(final IProgressMonitor monitor, final TimeTool fromDate, final TimeTool toDate){ TimeTool actDate = new TimeTool(); // set dates to midnight TimeTool date1 = new TimeTool(fromDate); TimeTool date2 = new TimeTool(toDate); date1.chop(3); date2.add(TimeTool.DAY_OF_MONTH, 1); date2.chop(3); List<Tree> lAll = (List<Tree>) tAll.getChildren(); monitor.beginTask(Messages.KonsZumVerrechnenView_selectByDateTask, lAll.size() + 1); //$NON-NLS-1$ for (Tree tP : lAll) { monitor.worked(1); for (Tree tF : (List<Tree>) tP.getChildren()) { List<Tree> tK = (List<Tree>) tF.getChildren(); for (Tree tk : tK) { Konsultation k = (Konsultation) tk.contents; actDate.set(k.getDatum()); if (actDate.isAfterOrEqual(date1) && actDate.isBefore(date2)) { selectBehandlung((Konsultation) tk.contents, tAll, tSelection); } } if (monitor.isCanceled()) { monitor.done(); return; } } } monitor.done(); }
Example 7
Source File: ConstructorReferenceFinder.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private SearchResultGroup[] getImplicitConstructorReferences(IProgressMonitor pm, WorkingCopyOwner owner, RefactoringStatus status) throws JavaModelException { pm.beginTask("", 2); //$NON-NLS-1$ List<SearchMatch> searchMatches= new ArrayList<SearchMatch>(); searchMatches.addAll(getImplicitConstructorReferencesFromHierarchy(owner, new SubProgressMonitor(pm, 1))); searchMatches.addAll(getImplicitConstructorReferencesInClassCreations(owner, new SubProgressMonitor(pm, 1), status)); pm.done(); return RefactoringSearchEngine.groupByCu(searchMatches.toArray(new SearchMatch[searchMatches.size()]), status); }
Example 8
Source File: RenameRefactoringExecuter.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public void run(IProgressMonitor pm) throws CoreException { try { pm.beginTask("", 11); pm.subTask(""); final RefactoringStatus status = refactoring.checkAllConditions(SubMonitor.convert(pm, 4)); if (status.getSeverity() >= RefactoringStatus.WARNING) { final boolean[] canceled = { false }; shell.getDisplay().syncExec(new Runnable() { @Override public void run() { canceled[0] = showStatusDialog(status); } }); if (canceled[0]) { throw new OperationCanceledException(); } } Change change = refactoring.createChange(SubMonitor.convert(pm, 2)); change.initializeValidationData(SubMonitor.convert(pm, 1)); performChangeOperation = new PerformChangeOperation(change); performChangeOperation.setUndoManager(RefactoringCore.getUndoManager(), refactoring.getName()); performChangeOperation.setSchedulingRule(ResourcesPlugin.getWorkspace().getRoot()); } finally { pm.done(); } }
Example 9
Source File: MoveInstanceMethodProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Checks whether the instance method body is compatible with this * refactoring. * * @param monitor * the progress monitor to display progress * @param declaration * the method declaration whose body to check * @param status * the status of the condition checking */ protected void checkMethodBody(final IProgressMonitor monitor, final MethodDeclaration declaration, final RefactoringStatus status) { Assert.isNotNull(monitor); Assert.isNotNull(declaration); Assert.isNotNull(status); try { monitor.beginTask("", 3); //$NON-NLS-1$ monitor.setTaskName(RefactoringCoreMessages.MoveInstanceMethodProcessor_checking); AstNodeFinder finder= new SuperReferenceFinder(); declaration.accept(finder); if (!finder.getStatus().isOK()) status.merge(finder.getStatus()); monitor.worked(1); finder= null; final IMethodBinding binding= declaration.resolveBinding(); if (binding != null) { final ITypeBinding declaring= binding.getDeclaringClass(); if (declaring != null) finder= new EnclosingInstanceReferenceFinder(declaring); } if (finder != null) { declaration.accept(finder); if (!finder.getStatus().isOK()) status.merge(finder.getStatus()); monitor.worked(1); finder= new RecursiveCallFinder(declaration); declaration.accept(finder); if (!finder.getStatus().isOK()) status.merge(finder.getStatus()); monitor.worked(1); } } finally { monitor.done(); } }
Example 10
Source File: ReplaceConditionalWithPolymorphism.java From JDeodorant with MIT License | 5 votes |
@Override public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException, OperationCanceledException { RefactoringStatus status= new RefactoringStatus(); try { pm.beginTask("Checking preconditions...", 1); } finally { pm.done(); } return status; }
Example 11
Source File: JsonExportWizard.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask(M.Export, models.size()); try (ZipStore store = ZipStore.open(zipFile)) { doExport(monitor, store); monitor.done(); } catch (Exception e) { throw new InvocationTargetException(e); } }
Example 12
Source File: BonitaStudioWorkbenchAdvisor.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask(Messages.shuttingDown, IProgressMonitor.UNKNOWN); UIDesignerServerManager.getInstance().stop(); Job.getJobManager().cancel(StartEngineJob.FAMILY); executePreShutdownContribution(); if (BOSWebServerManager.getInstance().serverIsStarted() && BOSEngineManager.getInstance().isRunning()) { BOSEngineManager.getInstance().stop(); } FileUtil.deleteDir(ProjectUtil.getBonitaStudioWorkFolder()); deleteTomcatTempDir(); monitor.done(); }
Example 13
Source File: MSBuild.java From thym with Eclipse Public License 1.0 | 5 votes |
@Override public void buildNow(IProgressMonitor monitor) throws CoreException { if (monitor.isCanceled()) { return; } try { monitor.beginTask(Messages.MSBuild_BuildProjectTask, 10); SubMonitor generateMonitor =SubMonitor.convert(monitor,5); if (monitor.isCanceled()) { return; } HybridProject hybridProject = HybridProject.getHybridProject(this .getProject()); if (hybridProject == null) { throw new CoreException(new Status(IStatus.ERROR, WPCore.PLUGIN_ID, Messages.MSBuild_NoHybridError)); } String buildType = "--debug"; if(isRelease()){ buildType = "--release"; } hybridProject.build(generateMonitor.split(90), WPProjectUtils.WP8,buildType); File vstudioProjectDir = hybridProject.getProject().getFolder("platforms/wp8").getLocation().toFile(); if (isRelease()) { setBuildArtifact(new File(getBuildDir(vstudioProjectDir), RELEASE_XAP_NAME)); } else { setBuildArtifact(new File(getBuildDir(vstudioProjectDir), DEBUG_XAP_NAME)); } } finally { monitor.done(); } }
Example 14
Source File: RefactorActorMappingsOperation.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask(Messages.refactoringActorMappings, IProgressMonitor.UNKNOWN); final ProcessConfigurationRepositoryStore confStore = RepositoryManager.getInstance() .getRepositoryStore(ProcessConfigurationRepositoryStore.class); final DiagramRepositoryStore diagramStore = RepositoryManager.getInstance() .getRepositoryStore(DiagramRepositoryStore.class); final Comparison comparison = compareOrganizations(); List<Configuration> configurations = getConfigurations(confStore, diagramStore); for (Configuration config : configurations) { EditingDomain editingDomain = TransactionUtil.getEditingDomain(config); if (editingDomain == null) { editingDomain = confStore.getEditingDomain(); } refactorConfiguration(config, comparison, editingDomain); if(config.eContainer() == null) { try { final Resource eResource = config.eResource(); if (eResource != null) { eResource.save(Collections.emptyMap()); } } catch (final IOException e) { BonitaStudioLog.error(e); } } } diagramStore.refresh(); }
Example 15
Source File: PyDocumentChangeForTests.java From Pydev with Eclipse Public License 1.0 | 5 votes |
/** * {@inheritDoc} */ @Override public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException { pm.beginTask("", 1); //$NON-NLS-1$ RefactoringStatus result = TextChanges.isValid(fDocument, fLength); pm.worked(1); return result; }
Example 16
Source File: RenameFieldProcessor.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public Change createChange(IProgressMonitor monitor) throws CoreException { try { monitor.beginTask(RefactoringCoreMessages.RenameFieldRefactoring_checking, 1); TextChange[] changes= fChangeManager.getAllChanges(); RenameJavaElementDescriptor descriptor= createRefactoringDescriptor(); return new DynamicValidationRefactoringChange(descriptor, getProcessorName(), changes); } finally { monitor.done(); } }
Example 17
Source File: CreateFileChange.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
protected IFile getOldFile(IProgressMonitor pm) throws OperationCanceledException { pm.beginTask("", 1); //$NON-NLS-1$ try { return ResourcesPlugin.getWorkspace().getRoot().getFile(fPath); } finally { pm.done(); } }
Example 18
Source File: PushDownRefactoringProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private TextEditBasedChangeManager createChangeManager(final IProgressMonitor monitor, final RefactoringStatus status) throws CoreException { Assert.isNotNull(monitor); Assert.isNotNull(status); try { monitor.beginTask(RefactoringCoreMessages.PushDownRefactoring_checking, 7); final ICompilationUnit source= getDeclaringType().getCompilationUnit(); final CompilationUnitRewrite sourceRewriter= new CompilationUnitRewrite(source); final Map<ICompilationUnit, CompilationUnitRewrite> rewrites= new HashMap<ICompilationUnit, CompilationUnitRewrite>(2); rewrites.put(source, sourceRewriter); IType[] types= getHierarchyOfDeclaringClass(new SubProgressMonitor(monitor, 1)).getSubclasses(getDeclaringType()); final Set<ICompilationUnit> result= new HashSet<ICompilationUnit>(types.length + 1); for (int index= 0; index < types.length; index++) { ICompilationUnit cu= types[index].getCompilationUnit(); if (cu != null) { // subclasses can be in binaries result.add(cu); } } result.add(source); final Map<IMember, IncomingMemberVisibilityAdjustment> adjustments= new HashMap<IMember, IncomingMemberVisibilityAdjustment>(); final List<MemberVisibilityAdjustor> adjustors= new ArrayList<MemberVisibilityAdjustor>(); final ICompilationUnit[] units= result.toArray(new ICompilationUnit[result.size()]); ICompilationUnit unit= null; CompilationUnitRewrite rewrite= null; final IProgressMonitor sub= new SubProgressMonitor(monitor, 4); try { sub.beginTask(RefactoringCoreMessages.PushDownRefactoring_checking, units.length * 4); for (int index= 0; index < units.length; index++) { unit= units[index]; rewrite= getCompilationUnitRewrite(rewrites, unit); if (unit.equals(sourceRewriter.getCu())) { final AbstractTypeDeclaration declaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(getDeclaringType(), rewrite.getRoot()); if (!JdtFlags.isAbstract(getDeclaringType()) && getAbstractDeclarationInfos().length != 0) ModifierRewrite.create(rewrite.getASTRewrite(), declaration).setModifiers((Modifier.ABSTRACT | declaration.getModifiers()), rewrite.createCategorizedGroupDescription(RefactoringCoreMessages.PushDownRefactoring_make_abstract, SET_PUSH_DOWN)); deleteDeclarationNodes(sourceRewriter, false, rewrite, Arrays.asList(getDeletableMembers()), SET_PUSH_DOWN); MemberActionInfo[] methods= getAbstractDeclarationInfos(); for (int offset= 0; offset < methods.length; offset++) declareMethodAbstract(methods[offset], sourceRewriter, rewrite); } final IMember[] members= getAbstractMembers(getAbstractDestinations(new SubProgressMonitor(monitor, 1))); final IType[] classes= new IType[members.length]; for (int offset= 0; offset < members.length; offset++) classes[offset]= (IType) members[offset]; copyMembers(adjustors, adjustments, rewrites, status, getAbstractMemberInfos(), classes, sourceRewriter, rewrite, sub); copyMembers(adjustors, adjustments, rewrites, status, getAffectedMemberInfos(), getAbstractDestinations(new SubProgressMonitor(monitor, 1)), sourceRewriter, rewrite, sub); if (monitor.isCanceled()) throw new OperationCanceledException(); } } finally { sub.done(); } if (!adjustors.isEmpty() && !adjustments.isEmpty()) { final MemberVisibilityAdjustor adjustor= adjustors.get(0); adjustor.rewriteVisibility(new SubProgressMonitor(monitor, 1)); } final TextEditBasedChangeManager manager= new TextEditBasedChangeManager(); for (final Iterator<ICompilationUnit> iterator= rewrites.keySet().iterator(); iterator.hasNext();) { unit= iterator.next(); rewrite= rewrites.get(unit); if (rewrite != null) manager.manage(unit, rewrite.createChange(true)); } return manager; } finally { monitor.done(); } }
Example 19
Source File: ProductSystemGraphEditor.java From olca-app with Mozilla Public License 2.0 | 4 votes |
public void updateModel(final IProgressMonitor monitor) { monitor.beginTask(M.UpdatingProductSystem, IProgressMonitor.UNKNOWN); systemEditor.updateModel(); monitor.done(); }
Example 20
Source File: ClassPathDetector.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
/** * Method detectClasspath. * * @param monitor The progress monitor (not null) * @throws CoreException in case of any failure */ private void detectClasspath(IProgressMonitor monitor) throws CoreException { try { monitor.beginTask(NewWizardMessages.ClassPathDetector_operation_description, 4); fMonitor= monitor; fProject.accept(this, IResource.NONE); monitor.worked(1); ArrayList<IClasspathEntry> cpEntries= new ArrayList<IClasspathEntry>(); detectSourceFolders(cpEntries); if (monitor.isCanceled()) { throw new OperationCanceledException(); } monitor.worked(1); IPath outputLocation= detectOutputFolder(); if (monitor.isCanceled()) { throw new OperationCanceledException(); } monitor.worked(1); detectLibraries(cpEntries, outputLocation); if (monitor.isCanceled()) { throw new OperationCanceledException(); } monitor.worked(1); if (cpEntries.isEmpty() && fClassFiles.isEmpty()) { return; } IClasspathEntry[] jreEntries= PreferenceConstants.getDefaultJRELibrary(); for (int i= 0; i < jreEntries.length; i++) { cpEntries.add(jreEntries[i]); } IClasspathEntry[] entries= cpEntries.toArray(new IClasspathEntry[cpEntries.size()]); if (!JavaConventions.validateClasspath(JavaCore.create(fProject), entries, outputLocation).isOK()) { return; } fResultClasspath= entries; fResultOutputFolder= outputLocation; } finally { monitor.done(); } }