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


Java Status.CANCEL_STATUS属性代码示例

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


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

示例1: run

@Override
protected IStatus run(IProgressMonitor monitor) {
	try {
		if (editor!=null) editor.setSafeEnabled(false);
	    scannable.setPosition(value); // Blocking call
	    if (editor!=null && value instanceof Number) {
		editor.setSafeValue(((Number)value).doubleValue());
	    }
	    return Status.OK_STATUS;

	} catch (Exception e) {
		editor.setSafeText(e.getMessage());
		logger.error("Cannot set position!", e);
	    return Status.CANCEL_STATUS;

	} finally {
		editor.setSafeEnabled(true);
	}
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:19,代码来源:ControlValueJob.java

示例2: createJob

/**
 * @param jobname
 * @param tasks
 * @return
 */
public static Job createJob(String jobname, List<UITask.Task> tasks) {
	Job job = new Job(jobname) {
		@Override
		protected IStatus run(IProgressMonitor monitor) {
			SubMonitor subMonitor = SubMonitor.convert(monitor, tasks.size());
			for (UITask.Task task : tasks) {
				try {
					subMonitor.setTaskName(task.getSummary());
					workOnTask(task, subMonitor.split(1));
				} catch (Exception e) {
					return Status.CANCEL_STATUS;
				}
			}
			return Status.OK_STATUS;
		}
	};
	job.setUser(true);
	return job;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:24,代码来源:UITask.java

示例3: run

@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,代码行数:26,代码来源:ProjectEditorDiffer.java

示例4: run

@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,代码行数:26,代码来源:SQLEditor.java

示例5: performOperation

/**
 * Performs a {@link ProfileChangeOperation}
 * 
 * @param operation the operation
 * @return the result status
 */
private IStatus performOperation(ProfileChangeOperation operation) {
	IStatus status = operation.resolveModal(this.getProgressMonitor());
	if (status.isOK()) {
		ProvisioningJob provisioningJob = operation.getProvisioningJob(this.getProgressMonitor());

		if (provisioningJob == null) {
			System.err.println("Trying to install from the Eclipse IDE? This won't work!");
			return Status.CANCEL_STATUS;
		}

		status = provisioningJob.runModal(this.getProgressMonitor());
	}
	return status;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:20,代码来源:P2OperationsHandler.java

示例6: installAvailableUpdates

/**
 * Installs available updates from all repositories.
 *
 * @return the result status
 */
public IStatus installAvailableUpdates() {
	ProvisioningJob provisioningJob = this.getUpdateOperation().getProvisioningJob(this.getProgressMonitor());
	if (provisioningJob == null) {
		System.err.println("Trying to update from the Eclipse IDE? This won't work!");
		return Status.CANCEL_STATUS;
	}

	return provisioningJob.runModal(this.getProgressMonitor());
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:14,代码来源:P2OperationsHandler.java

示例7: getValues

/**
 * Return the the preference values for the passed project and key
 * 
 * @param project
 * @param key
 * @return
 */
public static String[] getValues(IProject project, String key, boolean projectScoped) {

	IEclipsePreferences projectPreferences = null;
	if (projectScoped) {
		projectPreferences = getProjectPreference(project);
	} else {
		projectPreferences = getGlobalPreference();
	}
	String values = projectPreferences.get(key, "");
	if ((values == null) || (values.trim().length() == 0) && projectScoped) {
		IEclipsePreferences globalPreferences = getGlobalPreference();
		values = globalPreferences.get(key, "");
		final String gloablValues = values;

		Job job = new WorkspaceJob("GW4E Configure Project Preference Job") {
			@Override
			public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
				SubMonitor subMonitor = SubMonitor.convert(monitor, 60);
				try {
					putValues(project, key, fromString(gloablValues), projectScoped);
					return Status.OK_STATUS;
				} catch (Exception e) {
					ResourceManager.logException(e);
					return Status.CANCEL_STATUS;
				} finally {
					subMonitor.done();
				}
			}
		};
		job.setRule(project);
		job.setUser(true);
		job.schedule();
	}
	String[] ret = fromString(values);
	return ret;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:43,代码来源:SettingsManager.java

示例8: update

/**
 * @param graphFile
 * @throws CoreException
 * @throws IOException
 * @throws InterruptedException
 */
public void update(List<BuildPolicy> policies) throws CoreException, IOException, InterruptedException {
	Job job = new WorkspaceJob("Updating cache") {
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			try {
				IFile fileCache = getCache();
				Properties p = ResourceManager.loadIFileAsProperties(fileCache,
						getFileCacheName(resource.getProject().getName()));
				String serialized = serialize(policies);
				if (serialized == null) {
					log("BuildPoliciesCache.update " + fileCache + " failed to updated for resource " + resource
							+ " " + policies.toString());
					return Status.OK_STATUS;
				}
				p.put(resource.getName(), System.currentTimeMillis() + ":" + serialized);
				log("BuildPoliciesCache.update " + fileCache + " updated for resource " + resource + " "
						+ p.toString());
				save(p, monitor);
				return Status.OK_STATUS;
			} catch (Exception e) {
				ResourceManager.logException(e);
				return Status.CANCEL_STATUS;
			}
		}
	};
	job.setRule(resource.getProject());
	job.setUser(true);
	job.schedule();
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:34,代码来源:BuildPoliciesCache.java

示例9: run

@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,代码行数:29,代码来源:UsageReporter.java

示例10: execute

/**
 * Runs provided File in Engine. Returns output of execution.
 */
public void execute(ILaunch launch, XpectRunConfiguration runConfiguration) throws RuntimeException {

	Job job = new Job(launch.getLaunchConfiguration().getName()) {

		@Override
		protected IStatus run(IProgressMonitor monitor) {
			XpectRunner xr;
			try {
				xr = new XpectRunner(N4IDEXpectTestClass.class);
			} catch (InitializationError e) {
				N4IDEXpectUIPlugin.logError("cannot initialize xpect runner", e);
				return Status.CANCEL_STATUS;
			}

			// TODO support multiple selection
			/*
			 * if Project provided, or package files should be discovered there. Also multiple selected files
			 */
			String testFileLocation = runConfiguration.getXtFileToRun();

			IXpectURIProvider uriprov = xr.getUriProvider();
			if (uriprov instanceof N4IDEXpectTestURIProvider) {
				((N4IDEXpectTestURIProvider) uriprov).addTestFileLocation(testFileLocation);
			}

			Result result = new Result();
			RunNotifier notifier = new RunNotifier();
			RunListener listener = result.createListener();
			N4IDEXpectRunListener n4Listener = new N4IDEXpectRunListener();

			notifier.addFirstListener(listener);
			notifier.addListener(n4Listener);

			try {
				notifier.fireTestRunStarted(xr.getDescription());
				xr.run(notifier);
				notifier.fireTestRunFinished(result);
			} finally {
				notifier.removeListener(n4Listener);
				notifier.removeListener(listener);
			}
			// Do something with test run result?
			// return result;

			return Status.OK_STATUS;
		}

	};
	job.setUser(true);
	job.schedule();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:54,代码来源:XpectConfigurationDelegate.java

示例11: storeExcel

private IStatus storeExcel ( final File file, final List<Event> events, final List<Field> columns, final IProgressMonitor monitor ) throws IOException
{
    final HSSFWorkbook workbook = new HSSFWorkbook ();

    final HSSFDataFormat dateFormat = workbook.createDataFormat ();
    final HSSFCellStyle dateCellStyle = workbook.createCellStyle ();
    dateCellStyle.setDataFormat ( dateFormat.getFormat ( "YYYY-MM-DD hh:mm:ss.000" ) );

    try
    {
        monitor.beginTask ( Messages.ExportImpl_Progress_ExportingEvents, events.size () + 3 + columns.size () );

        try
        {
            monitor.subTask ( Messages.ExportImpl_Progress_CreateWorkbook );
            monitor.worked ( 1 );

            final HSSFSheet sheet = createSheet ( events, workbook, columns );
            monitor.worked ( 1 );

            monitor.setTaskName ( Messages.ExportImpl_Progress_ExportEvents );

            for ( int i = 0; i < events.size (); i++ )
            {
                final HSSFRow row = sheet.createRow ( i + 1 );

                final Event e = events.get ( i );
                for ( int j = 0; j < columns.size (); j++ )
                {
                    final Field field = columns.get ( j );
                    final ExcelCell cell = new ExcelCell ( row, j, dateCellStyle );
                    field.render ( e, cell );
                }
                monitor.worked ( 1 );
                if ( monitor.isCanceled () )
                {
                    return Status.CANCEL_STATUS;
                }
            }

            sheet.setRepeatingRows ( new CellRangeAddress ( 0, 1, -1, -1 ) );

            monitor.setTaskName ( "Auto sizing" );
            for ( int i = 0; i < columns.size (); i++ )
            {
                monitor.subTask ( String.format ( "Auto sizing column: %s", columns.get ( i ).getHeader () ) );
                sheet.autoSizeColumn ( i );
                monitor.worked ( 1 );

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

        }
        finally
        {
            monitor.subTask ( Messages.ExportImpl_Progress_CloseFile );
            if ( workbook != null )
            {
                makeDocInfo ( workbook );

                final FileOutputStream stream = new FileOutputStream ( file );
                workbook.write ( stream );
                stream.close ();
            }
            monitor.worked ( 1 );
        }
    }
    finally
    {
        monitor.done ();
    }

    return Status.OK_STATUS;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:77,代码来源:ExportEventsImpl.java

示例12: createCenteringListener

private void createCenteringListener(final Label centeringValue, final Map<String, ScaleBox> boxes) {

		// We listen to the topic and when a complete bean comes through, we take this
		// as the current center for the UI
		// Use job because connection might timeout.
		final Job topicJob = new Job("Create topic listener") {

			@Override
			protected IStatus run(IProgressMonitor monitor) {
				try {
					topicMonitor = service.createSubscriber(new URI(Activator.getJmsUri()), "dataacq.xcen.STATUS_TOPIC");
					topicMonitor.addListener(new IBeanListener<XcenBean>() {
						@Override
						public void beanChangePerformed(BeanEvent<XcenBean> evt) {
							final XcenBean bean = evt.getBean();
							if (bean.getStatus()==org.eclipse.scanning.api.event.status.Status.COMPLETE) {
								Display.getDefault().syncExec(new Runnable() {
									@Override
									public void run() {
										centeringValue.setText(bean.getName());
										boxes.get("x").setValue(bean.getX());
										boxes.get("y").setValue(bean.getY());
										boxes.get("z").setValue(bean.getZ());
									}
								});
							}
						}

						@Override
						public Class<XcenBean> getBeanClass() {
							return XcenBean.class;
						}
					});
			        return Status.OK_STATUS;

				} catch (Exception ne) {
					logger.error("Cannot listen to topic changes because command server is not there", ne);
			        return Status.CANCEL_STATUS;
				}
			}


		};

		topicJob.setPriority(Job.INTERACTIVE);
		topicJob.setSystem(true);
		topicJob.setUser(false);
		topicJob.schedule();

	}
 
开发者ID:eclipse,项目名称:scanning,代码行数:50,代码来源:XcenView.java

示例13: synchronizeBuildPolicies

/**
 * @param selectedResource
 * @return
 * @throws CoreException
 * @throws InterruptedException
 */
public static void synchronizeBuildPolicies(final IResource selectedResource, IWorkbenchWindow aww)
		throws CoreException, InterruptedException {
	List<ICompilationUnit> executionContexts = new ArrayList<ICompilationUnit>();

	Job job = new WorkspaceJob("GW4E Synchronization Job") {
		@Override
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			try {
				SubMonitor subMonitor = SubMonitor.convert(monitor, 120);
				selectedResource.accept(new IResourceVisitor() {
					@Override
					public boolean visit(IResource resource) throws CoreException {
						if (resource instanceof IFile) {
							IFile file = (IFile) resource;
							if ("java".equals(file.getFileExtension())) {
								ICompilationUnit cu = JavaCore.createCompilationUnitFrom(file);
								if (cu != null) {
									if (JDTManager.isGraphWalkerExecutionContextClass(cu)) {
										executionContexts.add(cu);
									}
								}
							}
						}
						return true;
					}
				});
				subMonitor.split(20);

				int max = executionContexts.size();
				int index = 1;
				subMonitor.setWorkRemaining(max);
				for (ICompilationUnit executionContext : executionContexts) {
					if (monitor.isCanceled())
						return Status.CANCEL_STATUS;
					subMonitor.subTask("Processing file #" + index++);
					SubMonitor child = subMonitor.split(1);
					ResourceManager.updateBuildPolicyFileForCompilatioUnit(executionContext);
				}
			} catch (Exception e) {
				ResourceManager.logException(e);
			}
			return Status.OK_STATUS;
		}
	};
	job.setRule(selectedResource.getProject());
	job.setUser(true);
	job.schedule();
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:54,代码来源:GraphWalkerContextManager.java

示例14: downloadDebugFiles

public void downloadDebugFiles(final boolean filterApplied,final boolean remoteOkPressed) {
	Job job = new Job(Messages.LOADING_DEBUG_FILE) {
		
		@Override
		protected IStatus run(IProgressMonitor monitor) {
			disbleDataViewerUIControls();
			
			DataViewerFileManager dataViewerFileManager = new DataViewerFileManager(jobDetails);
			final StatusMessage statusMessage = dataViewerFileManager.downloadDataViewerFiles(filterApplied,getConditions(),isOverWritten);


			if (StatusConstants.ERROR == statusMessage.getReturnCode()) {
				Display.getDefault().asyncExec(new Runnable() {
					
					@Override
					public void run() {
						Utils.INSTANCE.showDetailErrorMessage(statusMessage.getStatusMessage(), statusMessage.getErrorStatus());
						getShell().close();
					}
				});
				return Status.CANCEL_STATUS;
			}

			debugFileName = dataViewerFileManager.getDataViewerFileName();
			debugFileLocation = dataViewerFileManager.getDataViewerFilePath();
			downlodedFileSize = dataViewerFileManager.getDebugFileSize();
			setDebugFileLocation(debugFileLocation);
			setDebugFileName(debugFileName);
			setDownloadedFileSize(downlodedFileSize);
			if (getConditions() != null) {
				if (getConditions().getRetainLocal() || getConditions().getRetainRemote()) {
					showDataInDebugViewer(true,remoteOkPressed);
				}
				 else {
					if (!filterApplied) {
						showDataInDebugViewer(false, false);
					} else {
						showDataInDebugViewer(false, remoteOkPressed);
					}
				}
			}
			else
			{
				showDataInDebugViewer(false, remoteOkPressed);
			}
			dataViewerFileSchema = ViewDataSchemaHelper.INSTANCE.getFieldsFromSchema(debugFileLocation + debugFileName + SCHEMA_FILE_EXTENTION);
			
			if(dataViewerFileSchema != null){
				syncSchemaWithReceivedDataFile();
			}
			return Status.OK_STATUS;
		}
	};
	job.schedule();
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:55,代码来源:DebugDataViewer.java

示例15: cancel

/**
 * Returns with the {@link Status#CANCEL_STATUS CANCEL status} instance.
 *
 * @return the shared singleton CANCEL status.
 */
public IStatus cancel() {
	return Status.CANCEL_STATUS;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:8,代码来源:StatusHelper.java


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