当前位置: 首页>>代码示例>>C#>>正文


C# IProgressMonitor.isCanceled方法代码示例

本文整理汇总了C#中IProgressMonitor.isCanceled方法的典型用法代码示例。如果您正苦于以下问题:C# IProgressMonitor.isCanceled方法的具体用法?C# IProgressMonitor.isCanceled怎么用?C# IProgressMonitor.isCanceled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IProgressMonitor的用法示例。


在下文中一共展示了IProgressMonitor.isCanceled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: run

			protected override IStatus run(IProgressMonitor monitor) {
				try {
					compiler.compile(monitor);
				} catch {
				}
				return (monitor.isCanceled()) ? Status.CANCEL_STATUS : Status.OK_STATUS;
			}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:7,代码来源:BackgroundCompiler.stab.cs

示例2: runInUIThread

			public override IStatus runInUIThread(IProgressMonitor monitor) {
				try {
					monitor.beginTask("", 1);
					editor.Highlighter.update(text, compilationUnit, typeSystem, annotatedTypeSystem);
					monitor.worked(1);
					monitor.done();
				} catch {
				}
				return (monitor.isCanceled()) ? Status.CANCEL_STATUS : Status.OK_STATUS;
			}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:10,代码来源:BackgroundCompiler.stab.cs

示例3: refresh

			IStatus refresh(IProgressMonitor monitor) {
				if (treeViewer.getControl().isDisposed()) {
					return Status.CANCEL_STATUS;
				}

				var text = getFilterString();
				if (text == null) {
					return Status.OK_STATUS;
				}

				var initial = initialText != null && initialText.equals(text);
				getPatternFilter().setPattern((initial) ? null : text);

				var redrawFalseControl = (treeComposite != null) ? treeComposite : treeViewer.getControl();
				try {
					redrawFalseControl.setRedraw(false);
					if (!narrowingDown) {
						foreach (var item in treeViewer.getTree().getItems()) {
							if (item.getExpanded()) {
								treeViewer.setExpandedState(item.getData(), false);
							}
						}
					}
					treeViewer.refresh(true);
					updateToolbar(text.length() > 0 && !initial);
				} finally {
					var items = getViewer().getTree().getItems();
					if (sizeof(items) > 0 && getViewer().getTree().getSelectionCount() == 0) {
						treeViewer.getTree().setTopItem(items[0]);
					}
					redrawFalseControl.setRedraw(true);
				}
				return (monitor.isCanceled()) ? Status.CANCEL_STATUS : Status.OK_STATUS;
			}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:34,代码来源:FilteredElementTreeSelectionDialog.stab.cs

示例4: run

			public override IStatus run(IProgressMonitor monitor) {
				Environment.trace(this, Messages.pluginStartup);
				
				try {
					monitor.beginTask(Messages.pluginStartup, 1);
					ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, new SubProgressMonitor(monitor, 1));
				} finally {
					monitor.done();
				}
				return (monitor.isCanceled()) ? Status.CANCEL_STATUS : Status.OK_STATUS;
			}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:11,代码来源:Activator.stab.cs

示例5: compileCore

		private SourceCompilerResults compileCore(IProgressMonitor monitor) {
			var t0 = System.nanoTime();
			
			var results = new SourceCompilerResults();
			var hasErrors = false;
			var errorManager = new CodeErrorManager();
			var allFiles = parameters.AllFiles;
			Iterable<IFile> filesToCompile = null;
			
			try {
				monitor.beginTask("", 11);

				var deletedFiles = parameters.FilesToCompile
						.select(p => allFiles.getResource(p))
						.where(p => p == null || !p.exists())
						.select(p => allFiles.getProjectRelativeName(p)).toSet();
				var typesToCopy = Query.empty<TypeInfo>();

				// Get the files to compile
				if (parameters.FullBuild) {
					filesToCompile = allFiles.getAllResources().where(p => p.exists()).toList();
				} else {
					bool filteringDone = false;
					var referencingFiles = parameters.getDependencyInfo().getAllReferencingFiles(parameters.getFilesToCompile());
					if (parameters.ProgressiveBuild && deletedFiles.isEmpty()) {
						var referencedFiles = parameters.getDependencyInfo().getAllReferencedFiles(parameters.getFilesToCompile());
						referencedFiles = referencedFiles.except(parameters.getFilesToCompile());
						referencedFiles = referencedFiles.intersect(referencingFiles);
						
						// Progressive build only if referenced and referencing files do not intersect
						if (!referencedFiles.any()) {
							filesToCompile = parameters.FilesToCompile.select(p => allFiles.getResource(p)).where(p => p.exists()).toList();
							filteringDone = true;
						}
					}
					if (!filteringDone) {
						// Incremental build with dependencies
						filesToCompile = referencingFiles.select(p => allFiles.getResource(p)).where(p => p.exists()).toList();
					}
					
					var filesToKeep = allFiles.getAllProjectRelativeNames().except(referencingFiles);
					typesToCopy = filesToKeep.selectMany(p => parameters.DependencyInfo.getFileContents(p))
							.where(p => p.indexOf('$') == -1).select(p => parameters.TypeSystem.getType(p));
							
					Environment.trace(this, "keeping " + filesToKeep.count() + " files");
					Environment.trace(this, "ignoring " +
							(allFiles.getAllResources().count() - filesToCompile.count() - filesToKeep.count()) + " files");
				}
				Environment.trace(this, "compiling " + filesToCompile.count() + " files");
				monitor.worked(1);
				if (monitor.isCanceled()) {
					throw new InterruptedException();
				}

				var compilationUnits = new HashMap<String, CompilationUnitNode>();
				
				// Parsing
				foreach (var file in filesToCompile) {
					var text = getText(file);
					if (text != null) {
						parse(file, text, errorManager, compilationUnits);
					}
				}
				monitor.worked(1);
				if (monitor.isCanceled()) {
					throw new InterruptedException();
				}
				
				// Compiling
				var t1 = System.nanoTime();
				
				var typeSystem = new Library(parameters.ClassPath);
				JvmTypeSystemHelper.cloneTypes(typesToCopy, typeSystem);
				
				var annotatedTypeSystem = new Library(new[] { Environment.getLibraryPath("stabal.jar") }, typeSystem);
				
				var cparams = new CompilerParameters();
				cparams.TypeSystem = typeSystem;
				cparams.AnnotatedTypeSystem = annotatedTypeSystem;
				cparams.GenerateClassFiles = parameters.GenerateClassFiles;
				cparams.ProgressTracker = new CompilationProgressTracker(monitor);
				
				var cunits = compilationUnits.values().toArray(new CompilationUnitNode[compilationUnits.size()]);
				var cresults = new StabCompiler().compileFromCompilationUnits(cparams, cunits);
				
				Environment.trace(this, "compilation of " + sizeof(cunits) + " files done in " + ((System.nanoTime() - t1) / 1e6) + "ms");

				foreach (var error in cresults.Errors) {
					if (error.Level == 0) {
						hasErrors = true;
					}
					results.CodeErrors.add(error);
					Environment.trace(this, "error (" + error.Line + ", " + error.Column + ") " + error.Filename + ": " + error.Message);
				}

				if (!hasErrors) {
					var dependencyInfo = new DependencyInfo();
					results.DependencyInfo = dependencyInfo;
					var allTypes = new HashSet<String>();
	
//.........这里部分代码省略.........
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:101,代码来源:SourceCompiler.stab.cs


注:本文中的IProgressMonitor.isCanceled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。