本文整理汇总了Java中org.eclipse.ui.progress.UIJob类的典型用法代码示例。如果您正苦于以下问题:Java UIJob类的具体用法?Java UIJob怎么用?Java UIJob使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UIJob类属于org.eclipse.ui.progress包,在下文中一共展示了UIJob类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openEditorInUIThread
import org.eclipse.ui.progress.UIJob; //导入依赖的package包/类
/**
* Opens the editor for the given spec (needs access to the UI thus has to
* run as a UI job)
*/
private void openEditorInUIThread(final Spec spec) {
// with parsing done, we are ready to open the spec editor
final UIJob uiJob = new UIJob("NewSpecWizardEditorOpener") {
@Override
public IStatus runInUIThread(final IProgressMonitor monitor) {
// create parameters for the handler
final HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put(OpenSpecHandler.PARAM_SPEC, spec.getName());
// runs the command
UIHelper.runCommand(OpenSpecHandler.COMMAND_ID, parameters);
return Status.OK_STATUS;
}
};
uiJob.schedule();
}
示例2: run
import org.eclipse.ui.progress.UIJob; //导入依赖的package包/类
@Override
public void run() {
UIJob uiJob = new UIJob(Messages.MANAGE_SERVICES_TO_APPLICATIONS_TITLE) {
public IStatus runInUIThread(IProgressMonitor monitor) {
try {
if (serverBehaviour != null) {
ServiceToApplicationsBindingWizard wizard = new ServiceToApplicationsBindingWizard(
servicesHandler, serverBehaviour.getCloudFoundryServer(), editorPage);
WizardDialog dialog = new WizardDialog(editorPage.getSite().getShell(), wizard);
dialog.open();
}
}
catch (CoreException e) {
if (Logger.ERROR) {
Logger.println(Logger.ERROR_LEVEL, this, "runInUIThread", "Error launching wizard", e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
return Status.OK_STATUS;
}
};
uiJob.setSystem(true);
uiJob.setPriority(Job.INTERACTIVE);
uiJob.schedule();
}
示例3: setVisible
import org.eclipse.ui.progress.UIJob; //导入依赖的package包/类
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
if (visible) {
// Launch it as a job, to give the wizard time to display
// the spaces viewer
UIJob job = new UIJob(Messages.CloneServerPage_JOB_REFRESH_ORG_SPACE) {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
updateSpacesDescriptor();
refreshListOfSpaces();
return Status.OK_STATUS;
}
};
job.setSystem(true);
job.schedule();
}
}
示例4: processFile
import org.eclipse.ui.progress.UIJob; //导入依赖的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();
}
}
}
示例5: registerExampleDropAdapter
import org.eclipse.ui.progress.UIJob; //导入依赖的package包/类
private void registerExampleDropAdapter() {
UIJob registerJob = new UIJob(Display.getDefault(), "Registering example drop adapter.") {
{
setPriority(Job.SHORT);
setSystem(true);
}
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
IWorkbench workbench = PlatformUI.getWorkbench();
workbench.addWindowListener(workbenchListener);
IWorkbenchWindow[] workbenchWindows = workbench
.getWorkbenchWindows();
for (IWorkbenchWindow window : workbenchWindows) {
workbenchListener.hookWindow(window);
}
return Status.OK_STATUS;
}
};
registerJob.schedule();
}
示例6: schedulePerspectiveSwitchJob
import org.eclipse.ui.progress.UIJob; //导入依赖的package包/类
protected void schedulePerspectiveSwitchJob(final String perspectiveID) {
Job switchJob = new UIJob(DebugUIPlugin.getStandardDisplay(), "Perspective Switch Job") { //$NON-NLS-1$
public IStatus runInUIThread(IProgressMonitor monitor) {
IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow();
if (window != null && !(isCurrentPerspective(window, perspectiveID))) {
switchToPerspective(window, perspectiveID);
}
// Force the debug view to open
if (window != null) {
try {
window.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(SIMULATION_VIEW_ID);
} catch (PartInitException e) {
e.printStackTrace();
}
}
return Status.OK_STATUS;
}
};
switchJob.setSystem(true);
switchJob.setPriority(Job.INTERACTIVE);
switchJob.setRule(AsynchronousSchedulingRuleFactory.getDefault().newSerialPerObjectRule(this));
switchJob.schedule();
}
示例7: handleError
import org.eclipse.ui.progress.UIJob; //导入依赖的package包/类
@Override
public void handleError(final IStatus status) {
if (status != null && status.getSeverity() == IStatus.ERROR) {
UIJob job = new UIJob(Messages.DockerFoundryUiCallback_JOB_CF_ERROR) {
public IStatus runInUIThread(IProgressMonitor monitor) {
Shell shell = CloudUiUtil.getShell();
if (shell != null) {
new MessageDialog(shell, Messages.DockerFoundryUiCallback_ERROR_CALLBACK_TITLE, null,
status.getMessage(), MessageDialog.ERROR, new String[] { Messages.COMMONTXT_OK }, 0)
.open();
}
return Status.OK_STATUS;
}
};
job.setSystem(true);
job.schedule();
}
}
示例8: hookToCommands
import org.eclipse.ui.progress.UIJob; //导入依赖的package包/类
private void hookToCommands(final ToolItem lastEdit, final ToolItem nextEdit) {
final UIJob job = new UIJob("Hooking to commands") {
@Override
public IStatus runInUIThread(final IProgressMonitor monitor) {
final ICommandService service = WorkbenchHelper.getService(ICommandService.class);
final Command nextCommand = service.getCommand(IWorkbenchCommandConstants.NAVIGATE_FORWARD_HISTORY);
nextEdit.setEnabled(nextCommand.isEnabled());
final ICommandListener nextListener = e -> nextEdit.setEnabled(nextCommand.isEnabled());
nextCommand.addCommandListener(nextListener);
final Command lastCommand = service.getCommand(IWorkbenchCommandConstants.NAVIGATE_BACKWARD_HISTORY);
final ICommandListener lastListener = e -> lastEdit.setEnabled(lastCommand.isEnabled());
lastEdit.setEnabled(lastCommand.isEnabled());
lastCommand.addCommandListener(lastListener);
// Attaching dispose listeners to the toolItems so that they remove the
// command listeners properly
lastEdit.addDisposeListener(e -> lastCommand.removeCommandListener(lastListener));
nextEdit.addDisposeListener(e -> nextCommand.removeCommandListener(nextListener));
return Status.OK_STATUS;
}
};
job.schedule();
}
示例9: execute
import org.eclipse.ui.progress.UIJob; //导入依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException
{
UIJob job = new UIJob("Open Theme Preferences") //$NON-NLS-1$
{
@Override
public IStatus runInUIThread(IProgressMonitor monitor)
{
final PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(UIUtils.getActiveShell(),
ThemePreferencePage.ID, null, null);
dialog.open();
return Status.OK_STATUS;
}
};
job.setPriority(Job.INTERACTIVE);
job.setRule(PopupSchedulingRule.INSTANCE);
job.schedule();
return null;
}
示例10: updateName
import org.eclipse.ui.progress.UIJob; //导入依赖的package包/类
/**
* 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();
}
示例11: execute
import org.eclipse.ui.progress.UIJob; //导入依赖的package包/类
@Override
public void execute(String newWorkingDir) {
IContainer container = WorkbenchResourceUtil.findContainerFromWorkspace(getWorkingDir());
if (container != null) {
IProject project = container.getProject();
new UIJob(AngularCLIMessages.NgBuildCommandInterpreter_jobName) {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
try {
AngularCLIJson cliJson = AngularCLIProject.getAngularCLIProject(project).getAngularCLIJson();
IFolder distFolder = project.getFolder(cliJson.getOutDir());
distFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
if (distFolder.exists()) {
// Select dist folder in the Project Explorer.
UIInterpreterHelper.selectRevealInDefaultViews(distFolder);
}
} catch (CoreException e) {
return new Status(IStatus.ERROR, AngularCLIPlugin.PLUGIN_ID,
AngularCLIMessages.NgBuildCommandInterpreter_error, e);
}
return Status.OK_STATUS;
}
}.schedule();
}
}
示例12: testBugAig931
import org.eclipse.ui.progress.UIJob; //导入依赖的package包/类
/**
* Tests bug https://jira.int.sys.net/browse/AIG-931.
*
* @throws Exception
* the exception
*/
@Test
public void testBugAig931() throws Exception {
final String partialModel = "package p catalog T for grammar com.avaloq.tools.ddk.check.Check { error \"X\" for ";
final String[] expectedContextTypeProposals = {"EObject - org.eclipse.emf.ecore", "JvmType - org.eclipse.xtext.common.types"};
new UIJob("compute completion proposals") {
@SuppressWarnings("restriction")
@Override
public IStatus runInUIThread(final IProgressMonitor monitor) {
try {
completionsExist(newBuilder().append(partialModel).computeCompletionProposals(), expectedContextTypeProposals);
// CHECKSTYLE:OFF
} catch (Exception e) {
// CHECKSTYLE:ON
return new Status(Status.ERROR, "com.avaloq.tools.ddk.check.ui.test", 1, e.getMessage(), e);
}
return Status.OK_STATUS;
}
};
}
示例13: doRun
import org.eclipse.ui.progress.UIJob; //导入依赖的package包/类
public void doRun(final CloudFoundryServer cloudServer) {
final Shell shell = activePart != null && activePart.getSite() != null ? activePart.getSite().getShell()
: CFUiUtil.getShell();
if (shell != null) {
UIJob job = new UIJob(getJobName()) {
public IStatus runInUIThread(IProgressMonitor monitor) {
OrgsAndSpacesWizard wizard = new OrgsAndSpacesWizard(cloudServer);
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.open();
return Status.OK_STATUS;
}
};
job.setSystem(true);
job.schedule();
}
else {
CloudFoundryPlugin.logError("Unable to find an active shell to open the orgs and spaces wizard."); //$NON-NLS-1$
}
}
示例14: performFinish
import org.eclipse.ui.progress.UIJob; //导入依赖的package包/类
@Override
public boolean performFinish()
{
final String targetPath = this.page.getSourcePath();
final String fileName = this.page.getPagePath();
pageName = this.page.getPageName();
Job menuJob = new UIJob("")
{
public IStatus runInUIThread(IProgressMonitor monitor)
{
try {
doFinish(targetPath, fileName, monitor);
} catch (CoreException e) {
return Status.CANCEL_STATUS;
}
return Status.OK_STATUS;
}
};
menuJob.schedule(300L);
return true;
}
示例15: showErrorMessage
import org.eclipse.ui.progress.UIJob; //导入依赖的package包/类
private static void showErrorMessage(final String title, final String message, final Throwable exception)
{
if (Display.getCurrent() == null || exception != null)
{
UIJob job = new UIJob(message)
{
@Override
public IStatus runInUIThread(IProgressMonitor monitor)
{
if (exception == null)
{
showErrorDialog(title, message);
return Status.OK_STATUS;
}
return new Status(IStatus.ERROR, UIPlugin.PLUGIN_ID, null, exception);
}
};
job.setPriority(Job.INTERACTIVE);
job.setUser(true);
job.schedule();
}
else
{
showErrorDialog(title, message);
}
}