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


Java IProgressMonitor.isCanceled方法代码示例

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


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

示例1: addMarkers

import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
private void addMarkers(IFile file, Resource resource, CheckMode mode, IProgressMonitor monitor)
		throws OperationCanceledException {
	try {
		List<Issue> list = getValidator(resource).validate(resource, mode, getCancelIndicator(monitor));
		if (monitor.isCanceled()) {
			throw new OperationCanceledException();
		}
		deleteMarkers(file, mode, monitor);
		if (monitor.isCanceled()) {
			throw new OperationCanceledException();
		}
		createMarkers(file, list, getMarkerCreator(resource), getMarkerTypeProvider(resource));
	} catch (OperationCanceledError error) {
		throw error.getWrapped();
	} catch (CoreException e) {
		LOGGER.error(e.getMessage(), e);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:ResourceUIValidatorExtension.java

示例2: addAsMainNature

import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
public static void addAsMainNature(IProject project, String natureID, IProgressMonitor monitor) throws CoreException{
	if (monitor != null && monitor.isCanceled()) {
		throw new OperationCanceledException();
	}
	if (!project.hasNature(natureID)) {
		IProjectDescription description = project.getDescription();
		String[] natures = description.getNatureIds();
		String[] newNatures = new String[natures.length + 1];
		System.arraycopy(natures, 0, newNatures, 1, natures.length);
		newNatures[0] = natureID;
		description.setNatureIds(newNatures);
		project.setDescription(description, null);
	} else {
		if (monitor != null) {
			monitor.worked(1);
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:19,代码来源:AddRemoveGemocSequentialLanguageNatureHandler.java

示例3: run

import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
@Override
protected IStatus run(IProgressMonitor monitor) {
    SubMonitor pm = SubMonitor.convert(
            monitor, Messages.commitPartDescr_commiting, 2);

    Log.log(Log.LOG_INFO, "Applying diff tree to db"); //$NON-NLS-1$
    pm.newChild(1).subTask(Messages.commitPartDescr_modifying_db_model); // 1
    pm.newChild(1).subTask(Messages.commitPartDescr_exporting_db_model); // 2

    try {
        Collection<TreeElement> checked = new TreeFlattener()
                .onlySelected()
                .onlyEdits(dbProject.getDbObject(), dbRemote.getDbObject())
                .flatten(tree);
        new ProjectUpdater(dbRemote.getDbObject(), dbProject.getDbObject(),
                checked, proj).updatePartial();
        monitor.done();
    } catch (IOException | CoreException e) {
        return new Status(Status.ERROR, PLUGIN_ID.THIS,
                Messages.ProjectEditorDiffer_commit_error, e);
    }
    if (monitor.isCanceled()) {
        return Status.CANCEL_STATUS;
    }
    return Status.OK_STATUS;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:27,代码来源:ProjectEditorDiffer.java

示例4: run

import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
@Override
protected IStatus run(IProgressMonitor monitor) {
    try {
        Log.log(Log.LOG_INFO, "Update DDL starting"); //$NON-NLS-1$
        SubMonitor.convert(monitor).setTaskName(Messages.SqlEditor_update_ddl);

        scriptThread.start();

        while(scriptThread.isAlive()) {
            Thread.sleep(20);
            if(monitor.isCanceled()) {
                ConsoleFactory.write(Messages.sqlScriptDialog_script_execution_interrupted);
                Log.log(Log.LOG_INFO, "Script execution interrupted by user"); //$NON-NLS-1$

                scriptThread.interrupt();
                return Status.CANCEL_STATUS;
            }
        }
        return Status.OK_STATUS;
    } catch (InterruptedException ex) {
        scriptThread.interrupt();
        return Status.CANCEL_STATUS;
    } finally {
        monitor.done();
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:27,代码来源:SQLEditor.java

示例5: compile

import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
@Override
public void compile(List<URI> uris, IProgressMonitor progress) {
	Set<IResource> filesToCompile = getFilesToCompile(uris);
	if (filesToCompile.isEmpty() || progress.isCanceled()) {
		return;
	}
	progress.beginTask("compiling ...", filesToCompile.size());
	try {
		Process process = new ProcessBuilder(getCompilerPath(), "--standard-json").start();
		sendInput(process.getOutputStream(), filesToCompile);
		handler.handleOutput(process.getInputStream(), filesToCompile);
		if (process.waitFor(30, TimeUnit.SECONDS) && process.exitValue() != 0) {
			throw new Exception("Solidity compiler invocation failed with exit code " + process.exitValue() + ".");
		}
		progress.done();

	} catch (Exception e) {
		e.printStackTrace();
		progress.done();
	}

}
 
开发者ID:Yakindu,项目名称:solidity-ide,代码行数:23,代码来源:SolidityCompilerBase.java

示例6: reloadLibrariesInternal

import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
private void reloadLibrariesInternal(final boolean refreshNpmDefinitions, final IProgressMonitor monitor)
		throws InvocationTargetException {

	final SubMonitor subMonitor = SubMonitor.convert(monitor, refreshNpmDefinitions ? 2 : 1);

	if (monitor instanceof Cancelable) {
		((Cancelable) monitor).setCancelable(false); // No cancel is allowed from now on.
	}

	if (monitor.isCanceled()) {
		return;
	}

	// Refresh the type definitions for the npm packages if required.
	if (refreshNpmDefinitions) {
		final IStatus refreshStatus = npmManager.refreshInstalledNpmPackages(subMonitor.newChild(1));
		if (!refreshStatus.isOK()) {
			throw new InvocationTargetException(new CoreException(refreshStatus));
		}
	}

	// Make sure to rebuild only those external ones that are not in the workspace.
	// Get all accessible workspace projects...
	final Collection<String> workspaceProjectNames = from(asList(getWorkspace().getRoot().getProjects()))
			.filter(p -> p.isAccessible())
			.transform(p -> p.getName())
			.toSet();

	// And build all those externals that has no corresponding workspace project.
	final Iterable<IProject> toBuild = from(collector.collectExternalProjects())
			.filter(p -> !workspaceProjectNames.contains(p.getName()))
			.filter(IProject.class);

	final Iterable<IProject> workspaceProjectsToRebuild = collector
			.collectProjectsWithDirectExternalDependencies(toBuild);

	builderHelper.build(toBuild, subMonitor.newChild(1));

	scheduler.scheduleBuildIfNecessary(workspaceProjectsToRebuild);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:41,代码来源:ExternalLibrariesReloadHelper.java

示例7: run

import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
@Override
protected IStatus run(IProgressMonitor monitor) {
	while (!terminated) {
		// wait for new events
		if (events.isEmpty()) {
			try {
				synchronized(this) {
					wait();
				}
			} catch (InterruptedException e) {
				// nothing to do here
			}
		}

		if (!monitor.isCanceled()) {
			IDSLDebugEvent event = null;
			synchronized(events) {
				if (!events.isEmpty()) {
					event = events.remove(0);
				}
			}

			if (event != null) {
				handleEvent(event);
			}
		} else {
			terminate();
		}
	}

	return Status.OK_STATUS;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:33,代码来源:DSLDebugEventDispatcher.java

示例8: loadData

import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
public static Collection<FactoryInformation> loadData ( final IProgressMonitor monitor, final Connection connection ) throws Exception
{
    final Collection<FactoryInformation> result = new LinkedList<FactoryInformation> ();
    try
    {
        if ( connection == null )
        {
            throw new IllegalStateException ( Messages.ConfigurationHelper_NoConnection );
        }

        final NotifyFuture<FactoryInformation[]> future = connection.getFactories ();
        final FactoryInformation[] factories = future.get ();
        monitor.beginTask ( Messages.ConfigurationHelper_TaskName, factories.length );
        for ( final FactoryInformation factory : factories )
        {
            monitor.subTask ( String.format ( Messages.ConfigurationHelper_SubTaskNameFormat, factory.getId () ) );
            result.add ( connection.getFactoryWithData ( factory.getId () ).get () );
            monitor.worked ( 1 );
            if ( monitor.isCanceled () )
            {
                return null;
            }
        }
    }
    finally
    {
        monitor.done ();
    }
    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:31,代码来源:ConfigurationHelper.java

示例9: collectCodeLenses

import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
private void collectCodeLenses(ITypeRoot unit, IJavaElement[] elements, List<ICodeLens> lenses,
		IProgressMonitor monitor) throws JavaModelException {
	for (IJavaElement element : elements) {
		if (monitor.isCanceled()) {
			return;
		}
		if (element.getElementType() == IJavaElement.TYPE) {
			collectCodeLenses(unit, ((IType) element).getChildren(), lenses, monitor);
		} else if (element.getElementType() != IJavaElement.METHOD || JDTUtils.isHiddenGeneratedElement(element)) {
			continue;
		}

		// if (preferenceManager.getPreferences().isReferencesCodeLensEnabled()) {
		ICodeLens lens = getCodeLens(REFERENCES_TYPE, element, unit);
		lenses.add(lens);
		// }
		// if (preferenceManager.getPreferences().isImplementationsCodeLensEnabled() &&
		// element instanceof IType) {
		if (element instanceof IType) {
			IType type = (IType) element;
			if (type.isInterface() || Flags.isAbstract(type.getFlags())) {
				lens = getCodeLens(IMPLEMENTATION_TYPE, element, unit);
				lenses.add(lens);
			}
		}
	}
}
 
开发者ID:angelozerr,项目名称:codelens-eclipse,代码行数:28,代码来源:JavaCodeLensProvider.java

示例10: run

import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
@Override
protected IStatus run(IProgressMonitor monitor) {
    if (monitor.isCanceled()) {
        return Status.CANCEL_STATUS;
    }
    monitor.beginTask(Messages.UsageReport_Querying_Enablement, 2);

    if (monitor.isCanceled()) {
        return Status.CANCEL_STATUS;
    }
    monitor.worked(1);
    try {
        lockToAskUser.lock();

        if (mainPrefs.getBoolean(USAGE_REPORT_PREF.ASK_USER_USAGEREPORT_ID)) {
            if (monitor.isCanceled()) {
                return Status.CANCEL_STATUS;
            }
            askUser();
        }
    } finally {
        lockToAskUser.unlock();
    }
    report();
    monitor.worked(2);
    monitor.done();

    return Status.OK_STATUS;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:30,代码来源:UsageReporter.java

示例11: run

import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
    // DebugLog.println("Running task");
    monitor.beginTask("Running task ", IProgressMonitor.UNKNOWN);
    if (simpleThread != null) {
        simpleThread.start();
        simpleThread.join();
    }
    // DebugLog.println("Task complete.");
    monitor.done();
    if (monitor.isCanceled())
        throw new InterruptedException("The operation was cancelled");
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:13,代码来源:ProgressDialog.java

示例12: builderTableConnections

import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
private void builderTableConnections(List<String> checkedTables, Connection conn, IProgressMonitor monitor) throws Exception {
	if (builderTableList == null) {
		return;
	}
	for (String tableName : checkedTables) {
		String subTaskName = "正在为表【" + tableName + "】创建主外键关联模型....";
		updateProgressMonitor(monitor, subTaskName);
		if (monitor.isCanceled() == true) {
			break;
		}
		List<Map<Integer, Object>> exportedKeys = DbJdbcUtils.getTableExportedKeys(conn, null, tableName);
		com.bstek.bdf.plugins.databasetool.model.Connection tableRelation = null;
		for (Map<Integer, Object> exportedKey : exportedKeys) {
			String PKTABLE_NAME = (String) exportedKey.get(3);
			String PKCOLUMN_NAME = (String) exportedKey.get(4);
			String FKTABLE_NAME = (String) exportedKey.get(7);
			String FKCOLUMN_NAME = (String) exportedKey.get(8);
			String FK_NAME = (String) exportedKey.get(12);
			Table sourceTable = findTableByName(builderTableList, PKTABLE_NAME);
			Column pkColumn = findColumnByName(sourceTable, PKCOLUMN_NAME);
			Table targetTable = findTableByName(builderTableList, FKTABLE_NAME);
			Column fkColumn = findColumnByName(targetTable, FKCOLUMN_NAME);
			String constraintName = FK_NAME;
			if (sourceTable != null && targetTable != null) {
				tableRelation = new com.bstek.bdf.plugins.databasetool.model.Connection(sourceTable, targetTable, pkColumn, fkColumn,
						constraintName);
				tableRelation.connect();
				if (sourceTable.equals(targetTable)) {
					tableRelation.setSelfConnectionBendpoint();
				}
			}
		}
		taskCounter++;
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:36,代码来源:ImportDbToSchemaBuilder.java

示例13: getCancelIndicator

import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
private CancelIndicator getCancelIndicator(final IProgressMonitor monitor) {
	return () -> monitor.isCanceled();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:4,代码来源:ResourceUIValidatorExtension.java

示例14: checkUserCanceled

import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
private void checkUserCanceled(IProgressMonitor monitor) throws InterruptedException {
	if (monitor.isCanceled() || Thread.interrupted())
		throw new InterruptedException("User canceled Operation.");
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:5,代码来源:JSDoc2ADocSpecProcessor.java

示例15: checkUserCanceled

import org.eclipse.core.runtime.IProgressMonitor; //导入方法依赖的package包/类
/**
 * This method checks if the given monitor is canceled or interrupted. If so, an {@link InterruptedException} is
 * thrown.
 */
static void checkUserCanceled(IProgressMonitor monitor) throws InterruptedException {
	if (monitor.isCanceled() || Thread.interrupted()) {
		throw new InterruptedException("User canceled Operation.");
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:10,代码来源:CheckCanceled.java


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