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


Java OperationCanceledException类代码示例

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


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

示例1: addMarkers

import org.eclipse.core.runtime.OperationCanceledException; //导入依赖的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: queryRepositoryForInstallableUnit

import org.eclipse.core.runtime.OperationCanceledException; //导入依赖的package包/类
/**
 * Queries a repository for a specific {@link IInstallableUnit} (IU).
 *
 * @param repositoryURI the repository URI
 * @param installableUnitID the ID of the IU
 * @return the {@link IQueryResult}
 */
private IQueryResult<IInstallableUnit> queryRepositoryForInstallableUnit(URI repositoryURI, String installableUnitID) {

	// --- Load the repository ------------
	IQueryResult<IInstallableUnit> queryResult = null;
	try {
		IMetadataRepository metadataRepository = this.getMetadataRepositoryManager().loadRepository(repositoryURI, this.getProgressMonitor());
		// --- Query for the IU of interest -----
		if (metadataRepository != null) {
			queryResult = metadataRepository.query(QueryUtil.createIUQuery(installableUnitID), this.getProgressMonitor());
		}
		
	} catch (ProvisionException | OperationCanceledException e) {
		System.err.println("Error loading the repository at " + repositoryURI);
		e.printStackTrace();
	}

	return queryResult;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:26,代码来源:P2OperationsHandler.java

示例3: addAsMainNature

import org.eclipse.core.runtime.OperationCanceledException; //导入依赖的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

示例4: createChange

import org.eclipse.core.runtime.OperationCanceledException; //导入依赖的package包/类
@Override
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
	
	copyToPath=getArguments().getDestination().toString();
	IWorkspaceRoot workSpaceRoot = ResourcesPlugin.getWorkspace().getRoot();
	IProject project = workSpaceRoot.getProject(copyToPath.split("/")[1]);
	IFolder jobFolder = project.getFolder(copyToPath.substring(copyToPath.indexOf('/', 2)));
	previousJobFiles=new ArrayList<>();
	for (IResource iResource : jobFolder.members()) {
		if (!(iResource instanceof IFolder)) {
			IFile iFile = (IFile) iResource;
			 if (iFile.getFileExtension().equalsIgnoreCase(Messages.JOB_EXT)) {
				 previousJobFiles.add(iFile);
			 }
		}
	}
	copiedFileList.add(modifiedResource);
	return null;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:20,代码来源:JobCopyParticipant.java

示例5: run

import org.eclipse.core.runtime.OperationCanceledException; //导入依赖的package包/类
@Override
public IStatus run(IProgressMonitor monitor) throws OperationCanceledException {
	startTime = System.currentTimeMillis();
	AbstractTextSearchResult textResult = (AbstractTextSearchResult) getSearchResult();
	textResult.removeAll();

	try {

		IContainer dir = configFile.getParent();
		dir.accept(new AbstractSectionPatternVisitor(section) {

			@Override
			protected void collect(IResourceProxy proxy) {
				Match match = new FileMatch((IFile) proxy.requestResource());
				result.addMatch(match);
			}
		}, IResource.NONE);

		return Status.OK_STATUS;
	} catch (Exception ex) {
		return new Status(IStatus.ERROR, EditorConfigPlugin.PLUGIN_ID, ex.getMessage(), ex);
	}
}
 
开发者ID:angelozerr,项目名称:ec4e,代码行数:24,代码来源:EditorConfigSearchQuery.java

示例6: build

import org.eclipse.core.runtime.OperationCanceledException; //导入依赖的package包/类
@Override
public void build(IBuildContext context, IProgressMonitor monitor) throws CoreException {
	SubMonitor progress = SubMonitor.convert(monitor);
	if (!prefs.isCompilerEnabled()) {
		return;
	}
	final List<IResourceDescription.Delta> deltas = getRelevantDeltas(context);
	if (deltas.isEmpty()) {
		return;
	}
	if (progress.isCanceled()) {
		throw new OperationCanceledException();
	}
	progress.beginTask("Compiling solidity...", deltas.size());

	List<URI> uris = deltas.stream().map(delta -> delta.getUri()).collect(Collectors.toList());
	compiler.compile(uris, progress);
	context.getBuiltProject().refreshLocal(IProject.DEPTH_INFINITE, progress);
	progress.done();

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

示例7: doRun

import org.eclipse.core.runtime.OperationCanceledException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected IStatus doRun(final IProgressMonitor progressMonitor) throws Exception {
    progressMonitor.beginTask(getName(), projects.length);

    for (int i = 0; i < projects.length; i++) {
        final IProgressMonitor projectMonitor = new SubProgressMonitor(progressMonitor, 1);

        projectMonitor.setTaskName(
            MessageFormat.format(
                Messages.getString("CloseProjectsCommand.ClosingProjectFormat"), //$NON-NLS-1$
                projects[i].getName()));

        try {
            projects[i].close(projectMonitor);
        } catch (final OperationCanceledException e) {
            return Status.CANCEL_STATUS;
        }

        if (progressMonitor.isCanceled()) {
            return Status.CANCEL_STATUS;
        }
    }

    return Status.OK_STATUS;
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:29,代码来源:CloseProjectsCommand.java

示例8: install

import org.eclipse.core.runtime.OperationCanceledException; //导入依赖的package包/类
/**
 * Modifies the set of project facets in the configured project by performing the series of
 * configured facets actions.
 *
 * @param monitor a progress monitor, or null if progress reporting and cancellation are not desired
 * @throws CoreException if anything goes wrong while applying facet actions
 */
public void install(IProgressMonitor monitor) throws CoreException {
  SubMonitor subMonitor = SubMonitor.convert(monitor, 100);

  // Workaround deadlock bug described in Eclipse bug (https://bugs.eclipse.org/511793).
  // There are graph update jobs triggered by the completion of the CreateProjectOperation
  // above (from resource notifications) and from other resource changes from modifying the
  // project facets. So we force the dependency graph to defer updates
  try {
    IDependencyGraph.INSTANCE.preUpdate();
    try {
      Job.getJobManager().join(DependencyGraphImpl.GRAPH_UPDATE_JOB_FAMILY,
          subMonitor.newChild(10));
    } catch (OperationCanceledException | InterruptedException ex) {
      logger.log(Level.WARNING, "Exception waiting for WTP Graph Update job", ex);
    }

    facetedProject.modify(facetInstallSet, subMonitor.newChild(90));
  } finally {
    IDependencyGraph.INSTANCE.postUpdate();
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:29,代码来源:FacetUtil.java

示例9: enableMavenNature

import org.eclipse.core.runtime.OperationCanceledException; //导入依赖的package包/类
private static void enableMavenNature(IProject newProject, IProgressMonitor monitor)
    throws CoreException {
  SubMonitor subMonitor = SubMonitor.convert(monitor, 30);

  // Workaround deadlock bug described in Eclipse bug (https://bugs.eclipse.org/511793).
  try {
    IDependencyGraph.INSTANCE.preUpdate();
    try {
      Job.getJobManager().join(DependencyGraphImpl.GRAPH_UPDATE_JOB_FAMILY,
          subMonitor.newChild(8));
    } catch (OperationCanceledException | InterruptedException ex) {
      logger.log(Level.WARNING, "Exception waiting for WTP Graph Update job", ex);
    }

    ResolverConfiguration resolverConfiguration = new ResolverConfiguration();
    MavenPlugin.getProjectConfigurationManager().enableMavenNature(newProject,
        resolverConfiguration, subMonitor.newChild(20));
  } finally {
    IDependencyGraph.INSTANCE.postUpdate();
  }

  // M2E will cleverly set "target/<artifact ID>-<version>/WEB-INF/classes" as a new Java output
  // folder; delete the default old folder.
  newProject.getFolder("build").delete(true /* force */, subMonitor.newChild(2));
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:26,代码来源:CreateAppEngineWtpProject.java

示例10: publishExploded

import org.eclipse.core.runtime.OperationCanceledException; //导入依赖的package包/类
public static void publishExploded(IProject project, IPath destination,
    IPath safeWorkDirectory, IProgressMonitor monitor) throws CoreException {
  Preconditions.checkNotNull(project, "project is null"); //$NON-NLS-1$
  Preconditions.checkNotNull(destination, "destination is null"); //$NON-NLS-1$
  Preconditions.checkArgument(!destination.isEmpty(), "destination is empty path"); //$NON-NLS-1$
  Preconditions.checkNotNull(safeWorkDirectory, "safeWorkDirectory is null"); //$NON-NLS-1$
  if (monitor.isCanceled()) {
    throw new OperationCanceledException();
  }

  SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
  subMonitor.setTaskName(Messages.getString("task.name.publish.war"));

  IModuleResource[] resources =
      flattenResources(project, safeWorkDirectory, subMonitor.newChild(10));
  PublishUtil.publishFull(resources, destination, subMonitor.newChild(90));
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:18,代码来源:WarPublisher.java

示例11: publishWar

import org.eclipse.core.runtime.OperationCanceledException; //导入依赖的package包/类
public static void publishWar(IProject project, IPath destination, IPath safeWorkDirectory,
    IProgressMonitor monitor) throws CoreException {
  Preconditions.checkNotNull(project, "project is null"); //$NON-NLS-1$
  Preconditions.checkNotNull(destination, "destination is null"); //$NON-NLS-1$
  Preconditions.checkArgument(!destination.isEmpty(), "destination is empty path"); //$NON-NLS-1$
  Preconditions.checkNotNull(safeWorkDirectory, "safeWorkDirectory is null"); //$NON-NLS-1$
  if (monitor.isCanceled()) {
    throw new OperationCanceledException();
  }

  SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
  subMonitor.setTaskName(Messages.getString("task.name.publish.war"));

  IModuleResource[] resources =
      flattenResources(project, safeWorkDirectory, subMonitor.newChild(10));
  PublishUtil.publishZip(resources, destination, subMonitor.newChild(90));
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:18,代码来源:WarPublisher.java

示例12: stageStandard

import org.eclipse.core.runtime.OperationCanceledException; //导入依赖的package包/类
/**
 * @param explodedWarDirectory the input of the staging operation
 * @param stagingDirectory where the result of the staging operation will be written
 * @param cloudSdk executes the staging operation
 */
public static void stageStandard(IPath explodedWarDirectory, IPath stagingDirectory,
    CloudSdk cloudSdk, IProgressMonitor monitor) {
  if (monitor.isCanceled()) {
    throw new OperationCanceledException();
  }

  SubMonitor progress = SubMonitor.convert(monitor, 1);
  progress.setTaskName(Messages.getString("task.name.stage.project")); //$NON-NLS-1$

  DefaultStageStandardConfiguration stagingConfig = new DefaultStageStandardConfiguration();
  stagingConfig.setSourceDirectory(explodedWarDirectory.toFile());
  stagingConfig.setStagingDirectory(stagingDirectory.toFile());
  stagingConfig.setEnableJarSplitting(true);
  stagingConfig.setDisableUpdateCheck(true);

  CloudSdkAppEngineStandardStaging staging = new CloudSdkAppEngineStandardStaging(cloudSdk);
  staging.stageStandard(stagingConfig);

  progress.worked(1);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:26,代码来源:CloudSdkStagingHelper.java

示例13: stageFlexible

import org.eclipse.core.runtime.OperationCanceledException; //导入依赖的package包/类
/**
 * @param appEngineDirectory directory containing {@code app.yaml}
 * @param deployArtifact project to be deploy (such as WAR or JAR)
 * @param stagingDirectory where the result of the staging operation will be written
 * @throws AppEngineException when staging fails
 * @throws OperationCanceledException when user cancels the operation
 */
public static void stageFlexible(IPath appEngineDirectory, IPath deployArtifact,
    IPath stagingDirectory, IProgressMonitor monitor) {
  if (monitor.isCanceled()) {
    throw new OperationCanceledException();
  }

  SubMonitor progress = SubMonitor.convert(monitor, 1);
  progress.setTaskName(Messages.getString("task.name.stage.project")); //$NON-NLS-1$

  DefaultStageFlexibleConfiguration stagingConfig = new DefaultStageFlexibleConfiguration();
  stagingConfig.setAppEngineDirectory(appEngineDirectory.toFile());
  stagingConfig.setArtifact(deployArtifact.toFile());
  stagingConfig.setStagingDirectory(stagingDirectory.toFile());

  CloudSdkAppEngineFlexibleStaging staging = new CloudSdkAppEngineFlexibleStaging();
  staging.stageFlexible(stagingConfig);

  progress.worked(1);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:27,代码来源:CloudSdkStagingHelper.java

示例14: getDeployArtifact

import org.eclipse.core.runtime.OperationCanceledException; //导入依赖的package包/类
@Override
protected IPath getDeployArtifact(IPath safeWorkingDirectory, IProgressMonitor monitor)
    throws CoreException {
  SubMonitor subMonitor = SubMonitor.convert(monitor, 100);

  try {
    ILaunchConfiguration config = createMavenPackagingLaunchConfiguration(project);
    ILaunch launch = config.launch("run", subMonitor.newChild(10));
    if (!waitUntilLaunchTerminates(launch, subMonitor.newChild(90))) {
      throw new OperationCanceledException();
    }
    return getFinalArtifactPath(project);
  } catch (InterruptedException ex) {
    throw new OperationCanceledException();
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:17,代码来源:FlexMavenPackagedProjectStagingDelegate.java

示例15: applies

import org.eclipse.core.runtime.OperationCanceledException; //导入依赖的package包/类
@Override
public boolean applies(IProgressMonitor monitor) throws OperationCanceledException, CoreException {
	PreferenceManager preferencesManager = JavaLanguageServerPlugin.getPreferencesManager();
	if (preferencesManager != null && !preferencesManager.getPreferences().isImportMavenEnabled()) {
		return false;
	}
	Set<MavenProjectInfo> files = getMavenProjectInfo(monitor);
	if (files != null) {
		Iterator<MavenProjectInfo> iter = files.iterator();
		while (iter.hasNext()) {
			MavenProjectInfo projectInfo = iter.next();
			File dir = projectInfo.getPomFile() == null ? null : projectInfo.getPomFile().getParentFile();
			if (dir != null && exclude(dir.toPath())) {
				iter.remove();
			}
		}
	}
	return files != null && !files.isEmpty();
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:20,代码来源:MavenProjectImporter.java


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