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


Java WorkbenchJob类代码示例

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


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

示例1: doCreateRefreshJob

import org.eclipse.ui.progress.WorkbenchJob; //导入依赖的package包/类
@Override
protected WorkbenchJob doCreateRefreshJob() {
	WorkbenchJob job = super.doCreateRefreshJob();
	job.addJobChangeListener(new JobChangeAdapter() {
		@SuppressWarnings("deprecation")
		@Override
		public void done(IJobChangeEvent event) {
			if (event.getResult() != null && event.getResult().isOK() && !getViewer().getTree().isDisposed()) {
				Set<String> joinChecked = new HashSet(getSelectedValues());
				for(String i : getPartialValues()) {
					getViewer().setGrayed(i, true);
					joinChecked.add(i);
				}
				getViewer().setCheckedElements(joinChecked.toArray());
			}
		}
	});
	return job;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:20,代码来源:InPlaceCheckBoxTreeDialog.java

示例2: doCreateRefreshJob

import org.eclipse.ui.progress.WorkbenchJob; //导入依赖的package包/类
protected WorkbenchJob doCreateRefreshJob() {
	WorkbenchJob filterJob = super.doCreateRefreshJob();
	filterJob.addJobChangeListener(new JobChangeAdapter() {
		public void done(IJobChangeEvent event) {
			if (event.getResult().isOK()) {
				getDisplay().asyncExec(new Runnable() {
					public void run() {
						if (checkboxViewer.getTree().isDisposed())
							return;
						checkboxViewer.restoreLeafCheckState();
					}
				});
			}
		}
	});
	return filterJob;
}
 
开发者ID:SEMERU-WM,项目名称:ChangeScribe,代码行数:18,代码来源:FilteredCheckboxTree.java

示例3: createUpdateJob

import org.eclipse.ui.progress.WorkbenchJob; //导入依赖的package包/类
private void createUpdateJob() {
  new WorkbenchJob("GwtSuperDevModeCodeServerTabGroup") {
    @Override
    public IStatus runInUIThread(IProgressMonitor monitor) {
      ILaunchConfigurationTab tab = launchConfigurationDialog.getActiveTab();
      if (tab != null && !tab.getControl().isDisposed()) {
        launchConfigurationDialog.updateButtons();
        launchConfigurationDialog.updateMessage();
      }
      return Status.OK_STATUS;
    }
  }.schedule();
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:14,代码来源:GwtCompilerTabGroup.java

示例4: createUpdateJob

import org.eclipse.ui.progress.WorkbenchJob; //导入依赖的package包/类
private void createUpdateJob() {
  new WorkbenchJob("WebAppTabGroup") {
    @Override
    public IStatus runInUIThread(IProgressMonitor monitor) {
      ILaunchConfigurationTab tab = launchConfigurationDialog.getActiveTab();
      if (tab != null && !tab.getControl().isDisposed()) {
        launchConfigurationDialog.updateButtons();
        launchConfigurationDialog.updateMessage();
      }
      return Status.OK_STATUS;
    }
  }.schedule();
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:14,代码来源:WebAppTabGroup.java

示例5: doCreateRefreshJob

import org.eclipse.ui.progress.WorkbenchJob; //导入依赖的package包/类
/**
 * Avoid the expansion stage of the refresh by using a monitor in the
 * "canceled" state.
 */
@Override
protected WorkbenchJob doCreateRefreshJob() {
	final WorkbenchJob realJob = super.doCreateRefreshJob();
	return new WorkbenchJob(realJob.getName()) {
		@Override
		public IStatus runInUIThread(IProgressMonitor monitor) {
			IProgressMonitor cancelledMonitor = new NullProgressMonitor();
			cancelledMonitor.setCanceled(true);
			realJob.runInUIThread(cancelledMonitor);
			return Status.OK_STATUS;
		}
	};
}
 
开发者ID:secondfiddle,项目名称:pep-tools,代码行数:18,代码来源:RootElementsFilteredTree.java

示例6: dispose

import org.eclipse.ui.progress.WorkbenchJob; //导入依赖的package包/类
private void dispose()
{
	WorkbenchJob job = new WorkbenchJob("Disposing KeybindingsManager") //$NON-NLS-1$
	{
		@Override
		public IStatus runInUIThread(IProgressMonitor monitor)
		{
			workbench.getDisplay().removeFilter(SWT.KeyDown, listener);
			workbench.getDisplay().removeFilter(SWT.Traverse, listener);
			return Status.OK_STATUS;
		}
	};
	EclipseUtil.setSystemForJob(job);
	job.schedule();
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:16,代码来源:KeybindingsManager.java

示例7: createDelayedRefreshJob

import org.eclipse.ui.progress.WorkbenchJob; //导入依赖的package包/类
/**
 * createDelayedRefreshJob
 * 
 * @return workbench job
 */
private WorkbenchJob createDelayedRefreshJob()
{
	return new WorkbenchJob("Refresh Content") { //$NON-NLS-1$
		/**
		 * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor)
		 */
		public IStatus runInUIThread(IProgressMonitor monitor)
		{
			try
			{
				if (_treeViewer.getControl().isDisposed())
				{
					return Status.CANCEL_STATUS;
				}

				_treeViewer.setSelection(null);
				_treeViewer.refresh();
			}
			// SWT errors may be thrown here and will show as an error box since this is done on the UI thread
			// Catch everything and log it so that the dialog doesn't annoy the user since they may be typing into
			// the editor when this code throws errors and will impact them severely
			catch (Throwable e)
			{
				IdeLog.logError(CommonEditorPlugin.getDefault(), e);
			}

			return Status.OK_STATUS;
		}
	};
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:36,代码来源:CommonQuickOutlinePage.java

示例8: addFilter

import org.eclipse.ui.progress.WorkbenchJob; //导入依赖的package包/类
private void addFilter() {
	fFilter = new ListFilter(fSelected, fLabelProvider);
	fAvailableViewer.addFilter(fFilter);
	fFilterJob = new WorkbenchJob("FilterJob") { //$NON-NLS-1$
		public IStatus runInUIThread(IProgressMonitor monitor) {
			handleFilter();
			return Status.OK_STATUS;
		}
	};
	fFilterJob.setSystem(true);
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:12,代码来源:FilteredListComponent.java

示例9: doCreateRefreshJob

import org.eclipse.ui.progress.WorkbenchJob; //导入依赖的package包/类
private WorkbenchJob doCreateRefreshJob() {
	return new WorkbenchJob(PreferencesMessages.OptionsConfigurationBlock_RefreshFilter) {
		@Override
		public IStatus runInUIThread(IProgressMonitor monitor) {
			updateUI(fRoot);
			fParentComposite.layout(true, true); //relayout
			if (fScrolledPageContent != null) {
				setVisible(fNoMatchFoundLabel, !fMatchFound);
				fScrolledPageContent.reflow(true);
			}
			return Status.OK_STATUS;
		}
	};
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:OptionsConfigurationBlock.java

示例10: uijob

import org.eclipse.ui.progress.WorkbenchJob; //导入依赖的package包/类
public static Job uijob(final String name, final Function<IProgressMonitor, IStatus> fn) {
  return new WorkbenchJob(name) {
    @Override
    public IStatus runInUIThread(final IProgressMonitor monitor) {
      return fn.apply(monitor);
    }
  };
}
 
开发者ID:antlr4ide,项目名称:antlr4ide,代码行数:9,代码来源:Widgets.java

示例11: stateJob

import org.eclipse.ui.progress.WorkbenchJob; //导入依赖的package包/类
public static Job stateJob(final String name, final AtomicInteger state,
    final Function2<IProgressMonitor, Integer, IStatus> fn) {
  return new WorkbenchJob(name) {
    @Override
    public IStatus runInUIThread(final IProgressMonitor monitor) {
      return fn.apply(monitor, state.incrementAndGet());
    }
  };
}
 
开发者ID:antlr4ide,项目名称:antlr4ide,代码行数:10,代码来源:Widgets.java

示例12: memoryBlocksAdded

import org.eclipse.ui.progress.WorkbenchJob; //导入依赖的package包/类
@Override
public void memoryBlocksAdded(final IMemoryBlock[] memory) {
	
	WorkbenchJob job = new WorkbenchJob("Update Memory View") {
		private static final long RESCHEDULE_TIME = 200;
		private static final int MAX_ATTEMPTS = 5;
		private volatile int attempts = 0;
		
		@Override
		public IStatus runInUIThread(IProgressMonitor monitor) {
			IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
			if (page == null) {
				return Status.OK_STATUS;
			}
			try {
				IMemoryRenderingSite memoryView = null;
				for (IViewReference ref : page.getViewReferences()) {
					if (ref.getId().equals(IDebugUIConstants.ID_MEMORY_VIEW)) {
						memoryView = (IMemoryRenderingSite) ref.getView(true);
						break;
					}
				}
				if (memoryView == null) {
					if (attempts < MAX_ATTEMPTS) { //Memory view may still not been opened, try 5 times
						attempts++;
						this.schedule(RESCHEDULE_TIME);
					}
					else {
						attempts = 0;
					}
					return Status.OK_STATUS;
				}
				
				for (IMemoryBlock mb : memory) {
					if (mb instanceof BfMemoryBlock && !((BfMemoryBlock) mb).isUserCreated()) {
						IMemoryRenderingType renderingType = DebugUITools.getMemoryRenderingManager().getPrimaryRenderingType(mb);
						IMemoryRendering rendering = renderingType.createRendering();
						IMemoryRenderingContainer container = memoryView.getContainer(IDebugUIConstants.PLUGIN_ID + ".MemoryView.RenderingViewPane.1");
						rendering.init(container, mb);
						container.addMemoryRendering(rendering);
					}
				}
			}
			catch (CoreException e) {
				DbgActivator.getDefault().logError("Updating Memory View failed", e);
			}
			this.attempts = 0;
			return Status.OK_STATUS;
		}
	};
	job.setUser(false);
	job.schedule();
}
 
开发者ID:RichardBirenheide,项目名称:brainfuck,代码行数:54,代码来源:BfUIListenerContributor.java

示例13: initBindings

import org.eclipse.ui.progress.WorkbenchJob; //导入依赖的package包/类
private void initBindings()
{
	WorkbenchJob workbenchJob = new WorkbenchJob("Installing KeybindingsManager") //$NON-NLS-1$
	{
		@Override
		public IStatus runInUIThread(IProgressMonitor monitor)
		{

			loadbindings();

			// Insert our key listener before the Eclipse's key listeners
			IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class);
			if (bindingService instanceof BindingService)
			{
				final BindingService theBindingService = (BindingService) bindingService;
				Display display = PlatformUI.getWorkbench().getDisplay();
				final WorkbenchKeyboard keyboard = theBindingService.getKeyboard();
				Listener keyDownFilter = keyboard.getKeyDownFilter();
				try
				{
					if (keyDownFilter != null)
					{
						display.removeFilter(SWT.KeyDown, keyDownFilter);
						display.removeFilter(SWT.Traverse, keyDownFilter);
					}
					display.addFilter(SWT.KeyDown, listener);
					display.addFilter(SWT.Traverse, listener);
				}
				finally
				{
					if (keyDownFilter != null)
					{
						display.addFilter(SWT.KeyDown, keyDownFilter);
						display.addFilter(SWT.Traverse, keyDownFilter);
					}
				}
			}

			// Set the initial enabled state of KeybindingsManager
			IContextService contextService = (IContextService) workbench.getService(IContextService.class);
			contextService.addContextManagerListener(contextManagerListener);
			setEnabled(contextService.getActiveContextIds().contains(ScriptingUIPlugin.SCRIPTING_CONTEXT_ID));

			return Status.OK_STATUS;
		}
	};
	workbenchJob.setRule(MUTEX_RULE);
	EclipseUtil.setSystemForJob(workbenchJob);
	workbenchJob.setPriority(Job.LONG);
	workbenchJob.schedule();
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:52,代码来源:KeybindingsManager.java

示例14: createRefreshJob

import org.eclipse.ui.progress.WorkbenchJob; //导入依赖的package包/类
/**
 * createRefreshJob
 * 
 * @return Workbench job
 */
private WorkbenchJob createRefreshJob()
{
	return new WorkbenchJob("Refresh Filter") {//$NON-NLS-1$
		/**
		 * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor)
		 */
		public IStatus runInUIThread(IProgressMonitor monitor)
		{
			if (_treeViewer.getControl().isDisposed())
			{
				return Status.CANCEL_STATUS;
			}

			if (_pattern == null)
			{
				return Status.OK_STATUS;
			}

			_filter.setPattern(_pattern);

			try
			{
				// don't want the user to see updates that will be made to the tree
				_treeViewer.getControl().setRedraw(false);
				_treeViewer.refresh(true);

				if (_pattern.length() > 0)
				{
					/*
					 * Expand elements one at a time. After each is expanded, check to see if the filter text has
					 * been modified. If it has, then cancel the refresh job so the user doesn't have to endure
					 * expansion of all the nodes.
					 */
					IStructuredContentProvider provider = (IStructuredContentProvider) _treeViewer
							.getContentProvider();
					Object[] elements = provider.getElements(_treeViewer.getInput());

					for (int i = 0; i < elements.length; i++)
					{
						if (monitor.isCanceled())
						{
							return Status.CANCEL_STATUS;
						}

						_treeViewer.expandToLevel(elements[i], AbstractTreeViewer.ALL_LEVELS);
					}

					TreeItem[] items = _treeViewer.getTree().getItems();

					if (items.length > 0)
					{
						// to prevent scrolling
						_treeViewer.getTree().showItem(items[0]);
					}
				}
			}
			finally
			{
				// done updating the tree - set redraw back to true
				_treeViewer.getControl().setRedraw(true);
			}

			return Status.OK_STATUS;
		}

	};
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:73,代码来源:CommonQuickOutlinePage.java

示例15: doCreateRefreshJob

import org.eclipse.ui.progress.WorkbenchJob; //导入依赖的package包/类
@Override
protected WorkbenchJob doCreateRefreshJob() {
	return new WorkbenchJob("Refresh Filter") {//$NON-NLS-1$


		@Override
		public IStatus runInUIThread(IProgressMonitor monitor) {
			if (treeViewer.getControl().isDisposed()) {
				return Status.CANCEL_STATUS;
			}

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

			boolean initial= initialText != null && initialText.equals(text);
			if (initial) {
				getPatternFilter().setPattern(null);
			} else {
				getPatternFilter().setPattern(text);
			}

			Control redrawFalseControl= treeComposite != null ? treeComposite : treeViewer.getControl();
			try {
				// don't want the user to see updates that will be made to
				// the tree
				// we are setting redraw(false) on the composite to avoid
				// dancing scrollbar
				redrawFalseControl.setRedraw(false);
				if (!narrowingDown) {
					// collapse all
					TreeItem[] is= treeViewer.getTree().getItems();
					for (int i= 0; i < is.length; i++) {
						TreeItem item= is[i];
						if (item.getExpanded()) {
							treeViewer.setExpandedState(item.getData(), false);
						}
					}
				}
				treeViewer.refresh(true);

				updateToolbar(text.length() > 0 && !initial);

			} finally {
				// done updating the tree - set redraw back to true
				TreeItem[] items= getViewer().getTree().getItems();
				if (items.length > 0 && getViewer().getTree().getSelectionCount() == 0) {
					treeViewer.getTree().setTopItem(items[0]);
				}
				redrawFalseControl.setRedraw(true);
			}
			return Status.OK_STATUS;
		}
	};
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:57,代码来源:FilteredElementTreeSelectionDialog.java


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