Java Code Examples for org.eclipse.core.runtime.IProgressMonitor#done()
The following examples show how to use
org.eclipse.core.runtime.IProgressMonitor#done() .
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: ShowDifferencesAsUnifiedDiffOperation.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
protected void execute(IProgressMonitor monitor) throws SVNException, InterruptedException { ISVNClientAdapter client = null; ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(fromUrl.toString()); if (repository != null) client = repository.getSVNClient(); if (client == null) client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient(); try { SVNRevision pegRevision = null; if (fromUrl.toString().equals(toUrl.toString()) && localResource != null) { if (localResource.getResource() == null) pegRevision = SVNRevision.HEAD; else { IResource resource = localResource.getResource(); ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource); pegRevision = svnResource.getRevision(); } } if (pegRevision == null) client.diff(fromUrl, fromRevision, toUrl, toRevision, file, true); else client.diff(fromUrl, pegRevision, fromRevision, toRevision, file, true); } catch (SVNClientException e) { throw SVNException.wrapException(e); } finally { monitor.done(); SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client); } }
Example 2
Source File: ObtainInterpreterInfoOperation.java From Pydev with Eclipse Public License 1.0 | 6 votes |
/** * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor) */ @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor = new OperationMonitor(monitor, logger); monitor.beginTask("Getting libs", 100); try { InterpreterInfo interpreterInfo = (InterpreterInfo) interpreterManager.createInterpreterInfo(file, monitor, !autoSelect); if (interpreterInfo != null) { result = interpreterInfo; } } catch (Exception e) { logger.println("Exception detected: " + e.getMessage()); this.e = e; } monitor.done(); }
Example 3
Source File: ModulaSearchOperation.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
private void searchForSymbolDeclaration(Map<IFile, IDocument> documentsCache2, IProgressMonitor monitor) { if (JavaUtils.areFlagsSet(fInput.getLimitTo(), ModulaSearchInput.LIMIT_TO_DECLARATIONS)) { Map<IFile, IDocument> documentsCache = ModulaSearchUtils.evalNonFileBufferDocument(); IModulaSymbol symbolToSearchFor = fInput.getSymbolToSearchFor(); if (symbolToSearchFor != null) { monitor.beginTask("", 1); //$NON-NLS-1$ try { IFile symbolFile = ModulaSymbolUtils.findFirstFileForSymbol(fInput.getProject(), symbolToSearchFor); if (symbolFile != null) { Collection<IModulaSymbol> sameEntitySymbols = EntityUtils.syncGetRelatedSymbols(symbolFile.getProject(), fInput.isSearchOnlyInCompilationSet(), symbolToSearchFor); for (IModulaSymbol sameEntitySymbol : sameEntitySymbols) { symbolFile = ModulaSymbolUtils.findFirstFileForSymbol(fInput.getProject(), sameEntitySymbol); if (symbolFile != null) { Collection<Match> matches = createMatchesFromSymbol(symbolFile, sameEntitySymbol); for (Match match : matches) { acceptMatch(documentsCache, match); } } } } } finally { monitor.done(); } } } }
Example 4
Source File: CreateGhidraScriptProjectWizard.java From ghidra with Apache License 2.0 | 6 votes |
/** * Creates a Ghidra script project. * * @param ghidraInstallDir The Ghidra installation directory to use. * @param projectName The name of the project to create. * @param projectDir The project's directory. * @param createRunConfig Whether or not to create a new run configuration for the project. * @param runConfigMemory The run configuration's desired memory. Could be null. * @param linkUserScripts Whether or not to link in the user scripts directory. * @param linkSystemScripts Whether or not to link in the system scripts directories. * @param jythonInterpreterName The name of the Jython interpreter to use for Python support. * Could be null if Python support is not wanted. * @param monitor The monitor to use during project creation. * @throws InvocationTargetException if an error occurred during project creation. */ private void create(File ghidraInstallDir, String projectName, File projectDir, boolean createRunConfig, String runConfigMemory, boolean linkUserScripts, boolean linkSystemScripts, String jythonInterpreterName, IProgressMonitor monitor) throws InvocationTargetException { try { info("Creating " + projectName + " at " + projectDir); monitor.beginTask("Creating " + projectName, 2); GhidraApplicationLayout ghidraLayout = new GhidraApplicationLayout(ghidraInstallDir); monitor.worked(1); GhidraScriptUtils.createGhidraScriptProject(projectName, projectDir, createRunConfig, runConfigMemory, linkUserScripts, linkSystemScripts, ghidraLayout, jythonInterpreterName, monitor); monitor.worked(1); info("Finished creating " + projectName); } catch (IOException | ParseException | CoreException e) { throw new InvocationTargetException(e); } finally { monitor.done(); } }
Example 5
Source File: CreateCopyOfCompilationUnitChange.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override protected IFile getOldFile(IProgressMonitor monitor) throws OperationCanceledException { try { monitor.beginTask("", 12); //$NON-NLS-1$ String oldSource= super.getSource(); IPath oldPath= super.getPath(); String newTypeName= fNameQuery.getNewName(); try { String newSource= getCopiedFileSource(new SubProgressMonitor(monitor, 9), fOldCu, newTypeName); setSource(newSource); setPath(fOldCu.getResource().getParent().getFullPath().append(JavaModelUtil.getRenamedCUName(fOldCu, newTypeName))); return super.getOldFile(new SubProgressMonitor(monitor, 1)); } catch (CoreException e) { setSource(oldSource); setPath(oldPath); return super.getOldFile(new SubProgressMonitor(monitor, 2)); } } finally { monitor.done(); } }
Example 6
Source File: SVNProjectSetCapability.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * Creates a new project in the workbench from an existing one * * @param monitor * @throws CoreException */ void createExistingProject(IProgressMonitor monitor) throws CoreException { String projectName = project.getName(); IProjectDescription description; try { monitor.beginTask("Creating " + projectName, 2 * 1000); description = ResourcesPlugin.getWorkspace() .loadProjectDescription( new Path(directory + File.separatorChar + ".project")); //$NON-NLS-1$ description.setName(projectName); project.create(description, new SubProgressMonitor(monitor, 1000)); project.open(new SubProgressMonitor(monitor, 1000)); } finally { monitor.done(); } }
Example 7
Source File: CloseAllOpenOrders.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
@Override public String executeMaintenance(final IProgressMonitor pm, String DBVersion){ StringBuilder output = new StringBuilder(); pm.beginTask("Bitte warten, Bestellungen werden geschlossen ...", IProgressMonitor.UNKNOWN); Query<BestellungEntry> qre = new Query<BestellungEntry>(BestellungEntry.class); qre.add(BestellungEntry.FLD_STATE, Query.NOT_EQUAL, Integer.toString(BestellungEntry.STATE_DONE)); List<BestellungEntry> openEntries = qre.execute(); for (BestellungEntry bestellungEntry : openEntries) { bestellungEntry.setState(BestellungEntry.STATE_DONE); } output.append(openEntries.size() + " offene Bestelleinträge geschlossen.\n"); pm.done(); return output.toString(); }
Example 8
Source File: PushDownRefactoringProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private RefactoringStatus checkAccessedFields(IType[] subclasses, IProgressMonitor pm) throws JavaModelException { RefactoringStatus result= new RefactoringStatus(); IMember[] membersToPushDown= MemberActionInfo.getMembers(getInfosForMembersToBeCreatedInSubclassesOfDeclaringClass()); List<IMember> pushedDownList= Arrays.asList(membersToPushDown); IField[] accessedFields= ReferenceFinderUtil.getFieldsReferencedIn(membersToPushDown, pm); for (int i= 0; i < subclasses.length; i++) { IType targetClass= subclasses[i]; ITypeHierarchy targetSupertypes= targetClass.newSupertypeHierarchy(null); for (int j= 0; j < accessedFields.length; j++) { IField field= accessedFields[j]; boolean isAccessible= pushedDownList.contains(field) || canBeAccessedFrom(field, targetClass, targetSupertypes) || Flags.isEnum(field.getFlags()); if (!isAccessible) { String message= Messages.format(RefactoringCoreMessages.PushDownRefactoring_field_not_accessible, new String[] { JavaElementLabels.getTextLabel(field, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getTextLabel(targetClass, JavaElementLabels.ALL_FULLY_QUALIFIED) }); result.addError(message, JavaStatusContext.create(field)); } } } pm.done(); return result; }
Example 9
Source File: RenameJavaProjectProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public Change createChange(IProgressMonitor monitor) throws CoreException { try { monitor.beginTask("", 1); //$NON-NLS-1$ final String description= Messages.format(RefactoringCoreMessages.RenameJavaProjectProcessor_descriptor_description_short, BasicElementLabels.getJavaElementName(fProject.getElementName())); final String header= Messages.format(RefactoringCoreMessages.RenameJavaProjectChange_descriptor_description, new String[] { BasicElementLabels.getJavaElementName(fProject.getElementName()), BasicElementLabels.getJavaElementName(getNewElementName())}); final String comment= new JDTRefactoringDescriptorComment(null, this, header).asString(); final int flags= RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE | RefactoringDescriptor.BREAKING_CHANGE; final RenameJavaElementDescriptor descriptor= RefactoringSignatureDescriptorFactory.createRenameJavaElementDescriptor(IJavaRefactorings.RENAME_JAVA_PROJECT); descriptor.setProject(null); descriptor.setDescription(description); descriptor.setComment(comment); descriptor.setFlags(flags); descriptor.setJavaElement(fProject); descriptor.setNewName(getNewElementName()); descriptor.setUpdateReferences(fUpdateReferences); return new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.RenameJavaProjectRefactoring_rename, new Change[] { new RenameJavaProjectChange(fProject, getNewElementName(), fUpdateReferences)}); } finally { monitor.done(); } }
Example 10
Source File: ChangeTypeRefactoring.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Determine the set of constraint variables related to the selected * expression. In addition to the expression itself, this consists of * any expression that is defines-equal to it, and any expression equal * to it. * @param cv * @param pm * @return the constraint variables * @throws CoreException */ private Collection<ConstraintVariable> findRelevantConstraintVars(ConstraintVariable cv, IProgressMonitor pm) throws CoreException { pm.beginTask(RefactoringCoreMessages.ChangeTypeRefactoring_analyzingMessage, 150); Collection<ConstraintVariable> result= new HashSet<ConstraintVariable>(); result.add(cv); ICompilationUnit[] cus= collectAffectedUnits(new SubProgressMonitor(pm, 50)); Collection<ITypeConstraint> allConstraints= getConstraints(cus, new SubProgressMonitor(pm, 50)); List<ConstraintVariable> workList= new ArrayList<ConstraintVariable>(result); while(! workList.isEmpty()){ pm.worked(10); ConstraintVariable first= workList.remove(0); for (Iterator<ITypeConstraint> iter= allConstraints.iterator(); iter.hasNext();) { pm.worked(1); ITypeConstraint typeConstraint= iter.next(); if (! typeConstraint.isSimpleTypeConstraint()) continue; SimpleTypeConstraint stc= (SimpleTypeConstraint)typeConstraint; if (! stc.isDefinesConstraint() && ! stc.isEqualsConstraint()) continue; ConstraintVariable match= match(first, stc.getLeft(), stc.getRight()); if (match instanceof ExpressionVariable || match instanceof ParameterTypeVariable || match instanceof ReturnTypeVariable){ if (! result.contains(match)){ workList.add(match); result.add(match); } } } } pm.done(); return result; }
Example 11
Source File: RenameFieldProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.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 12
Source File: SARLProjectConfigurator.java From sarl with Apache License 2.0 | 5 votes |
private static IFolder ensureSourceFolder(IProject project, String folderPath, boolean isIFolderRequired, boolean createFolder, IProgressMonitor monitor) throws CoreException { final IFolder folder = project.getFolder(Path.fromPortableString(folderPath)); if (!folder.exists()) { if (createFolder) { CoreUtility.createFolder(folder, true, true, monitor); } else if (!isIFolderRequired) { monitor.done(); return null; } } monitor.done(); return folder; }
Example 13
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 14
Source File: PackageReorgChange.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public final Change perform(IProgressMonitor pm) throws CoreException, OperationCanceledException { pm.beginTask(getName(), 1); try { IPackageFragment pack= getPackage(); ResourceMapping mapping= JavaElementResourceMapping.create(pack); final Change result= doPerformReorg(pm); markAsExecuted(pack, mapping); return result; } finally { pm.done(); } }
Example 15
Source File: StubCreationOperation.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Runs the stub generation on the specified class file. * * @param file * the class file * @param parent * the parent store * @param monitor * the progress monitor to use * @throws CoreException * if an error occurs */ @Override protected void run(final IClassFile file, final IFileStore parent, final IProgressMonitor monitor) throws CoreException { try { monitor.beginTask(RefactoringCoreMessages.StubCreationOperation_creating_type_stubs, 2); SubProgressMonitor subProgressMonitor= new SubProgressMonitor(monitor, 1); final IType type= file.getType(); if (type.isAnonymous() || type.isLocal() || type.isMember()) return; String source= new StubCreator(fStubInvisible).createStub(type, subProgressMonitor); createCompilationUnit(parent, type.getElementName() + JavaModelUtil.DEFAULT_CU_SUFFIX, source, monitor); } finally { monitor.done(); } }
Example 16
Source File: SplitTmxDialog.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { Display.getDefault().syncExec(new Runnable() { @Override public void run() { getDialogSetting().put("splitTmx.isSaveBtnSelection", saveAsBtn.getSelection()); splitFileLC = splitFileLCText.getText(); if (originalLcBtn.getSelection()) { tgtFolderLC = new File(splitFileLC).getParent(); }else { tgtFolderLC = tgtFolderLCTxt.getText(); } fileSum = fileSumSpinner.getSelection(); // 进行分割前的判断 if (!new File(splitFileLC).exists()) { OpenMessageUtils.openMessage(IStatus.INFO, MessageFormat.format(Messages.getString("dialog.SplitTmxDiialog.split.info.msg"), splitFileLC)); return; } } }); SplitTmx splitTmx = new SplitTmx(splitFileLC, tgtFolderLC, fileSum); try { splitTmx.beginSplit(monitor); } catch (Exception e) { e.printStackTrace(); } monitor.done(); }
Example 17
Source File: AbstractDeleteChange.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
protected static void saveFileIfNeeded(IFile file, IProgressMonitor pm) throws CoreException { ITextFileBuffer buffer= FileBuffers.getTextFileBufferManager().getTextFileBuffer(file.getFullPath(), LocationKind.IFILE); if (buffer != null && buffer.isDirty() && buffer.isStateValidated() && buffer.isSynchronized()) { pm.beginTask("", 2); //$NON-NLS-1$ buffer.commit(new SubProgressMonitor(pm, 1), false); file.refreshLocal(IResource.DEPTH_ONE, new SubProgressMonitor(pm, 1)); } pm.done(); }
Example 18
Source File: TexlipseBuilder.java From texlipse with Eclipse Public License 1.0 | 5 votes |
/** * Clean the temporary files. * * @see IncrementalProjectBuilder.clean */ @Override protected void clean(IProgressMonitor monitor) throws CoreException { IProject project = getProject(); final ProjectFileTracking fileTracking = new ProjectFileTracking(project); final OutputFileManager fileManager = new OutputFileManager(project, fileTracking); BuilderRegistry.clearConsole(); // reset session variables TexlipseProperties.setSessionProperty(project, TexlipseProperties.SESSION_LATEX_RERUN, null); TexlipseProperties.setSessionProperty(project, TexlipseProperties.SESSION_BIBTEX_RERUN, null); TexlipseProperties.setSessionProperty(project, TexlipseProperties.BIBFILES_CHANGED, null); // check main file String mainFile = TexlipseProperties.getProjectProperty(project, TexlipseProperties.MAINFILE_PROPERTY); if (mainFile == null || mainFile.length() == 0) { // main tex file not set -> nothing builded -> nothing to clean return; } fileManager.cleanTempFiles(monitor); fileManager.cleanOutputFile(monitor); monitor.subTask(TexlipsePlugin.getResourceString("builderSubTaskCleanMarkers")); this.deleteMarkers(project); project.refreshLocal(IProject.DEPTH_INFINITE, monitor); monitor.done(); }
Example 19
Source File: RenameLocalVariableProcessor.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.RenameTypeProcessor_creating_changes, 1); RenameJavaElementDescriptor descriptor= createRefactoringDescriptor(); fChange.setDescriptor(new RefactoringChangeDescriptor(descriptor)); return fChange; } finally { monitor.done(); } }
Example 20
Source File: ImplementationCollector.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
private List<T> findMethodImplementations(IProgressMonitor monitor) throws CoreException { IMethod method = (IMethod) javaElement; try { if (cannotBeOverriddenMethod(method)) { return null; } } catch (JavaModelException e) { JavaLanguageServerPlugin.logException("Find method implementations failure ", e); return null; } CompilationUnit ast = CoreASTProvider.getInstance().getAST(typeRoot, CoreASTProvider.WAIT_YES, monitor); if (ast == null) { return null; } ASTNode node = NodeFinder.perform(ast, region.getOffset(), region.getLength()); ITypeBinding parentTypeBinding = null; if (node instanceof SimpleName) { ASTNode parent = node.getParent(); if (parent instanceof MethodInvocation) { Expression expression = ((MethodInvocation) parent).getExpression(); if (expression == null) { parentTypeBinding= Bindings.getBindingOfParentType(node); } else { parentTypeBinding = expression.resolveTypeBinding(); } } else if (parent instanceof SuperMethodInvocation) { // Directly go to the super method definition return Collections.singletonList(mapper.convert(method, 0, 0)); } else if (parent instanceof MethodDeclaration) { parentTypeBinding = Bindings.getBindingOfParentType(node); } } final IType receiverType = getType(parentTypeBinding); if (receiverType == null) { return null; } final List<T> results = new ArrayList<>(); try { String methodLabel = JavaElementLabelsCore.getElementLabel(method, JavaElementLabelsCore.DEFAULT_QUALIFIED); monitor.beginTask(Messages.format(JavaElementImplementationHyperlink_search_method_implementors, methodLabel), 10); SearchRequestor requestor = new SearchRequestor() { @Override public void acceptSearchMatch(SearchMatch match) throws CoreException { if (match.getAccuracy() == SearchMatch.A_ACCURATE) { Object element = match.getElement(); if (element instanceof IMethod) { IMethod methodFound = (IMethod) element; if (!JdtFlags.isAbstract(methodFound)) { T result = mapper.convert(methodFound, match.getOffset(), match.getLength()); if (result != null) { results.add(result); } } } } } }; IJavaSearchScope hierarchyScope; if (receiverType.isInterface()) { hierarchyScope = SearchEngine.createHierarchyScope(method.getDeclaringType()); } else { if (isFullHierarchyNeeded(new SubProgressMonitor(monitor, 3), method, receiverType)) { hierarchyScope = SearchEngine.createHierarchyScope(receiverType); } else { boolean isMethodAbstract = JdtFlags.isAbstract(method); hierarchyScope = SearchEngine.createStrictHierarchyScope(null, receiverType, true, isMethodAbstract, null); } } int limitTo = IJavaSearchConstants.DECLARATIONS | IJavaSearchConstants.IGNORE_DECLARING_TYPE | IJavaSearchConstants.IGNORE_RETURN_TYPE; SearchPattern pattern = SearchPattern.createPattern(method, limitTo); Assert.isNotNull(pattern); SearchParticipant[] participants = new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() }; SearchEngine engine = new SearchEngine(); engine.search(pattern, participants, hierarchyScope, requestor, new SubProgressMonitor(monitor, 7)); if (monitor.isCanceled()) { throw new OperationCanceledException(); } } finally { monitor.done(); } return results; }