Java Code Examples for org.eclipse.ui.progress.UIJob#setSystem()
The following examples show how to use
org.eclipse.ui.progress.UIJob#setSystem() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocalAppEngineConsole.java From google-cloud-eclipse with Apache License 2.0 | 8 votes |
/** * Update the shown name with the server stop/stopping state. */ private void updateName(int serverState) { final String computedName; if (serverState == IServer.STATE_STARTING) { computedName = Messages.getString("SERVER_STARTING_TEMPLATE", unprefixedName); } else if (serverState == IServer.STATE_STOPPING) { computedName = Messages.getString("SERVER_STOPPING_TEMPLATE", unprefixedName); } else if (serverState == IServer.STATE_STOPPED) { computedName = Messages.getString("SERVER_STOPPED_TEMPLATE", unprefixedName); } else { computedName = unprefixedName; } UIJob nameUpdateJob = new UIJob("Update server name") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { LocalAppEngineConsole.this.setName(computedName); return Status.OK_STATUS; } }; nameUpdateJob.setSystem(true); nameUpdateJob.schedule(); }
Example 2
Source File: ControlView.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public void componentChanged(final ITraceControlComponent component) { if (fTreeViewer.getTree().isDisposed()) { return; } UIJob myJob = new UIJob("Refresh") { //$NON-NLS-1$ @Override public IStatus runInUIThread(IProgressMonitor monitor) { if (fTreeViewer.getTree().isDisposed()) { return Status.OK_STATUS; } fTreeViewer.refresh(component); // Change selection needed final ISelection sel = fTreeViewer.getSelection(); fTreeViewer.setSelection(null); fTreeViewer.setSelection(sel); // Show component that was changed fTreeViewer.reveal(component); return Status.OK_STATUS; } }; myJob.setUser(false); myJob.setSystem(true); myJob.schedule(); }
Example 3
Source File: PyRefactorAction.java From Pydev with Eclipse Public License 1.0 | 5 votes |
/** * Actually executes this action. * * Checks preconditions... if */ @Override public void run(final IAction action) { // Select from text editor request = null; //clear the cache from previous runs ps = PySelectionFromEditor.createPySelectionFromEditor(getTextEditor()); RefactoringRequest req; try { req = getRefactoringRequest(); } catch (MisconfigurationException e2) { Log.log(e2); return; } IPyRefactoring pyRefactoring = AbstractPyRefactoring.getPyRefactoring(); if (areRefactorPreconditionsOK(req, pyRefactoring) == false) { return; } UIJob job = new UIJob("Performing: " + this.getClass().getName()) { @Override public IStatus runInUIThread(final IProgressMonitor monitor) { try { Operation o = new Operation(action); o.execute(monitor); } catch (Exception e) { Log.log(e); } return Status.OK_STATUS; } }; job.setSystem(true); job.schedule(); }
Example 4
Source File: RenameRefactoringPopup.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public void open() { // Must cache here, since editor context is not available in menu from popup shell: openDialogBinding = getOpenDialogBinding(); Shell workbenchShell = editor.getSite().getShell(); final Display display = workbenchShell.getDisplay(); popup = new Shell(workbenchShell, SWT.ON_TOP | SWT.NO_TRIM | SWT.TOOL); popupLayout = new GridLayout(2, false); popupLayout.marginWidth = 1; popupLayout.marginHeight = 1; popupLayout.marginLeft = 4; popupLayout.horizontalSpacing = 0; popup.setLayout(popupLayout); createContent(popup); updatePopupLocation(); new PopupVisibilityManager().start(); // Leave linked mode when popup loses focus // (except when focus goes back to workbench window or menu is open): popup.addShellListener(new ShellAdapter() { @Override public void shellDeactivated(ShellEvent e) { if (iSMenuUp) return; final Shell editorShell = editor.getSite().getShell(); display.asyncExec(new Runnable() { // post to UI thread since editor shell only gets activated after popup has lost focus @Override public void run() { Shell activeShell = display.getActiveShell(); if (activeShell != editorShell) { controller.cancelLinkedMode(); } } }); } }); if (!MAC) { // carbon and cocoa draw their own border... popup.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent pe) { pe.gc.drawPolygon(getPolygon(true)); } }); } UIJob delayJob = new UIJob(display, "Delayed RenameInformationPopup") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { delayJobFinished = true; if (popup != null && !popup.isDisposed()) { updateVisibility(); } return Status.OK_STATUS; } }; delayJob.setSystem(true); delayJob.setPriority(Job.INTERACTIVE); delayJob.schedule(POPUP_VISIBILITY_DELAY); }
Example 5
Source File: RenameInformationPopup.java From typescript.java with MIT License | 4 votes |
public void open() { // Must cache here, since editor context is not available in menu from popup shell: fOpenDialogBinding= getOpenDialogBinding(); Shell workbenchShell= fEditor.getSite().getShell(); final Display display= workbenchShell.getDisplay(); fPopup= new Shell(workbenchShell, SWT.ON_TOP | SWT.NO_TRIM | SWT.TOOL); fPopupLayout= new GridLayout(3, false); fPopupLayout.marginWidth= 1; fPopupLayout.marginHeight= 1; fPopupLayout.marginLeft= 4; fPopupLayout.horizontalSpacing= 0; fPopup.setLayout(fPopupLayout); createContent(fPopup); updatePopupLocation(true); new PopupVisibilityManager().start(); // Leave linked mode when popup loses focus // (except when focus goes back to workbench window or menu is open): fPopup.addShellListener(new ShellAdapter() { @Override public void shellDeactivated(ShellEvent e) { if (fIsMenuUp) return; final Shell editorShell= fEditor.getSite().getShell(); display.asyncExec(new Runnable() { // post to UI thread since editor shell only gets activated after popup has lost focus @Override public void run() { Shell activeShell= display.getActiveShell(); if (activeShell != editorShell) { fRenameLinkedMode.cancel(); } } }); } }); if (! MAC) { // carbon and cocoa draw their own border... fPopup.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent pe) { pe.gc.drawPolygon(getPolygon(true)); } }); } // fPopup.moveBelow(null); // make sure hovers are on top of the info popup // XXX workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=170774 // fPopup.moveBelow(workbenchShell.getShells()[0]); UIJob delayJob= new UIJob(display, RefactoringMessages.RenameInformationPopup_delayJobName) { @Override public IStatus runInUIThread(IProgressMonitor monitor) { fDelayJobFinished= true; if (fPopup != null && ! fPopup.isDisposed()) { updateVisibility(); } return Status.OK_STATUS; } }; delayJob.setSystem(true); delayJob.setPriority(Job.INTERACTIVE); delayJob.schedule(POPUP_VISIBILITY_DELAY); }
Example 6
Source File: RenameInformationPopup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void open() { // Must cache here, since editor context is not available in menu from popup shell: fOpenDialogBinding= getOpenDialogBinding(); Shell workbenchShell= fEditor.getSite().getShell(); final Display display= workbenchShell.getDisplay(); fPopup= new Shell(workbenchShell, SWT.ON_TOP | SWT.NO_TRIM | SWT.TOOL); fPopupLayout= new GridLayout(2, false); fPopupLayout.marginWidth= 1; fPopupLayout.marginHeight= 1; fPopupLayout.marginLeft= 4; fPopupLayout.horizontalSpacing= 0; fPopup.setLayout(fPopupLayout); createContent(fPopup); updatePopupLocation(true); new PopupVisibilityManager().start(); // Leave linked mode when popup loses focus // (except when focus goes back to workbench window or menu is open): fPopup.addShellListener(new ShellAdapter() { @Override public void shellDeactivated(ShellEvent e) { if (fIsMenuUp) return; final Shell editorShell= fEditor.getSite().getShell(); display.asyncExec(new Runnable() { // post to UI thread since editor shell only gets activated after popup has lost focus public void run() { Shell activeShell= display.getActiveShell(); if (activeShell != editorShell) { fRenameLinkedMode.cancel(); } } }); } }); if (! MAC) { // carbon and cocoa draw their own border... fPopup.addPaintListener(new PaintListener() { public void paintControl(PaintEvent pe) { pe.gc.drawPolygon(getPolygon(true)); } }); } // fPopup.moveBelow(null); // make sure hovers are on top of the info popup // XXX workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=170774 // fPopup.moveBelow(workbenchShell.getShells()[0]); UIJob delayJob= new UIJob(display, ReorgMessages.RenameInformationPopup_delayJobName) { @Override public IStatus runInUIThread(IProgressMonitor monitor) { fDelayJobFinished= true; if (fPopup != null && ! fPopup.isDisposed()) { updateVisibility(); } return Status.OK_STATUS; } }; delayJob.setSystem(true); delayJob.setPriority(Job.INTERACTIVE); delayJob.schedule(POPUP_VISIBILITY_DELAY); }