Search in sources :

Example 26 with IProgressService

use of org.eclipse.ui.progress.IProgressService in project netxms by netxms.

the class Activator method start.

/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
	 * )
	 */
public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;
    IProgressService service = PlatformUI.getWorkbench().getProgressService();
    // $NON-NLS-1$
    service.registerIconForFamily(getImageDescriptor("icons/event_configurator.png"), EventConfigurator.JOB_FAMILY);
}
Also used : IProgressService(org.eclipse.ui.progress.IProgressService)

Example 27 with IProgressService

use of org.eclipse.ui.progress.IProgressService in project netxms by netxms.

the class Activator method start.

/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
	 * )
	 */
public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;
    // Register icon for our jobs
    IProgressService service = PlatformUI.getWorkbench().getProgressService();
    // $NON-NLS-1$
    service.registerIconForFamily(getImageDescriptor("icons/log_viewer_job.png"), LogViewer.JOB_FAMILY);
}
Also used : IProgressService(org.eclipse.ui.progress.IProgressService)

Example 28 with IProgressService

use of org.eclipse.ui.progress.IProgressService in project netxms by netxms.

the class ObjectToolsAdapterFactory method getAdapter.

/* (non-Javadoc)
	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
	 */
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
    if (adaptableObject.getClass() != ObjectTool.class)
        return null;
    // Adapt to tool details
    if (adapterType == ObjectToolDetails.class) {
        final long toolId = ((ObjectTool) adaptableObject).getId();
        ObjectToolDetails details = cache.get(toolId);
        if (details == null) {
            ToolDetailLoader job = new ToolDetailLoader(toolId, PlatformUI.getWorkbench().getDisplay());
            IProgressService service = PlatformUI.getWorkbench().getProgressService();
            try {
                service.busyCursorWhile(job);
                details = job.getResult();
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
        return details;
    }
    // Adapt to IWorkbenchAdapter
    if (adapterType == IWorkbenchAdapter.class) {
        return new IWorkbenchAdapter() {

            @Override
            public Object getParent(Object o) {
                return null;
            }

            @Override
            public String getLabel(Object o) {
                return ((ObjectTool) o).getDisplayName();
            }

            @Override
            public ImageDescriptor getImageDescriptor(Object object) {
                return null;
            }

            @Override
            public Object[] getChildren(Object o) {
                return null;
            }
        };
    }
    return null;
}
Also used : IProgressService(org.eclipse.ui.progress.IProgressService) IWorkbenchAdapter(org.eclipse.ui.model.IWorkbenchAdapter) ObjectToolDetails(org.netxms.client.objecttools.ObjectToolDetails) InvocationTargetException(java.lang.reflect.InvocationTargetException) ObjectTool(org.netxms.client.objecttools.ObjectTool)

Example 29 with IProgressService

use of org.eclipse.ui.progress.IProgressService in project liferay-ide by liferay.

the class CompileAction method run.

@Override
public void run() {
    final ISelection selection = getSelectionProjects();
    if ((selection != null) && selection instanceof IStructuredSelection) {
        Object[] projects = ((IStructuredSelection) selection).toArray();
        try {
            SDK sdk = SDKUtil.getWorkspaceSDK();
            IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
            progressService.busyCursorWhile(new IRunnableWithProgress() {

                public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
                    for (Object project : projects) {
                        if (project instanceof IProject) {
                            IProject p = (IProject) project;
                            sdk.war(p, null, false, monitor);
                            IDocument document = ((ProcessConsole) getConsole(p.getName())).getDocument();
                            if (document.get().contains("BUILD FAILED")) {
                                return;
                            }
                        }
                    }
                }
            });
        } catch (Exception e) {
        }
    }
}
Also used : IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) InvocationTargetException(java.lang.reflect.InvocationTargetException) IProject(org.eclipse.core.resources.IProject) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IProgressService(org.eclipse.ui.progress.IProgressService) ISelection(org.eclipse.jface.viewers.ISelection) SDK(com.liferay.ide.sdk.core.SDK) IDocument(org.eclipse.jface.text.IDocument)

Example 30 with IProgressService

use of org.eclipse.ui.progress.IProgressService in project xtext-eclipse by eclipse.

the class JdtReferenceFinder method performNewSearch.

protected void performNewSearch(String label, Iterable<? extends IJavaElement> elements) throws JavaModelException, InterruptedException {
    CompositeSearchQuery compositeSearchQuery = createCompositeQuery(label, elements);
    if (compositeSearchQuery.canRunInBackground()) {
        SearchUtil.runQueryInBackground(compositeSearchQuery);
    } else {
        IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
        IStatus status = SearchUtil.runQueryInForeground(progressService, compositeSearchQuery);
        if (status.matches(IStatus.ERROR | IStatus.INFO | IStatus.WARNING)) {
            ErrorDialog.openError(getShell(), SearchMessages.Search_Error_search_title, SearchMessages.Search_Error_search_message, status);
        }
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) IProgressService(org.eclipse.ui.progress.IProgressService)

Aggregations

IProgressService (org.eclipse.ui.progress.IProgressService)38 InvocationTargetException (java.lang.reflect.InvocationTargetException)18 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)17 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)15 IStatus (org.eclipse.core.runtime.IStatus)11 IOException (java.io.IOException)7 Status (org.eclipse.core.runtime.Status)6 IWorkbench (org.eclipse.ui.IWorkbench)6 File (java.io.File)5 CoreException (org.eclipse.core.runtime.CoreException)5 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)4 IContext (org.talend.core.model.process.IContext)4 ProcessorException (org.talend.designer.runprocess.ProcessorException)4 MessageFormat (java.text.MessageFormat)3 Date (java.util.Date)3 IProject (org.eclipse.core.resources.IProject)3 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)3 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)3 IProcessor (org.talend.designer.runprocess.IProcessor)3 ClearPerformanceAction (org.talend.designer.runprocess.ui.actions.ClearPerformanceAction)3