本文整理汇总了Java中org.eclipse.ui.progress.IProgressService类的典型用法代码示例。如果您正苦于以下问题:Java IProgressService类的具体用法?Java IProgressService怎么用?Java IProgressService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IProgressService类属于org.eclipse.ui.progress包,在下文中一共展示了IProgressService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processFile
import org.eclipse.ui.progress.IProgressService; //导入依赖的package包/类
protected void processFile(IFile file) {
if (file != null
&& file.getFileExtension().equalsIgnoreCase(
GUIEditorPlugin.FORGED_UI_EXTENSION)) {
if (GUIEditorPlugin.getDefault().getWorkbench()
.saveAllEditors(true)) {
// Do the start of the job here.
Shell shell = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell();
IProgressService progressService = PlatformUI.getWorkbench()
.getProgressService();
CodeGenJob job = new CodeGenJob(file);
UIJob runJob = new EditorUIJob(job);
progressService.showInDialog(shell, runJob);
// runJob.setRule(ISchedulingRule);
runJob.schedule();
}
}
}
示例2: ViewSiteRelationsListener
import org.eclipse.ui.progress.IProgressService; //导入依赖的package包/类
public ViewSiteRelationsListener(
final IRunnableContext runnableContext,
final IProgressService progressService,
final ILogger logger,
final IJavaModel model,
final IObjectModel<IItem> selectedItemModel,
final IObjectListModel<IItem> selectedItemsModel,
final Label label,
final IDependenciesModel dependenciesModel,
final WritableList<IDependencyRelation> descriptions,
final INameHitMaps nameHitMaps) {
this.runnableContext = runnableContext;
this.logger = logger;
this.progressService = progressService;
this.model = model;
this.selectedItemModel = selectedItemModel;
this.selectedItemsModel = selectedItemsModel;
this.label = label;
this.dependenciesModel = dependenciesModel;
this.descriptions = descriptions;
this.nameHitMaps = nameHitMaps;
}
示例3: checkInitialConditions
import org.eclipse.ui.progress.IProgressService; //导入依赖的package包/类
/**
* CHANGED to protected
* CHANGED do not fork as we are keeping the resource lock.
*/
protected RefactoringStatus checkInitialConditions(Refactoring refactoring, Shell parent, String title,
IRunnableContext context) throws InterruptedException {
try {
CheckConditionsOperation cco = new CheckConditionsOperation(refactoring,
CheckConditionsOperation.INITIAL_CONDITONS);
WorkbenchRunnableAdapter workbenchRunnableAdapter = new WorkbenchRunnableAdapter(cco, ResourcesPlugin
.getWorkspace().getRoot());
/* CHANGE: don't fork (or use busyCursorWhile) as this will cause a deadlock */
if (context == null) {
PlatformUI.getWorkbench().getProgressService().run(false, true, workbenchRunnableAdapter);
} else if (context instanceof IProgressService) {
((IProgressService) context).run(false, true, workbenchRunnableAdapter);
} else {
context.run(false, true, workbenchRunnableAdapter);
}
return cco.getStatus();
} catch (InvocationTargetException e) {
ExceptionHandler.handle(e, parent, title, RefactoringUIMessages.RefactoringUI_open_unexpected_exception);
return RefactoringStatus
.createFatalErrorStatus(RefactoringUIMessages.RefactoringUI_open_unexpected_exception);
}
}
示例4: browseForAccessorClass
import org.eclipse.ui.progress.IProgressService; //导入依赖的package包/类
protected void browseForAccessorClass() {
IProgressService service= PlatformUI.getWorkbench().getProgressService();
IPackageFragmentRoot root= fAccessorPackage.getSelectedFragmentRoot();
IJavaSearchScope scope= root != null ? SearchEngine.createJavaSearchScope(new IJavaElement[] { root }) : SearchEngine.createWorkspaceScope();
FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog (getShell(), false,
service, scope, IJavaSearchConstants.CLASS);
dialog.setTitle(NLSUIMessages.NLSAccessorConfigurationDialog_Accessor_Selection);
dialog.setMessage(NLSUIMessages.NLSAccessorConfigurationDialog_Choose_the_accessor_file);
dialog.setInitialPattern("*Messages"); //$NON-NLS-1$
if (dialog.open() == Window.OK) {
IType selectedType= (IType) dialog.getFirstResult();
if (selectedType != null) {
fAccessorClassName.setText(selectedType.getElementName());
fAccessorPackage.setSelected(selectedType.getPackageFragment());
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:NLSAccessorConfigurationDialog.java
示例5: performNewSearch
import org.eclipse.ui.progress.IProgressService; //导入依赖的package包/类
private void performNewSearch(IJavaElement element) throws JavaModelException, InterruptedException {
JavaSearchQuery query= new JavaSearchQuery(createQuery(element));
if (query.canRunInBackground()) {
/*
* This indirection with Object as parameter is needed to prevent the loading
* of the Search plug-in: the VM verifies the method call and hence loads the
* types used in the method signature, eventually triggering the loading of
* a plug-in (in this case ISearchQuery results in Search plug-in being loaded).
*/
SearchUtil.runQueryInBackground(query);
} else {
IProgressService progressService= PlatformUI.getWorkbench().getProgressService();
/*
* This indirection with Object as parameter is needed to prevent the loading
* of the Search plug-in: the VM verifies the method call and hence loads the
* types used in the method signature, eventually triggering the loading of
* a plug-in (in this case it would be ISearchQuery).
*/
IStatus status= SearchUtil.runQueryInForeground(progressService, query);
if (status.matches(IStatus.ERROR | IStatus.INFO | IStatus.WARNING)) {
ErrorDialog.openError(getShell(), SearchMessages.Search_Error_search_title, SearchMessages.Search_Error_search_message, status);
}
}
}
示例6: syncCheckWork
import org.eclipse.ui.progress.IProgressService; //导入依赖的package包/类
protected void syncCheckWork() throws InvocationTargetException, InterruptedException {
IProgressService service = PlatformUI.getWorkbench().getProgressService();
service.run(true, true, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Synchronize check against server", 2);
try {
monitorWork(monitor);
boolean tmpInSync = false;
for (IResource resource : getSelectedResources()) {
ProjectService projectService = ContainerDelegate.getInstance().getServiceLocator().getProjectService();
tmpInSync = projectService.isResourceInSync(
resource,
new SubProgressMonitor(monitor, 4));
if (!tmpInSync) {
isInSync = false;
}
}
} catch (Exception e) {
throw new InvocationTargetException(e);
} finally {
monitor.done();
}
}
});
}
示例7: refreshProject
import org.eclipse.ui.progress.IProgressService; //导入依赖的package包/类
private static void refreshProject(final IWorkbench workbench, final IStructuredSelection selection) throws InvocationTargetException,
InterruptedException {
final IProgressService service = PlatformUI.getWorkbench().getProgressService();
service.run(false, false, new IRunnableWithProgress() {
@Override
public void run(final IProgressMonitor monitor) throws InvocationTargetException {
monitor.beginTask("Refreshing project...", IProgressMonitor.UNKNOWN);
try {
RefreshResourceHandler.execute(workbench, selection);
} catch (Throwable e) {
throw new InvocationTargetException(e);
} finally {
monitor.done();
}
}
});
}
示例8: deploy
import org.eclipse.ui.progress.IProgressService; //导入依赖的package包/类
private void deploy() throws InvocationTargetException {
IProgressService service = PlatformUI.getWorkbench().getProgressService();
try {
service.run(true, true, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Deploying components...", 1);
try {
deploymentWizard.getDeploymentController().finish(new SubProgressMonitor(monitor, 3));
monitor.worked(1);
} finally {
monitor.subTask("Done");
}
}
});
} catch (InterruptedException e) {
logger.warn("Operation cancelled: " + e.getMessage());
}
}
示例9: run
import org.eclipse.ui.progress.IProgressService; //导入依赖的package包/类
@Override
public void run(IAction action) {
final ArrayList<File> tmp = new ArrayList<File>();
LeJOSEV3Util.getFilesFromSelection(_selection, tmp);
if (!tmp.isEmpty())
{
// open progress monitor
IWorkbench wb = PlatformUI.getWorkbench();
IProgressService ps = wb.getProgressService();
try {
ps.busyCursorWhile(new IRunnableWithProgress() {
public void run(IProgressMonitor pm) {
uploadFile(pm, tmp);
} // end run
});
} catch (Throwable t) {
// log
LeJOSEV3Util.log(t);
}
}
}
示例10: RelationsTableListener
import org.eclipse.ui.progress.IProgressService; //导入依赖的package包/类
public RelationsTableListener(
final ILogger logger,
final IRunnableContext context,
final IProgressService progressService,
final WritableList<IType> types,
final IDependenciesModel dependenciesModel,
final IObjectModel<IItem> selectedItemModel) {
this.logger = logger;
this.context = context;
this.progressService = progressService;
this.types = types;
this.dependenciesModel = dependenciesModel;
this.selectedItemModel = selectedItemModel;
}
示例11: getBookmarks
import org.eclipse.ui.progress.IProgressService; //导入依赖的package包/类
private List<Bookmark> getBookmarks(IStructuredSelection selection) {
List<Bookmark> bookmarks = new ArrayList<>();
IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
try {
progressService.busyCursorWhile(monitor -> {
bookmarks.addAll(getBookmarks(selection, monitor));
});
} catch (InvocationTargetException | InterruptedException e) {
// ignore
}
return bookmarks;
}
示例12: execute
import org.eclipse.ui.progress.IProgressService; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
Bookmark bookmark = getSelectedBookmark(selection);
ImportTeamProjectFromBookmarkJob job = new ImportTeamProjectFromBookmarkJob(bookmark);
IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
progressService.showInDialog(HandlerUtil.getActiveShell(event), job);
job.schedule();
return null;
}
示例13: findReferences
import org.eclipse.ui.progress.IProgressService; //导入依赖的package包/类
private void findReferences(IResource resource, int offset, int length) {
TypeScriptSearchQuery query = new TypeScriptSearchQuery(resource, offset);
if (query.canRunInBackground()) {
/*
* This indirection with Object as parameter is needed to prevent
* the loading of the Search plug-in: the VM verifies the method
* call and hence loads the types used in the method signature,
* eventually triggering the loading of a plug-in (in this case
* ISearchQuery results in Search plug-in being loaded).
*/
SearchUtil.runQueryInBackground(query);
} else {
IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
/*
* This indirection with Object as parameter is needed to prevent
* the loading of the Search plug-in: the VM verifies the method
* call and hence loads the types used in the method signature,
* eventually triggering the loading of a plug-in (in this case it
* would be ISearchQuery).
*/
IStatus status = SearchUtil.runQueryInForeground(progressService, query);
if (status.matches(IStatus.ERROR | IStatus.INFO | IStatus.WARNING)) {
ErrorDialog.openError(getShell(), SearchMessages.Search_Error_search_title,
SearchMessages.Search_Error_search_message, status);
}
}
}
示例14: terminateLaunches
import org.eclipse.ui.progress.IProgressService; //导入依赖的package包/类
private void terminateLaunches() {
if( preferences.isTerminateBeforeRelaunch() ) {
IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
try {
progressService.busyCursorWhile( this::terminateLaunches );
} catch( InvocationTargetException ite ) {
handleException( ite.getCause() );
} catch( InterruptedException ignore ) {
Thread.interrupted();
}
}
}
示例15: execute
import org.eclipse.ui.progress.IProgressService; //导入依赖的package包/类
public void execute(ICustomContext context) {
try {
URI uri = getDiagram().eResource().getURI();
URI bpmnUri = uri.trimFragment();
bpmnUri = bpmnUri.trimFileExtension();
bpmnUri = bpmnUri.appendFileExtension("bpmn20.xml");
IProject project = null;
String parentDiagramName = null;
if (bpmnUri.isPlatformResource()) {
String platformString = bpmnUri.toPlatformString(true);
IResource fileResource = ResourcesPlugin.getWorkspace().getRoot().findMember(platformString);
if (fileResource != null) {
project = fileResource.getProject();
parentDiagramName = uri.trimFragment().trimFileExtension().lastSegment();
}
}
final IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
final ExportMarshallerRunnable runnable = new ExportMarshallerRunnable(getDiagram(), ActivitiBPMNDiagramConstants.BPMN_MARSHALLER_NAME);
progressService.busyCursorWhile(runnable);
} catch (Exception e) {
e.printStackTrace();
}
}