@SuppressWarnings( "unchecked" ) private RowMetaAndData[] doScan( IProgressMonitor monitor ) throws Exception { monitor.beginTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.ScanningFile", filename ), 1 ); monitor.worked( 1 ); if ( monitor.isCanceled() ) { return null; monitor.worked( 1 ); monitor .beginTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.ReadingDocument" ), 1 ); if ( monitor.isCanceled() ) { return null; monitor.worked( 1 ); monitor.beginTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.DocumentOpened" ), 1 ); monitor.worked( 1 ); monitor.beginTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.ReadingNode" ), 1 ); if ( monitor.isCanceled() ) { return null; monitor.worked( 1 ); monitor.subTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.FetchNodes" ) ); if ( monitor.isCanceled() ) { return null;
private void addLoopXPath( Node node, IProgressMonitor monitor ) { Element ce = (Element) node; monitor.worked( 1 ); // List child for ( int j = 0; j < ce.nodeCount(); j++ ) { if ( monitor.isCanceled() ) { return; } Node cnode = ce.node( j ); if ( !Utils.isEmpty( cnode.getName() ) ) { Element cce = (Element) cnode; if ( !listpath.contains( cnode.getPath() ) ) { nr++; monitor.subTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.FetchNodes", String.valueOf( nr ) ) ); monitor.subTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.AddingNode", cnode.getPath() ) ); listpath.add( cnode.getPath() ); } // let's get child nodes if ( cce.nodeCount() > 1 ) { addLoopXPath( cnode, monitor ); } } } }
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException { int size = transMeta.findNrPrevSteps( stepInfo ); try { if ( before ) { monitor.beginTask( BaseMessages.getString( PKG, "SearchFieldsProgressDialog.Dialog.SearchInputFields.Message" ), size ); // Searching // for // input // fields... fields = transMeta.getPrevStepFields( stepInfo, new ProgressMonitorAdapter( monitor ) ); } else { monitor.beginTask( BaseMessages.getString( PKG, "SearchFieldsProgressDialog.Dialog.SearchOutputFields.Message" ), size ); // Searching // for // output // fields... fields = transMeta.getStepFields( stepInfo, new ProgressMonitorAdapter( monitor ) ); } } catch ( KettleStepException kse ) { throw new InvocationTargetException( kse, BaseMessages.getString( PKG, "SearchFieldsProgressDialog.Log.UnableToGetFields", stepInfo.toString(), kse.getMessage() ) ); } monitor.done(); }
private void validateManifestFile(IFile file, IProgressMonitor monitor) { if (monitor.isCanceled()) return; String message = NLS.bind(PDECoreMessages.Builders_verifying, file.getFullPath().toString()); monitor.subTask(message); BundleErrorReporter reporter = new BundleErrorReporter(file); if (reporter != null) { reporter.validateContent(monitor); monitor.subTask(PDECoreMessages.Builders_updating); } monitor.done(); }
try { monitor = ProgressUtil.getMonitorFor(monitor); monitor.beginTask(Messages.loadingTask, 5); InputStream in = new FileInputStream(path.append("catalina.policy").toFile()); in.read(); in.close(); monitor.worked(1); server = (Server) serverFactory.loadDocument(new FileInputStream(path.append("server.xml").toFile())); serverInstance = new ServerInstance(server, null, null); monitor.worked(1); webAppDocument = new WebAppDocument(path.append("web.xml")); monitor.worked(1); tomcatUsersDocument = XMLUtil.getDocumentBuilder().parse(new InputSource(new FileInputStream(path.append("tomcat-users.xml").toFile()))); monitor.worked(1); policyFile = TomcatVersionHelper.getFileContents(new FileInputStream(path.append("catalina.policy").toFile())); monitor.worked(1); if (monitor.isCanceled()) return; monitor.done(); } catch (Exception e) { Trace.trace(Trace.WARNING, "Could not load Tomcat v4.0 configuration from " + path.toOSString() + ": " + e.getMessage()); throw new CoreException(new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorCouldNotLoadConfiguration, path.toOSString()), e));
protected void worked(IProgressMonitor monitor, int work) { if (monitor != null) { if (monitor.isCanceled()) { throw new OperationCanceledException(); } else { monitor.worked(work); } } } /**
@Override protected void collectAll(IResource resource, int depth, final IProgressMonitor monitor) { Policy.checkCanceled(monitor); monitor.beginTask(null, IProgressMonitor.UNKNOWN); ResourceTraversal[] traversals = new ResourceTraversal[] { new ResourceTraversal(new IResource[] { resource }, depth, IResource.NONE) }; try { getSubscriber().accept(traversals, diff -> { Policy.checkCanceled(monitor); monitor.subTask(NLS.bind(Messages.SubscriberDiffTreeEventHandler_0, tree.getResource(diff).getFullPath().toString())); // Queue up any found diffs for inclusion into the output tree queueDispatchEvent( new SubscriberDiffChangedEvent(tree.getResource(diff), SubscriberEvent.CHANGE, IResource.DEPTH_ZERO, diff)); // Handle any pending dispatches handlePreemptiveEvents(monitor); handlePendingDispatch(monitor); return true; }); } catch (CoreException e) { if (resource.getProject().isAccessible()) handleException(e, resource, ITeamStatus.SYNC_INFO_SET_ERROR, e.getMessage()); } finally { monitor.done(); } }
@Override public void run(IProgressMonitor mon) throws InvocationTargetException, InterruptedException { mon.beginTask(PDEUIMessages.FormatManifestOperation_task, fObjects.length); for (int i = 0; !mon.isCanceled() && i < fObjects.length; i++) { Object obj = fObjects[i]; if (obj instanceof IFileEditorInput) obj = ((IFileEditorInput) obj).getFile(); if (obj instanceof IFile) { mon.subTask(NLS.bind(PDEUIMessages.FormatManifestOperation_subtask, ((IFile) obj).getFullPath().toString())); format((IFile) obj, mon); } mon.worked(1); } }
private void createExecFile(IProgressMonitor monitor) throws IOException, CoreException { monitor.beginTask( NLS.bind(CoreMessages.ExportingSession_task, session.getDescription()), 1); final OutputStream out = new BufferedOutputStream(new FileOutputStream( destination)); final ExecutionDataWriter writer = new ExecutionDataWriter(out); session.accept(writer, writer); out.close(); monitor.done(); }
private void modifyClassPaths(IProgressMonitor pm) throws JavaModelException { IProject[] referencing= getProject().getReferencingProjects(); pm.beginTask(RefactoringCoreMessages.RenameJavaProjectChange_update, referencing.length); for (int i= 0; i < referencing.length; i++) { IJavaProject jp= JavaCore.create(referencing[i]); if (jp != null && jp.exists()) { modifyClassPath(jp, new SubProgressMonitor(pm, 1)); } else { pm.worked(1); } } pm.done(); } }
private IStatus refresh(IResource resource, int depth, IProgressMonitor monitor) { monitor = Policy.monitorFor(monitor); try { monitor.beginTask(null, 100); Set<IResource> allChanges = new HashSet<>(); if (getResourceComparator().isThreeWay()) { IResource[] baseChanges = getBaseTree().refresh(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, 25)); allChanges.addAll(Arrays.asList(baseChanges)); } IResource[] remoteChanges = getRemoteTree().refresh(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, 75)); allChanges.addAll(Arrays.asList(remoteChanges)); IResource[] changedResources = allChanges.toArray(new IResource[allChanges.size()]); fireTeamResourceChange(SubscriberChangeEvent.asSyncChangedDeltas(this, changedResources)); return Status.OK_STATUS; } catch (TeamException e) { return new TeamStatus(IStatus.ERROR, TeamPlugin.ID, 0, NLS.bind(Messages.ResourceVariantTreeSubscriber_2, new String[] { resource.getFullPath().toString(), e.getMessage() }), e, resource); } catch (OperationCanceledException e) { return new TeamStatus(IStatus.CANCEL, TeamPlugin.ID, 0, NLS.bind( Messages.ResourceVariantTreeSubscriber_4, new String[] { resource.getFullPath().toString() }), e, resource); } finally { monitor.done(); } }
public final void acceptAST(final ICompilationUnit unit, final CompilationUnit node) { final IProgressMonitor subsubsubMonitor= new SubProgressMonitor(subsubMonitor, 100); try { subsubsubMonitor.beginTask("", 100); //$NON-NLS-1$ subsubsubMonitor.setTaskName(RefactoringCoreMessages.SuperTypeRefactoringProcessor_creating); if (sourceRewrite != null) rewriteTypeOccurrences(manager, this, sourceRewrite, unit, node, replacements, new SubProgressMonitor(subsubsubMonitor, 100)); } catch (CoreException exception) { status.merge(RefactoringStatus.createFatalErrorStatus(exception.getLocalizedMessage())); } finally { subsubsubMonitor.done(); } }
/** * Check whether the build has been canceled. */ public void checkCancel() { if (this.monitor != null && this.monitor.isCanceled()) throw new OperationCanceledException(); }
@Override public IStatus run(IProgressMonitor monitor) { if (monitor.isCanceled()) return Status.CANCEL_STATUS; notificationRequested = true; try { workspace.run(noop, null, IResource.NONE, null); } catch (CoreException e) { return e.getStatus(); } return Status.OK_STATUS; } }
public boolean isCanceled() { return monitor.isCanceled(); }
public static void convertToOSGIFormat(IProject project, String target, Dictionary dictionary, HashMap newProps, IProgressMonitor monitor) throws CoreException { try { File outputFile = new File(project.getLocation().append( "META-INF/MANIFEST.MF").toOSString()); //$NON-NLS-1$ File inputFile = new File(project.getLocation().toOSString()); PluginConverter converter = PluginConverter.getDefault(); converter.convertManifest(inputFile, outputFile, false, target, true, dictionary); if (newProps != null && newProps.size() > 0) converter.writeManifest(outputFile, getProperties(outputFile, newProps), false); project.refreshLocal(IResource.DEPTH_INFINITE, null); } catch (PluginConversionException e) { } finally { monitor.done(); } }
public final Change perform(IProgressMonitor pm) throws CoreException, OperationCanceledException { pm.beginTask(getName(), 2); try { String newName= getNewResourceName(); IPackageFragmentRoot root= getRoot(); ResourceMapping mapping= JavaElementResourceMapping.create(root); final Change result= doPerformReorg(getDestinationProjectPath().append(newName), new SubProgressMonitor(pm, 1)); markAsExecuted(root, mapping); return result; } finally { pm.done(); } }
protected IStatus run(IProgressMonitor monitor) { monitor.beginTask("", 10); //$NON-NLS-1$ try { JavaCore.initializeAfterLoad(new SubProgressMonitor(monitor, 6)); JavaPlugin.initializeAfterLoad(new SubProgressMonitor(monitor, 4)); } catch (CoreException e) { JavaPlugin.log(e); return e.getStatus(); } return new Status(IStatus.OK, JavaPlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$ } public boolean belongsTo(Object family) {