當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。