@Override public IQueryGroup get() { try{ if(queryGroup == null) { queryGroup = (IQueryGroup) element.createExecutableExtension("group"); } return queryGroup; } catch (CoreException e) { throw new IllegalStateException(e.getMessage(), e); } }
/** * Log the given CoreException in a manner that will include the stacktrace of * the exception in the log. * @param e the exception */ public static void log(CoreException e) { log(e.getStatus().getSeverity(), e.getMessage(), e); }
private static void safeAdd(IProject project, List<IProject> projectList) { try { if(project != null && project.isAccessible() && project.hasNature(IMavenConstants.NATURE_ID) && !projectList.contains(project)) { projectList.add(project); } } catch(CoreException ex) { log.error(ex.getMessage(), ex); } }
private static IStatus createMultiStatus(CoreException originalException, CoreException e) { IStatus childStatus = Activator.createErrorStatus( originalException.getMessage(), originalException); return new MultiStatus(Activator.getPluginId(), IStatus.ERROR, new IStatus[] { childStatus }, e.getMessage(), e); }
public void deleteValidationMarkers(IFile file, CheckMode checkMode, IProgressMonitor monitor) { if (shouldProcess(file)) { try { deleteMarkers(file, checkMode, monitor); } catch (CoreException ex) { LOG.error(ex.getMessage(), ex); } } }
public static boolean hasNature(IProject project) { try { if (project.isAccessible()) { return project.hasNature(NATURE_ID); } } catch (CoreException e) { log.error(e.getMessage(), e); } return false; }
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { try { // attempt to save the state of the workspace ResourcesPlugin.getWorkspace().save(true, monitor); return Status.OK_STATUS; } catch (CoreException e) { throw new ExecutionException(e.getMessage(), e); } } }
public static void waitForBuild(IProgressMonitor monitor) { try { ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor); } catch (CoreException e) { throw new OperationCanceledException(e.getMessage()); } }
protected Collection<IMarker> getRelatedProjectMarkers(IProject project) { if (!project.isAccessible()) { return Collections.emptyList(); } try { return Arrays.asList(project.findMarkers(MARKER_TYPE, true, IResource.DEPTH_ONE)); } catch (CoreException e) { ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, e.getMessage(), e)); return Collections.emptyList(); } }
private static String getLocalEncoding(IResource resource) { if (resource instanceof IEncodedStorage) { IEncodedStorage es = (IEncodedStorage) resource; try { return es.getCharset(); } catch (CoreException e) { Activator.logError(e.getMessage(), e); } } return null; }
public static List<IMarker> findReportIssuesMarkers(IResource resource) { try { return Arrays.asList(resource.findMarkers(SonarLintCorePlugin.MARKER_REPORT_ID, true, IResource.DEPTH_INFINITE)); } catch (CoreException e) { SonarLintLogger.get().error(e.getMessage(), e); return Collections.emptyList(); } }
public void waitForBuild(IProgressMonitor monitor) { try { workspace.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor); } catch (CoreException e) { throw new OperationCanceledException(e.getMessage()); } }
protected final IStatus removeRootMapping(IVirtualComponent sourceComponent, String uriMapping, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException, ExecutionException { try { sourceComponent.getRootFolder().removeLink(new Path(uriMapping), 0, monitor); } catch (CoreException e) { return J2EEPlugin.createErrorStatus(0, e.getMessage(), e); } return Status.OK_STATUS; }
protected void perform(CoreException e, Shell shell, String title, String message) { IStatus status= e.getStatus(); JDIDebugUIPlugin.log(e); if (status != null) { ErrorDialog.openError(shell, title, message, status); } else { displayMessageDialog(e.getMessage(), shell, title, message); } }
public boolean select(Viewer viewer, Object parentElement, Object element) { try { return (filterExpression.evaluate(new EvaluationContext(null, element)) != EvaluationResult.TRUE); } catch (CoreException e) { NavigatorPlugin.logError(0, e.getMessage(), e); } return true; }
@Override protected BundleDescription getBundleDescription(Map<String, String> manifest, String location, long id) throws BundleException { try { BundleDescription result = getModel().getBundleDescription(); if (result == null) { throw new BundleException("Cannot find manifest for bundle at " + location); //$NON-NLS-1$ } return result; } catch (CoreException ce) { throw new BundleException(ce.getMessage()); } }
public void run() { MessageDialog .openError( PlatformUI .getWorkbench() .getActiveWorkbenchWindow() .getShell(), Messages.common_error, e1 .getMessage()); } });
private static CallHierarchyViewPart openInViewPart(IWorkbenchWindow window, IJavaElement input) { IWorkbenchPage page= window.getActivePage(); try { CallHierarchyViewPart result= (CallHierarchyViewPart)page.showView(CallHierarchyViewPart.ID_CALL_HIERARCHY); result.setMethod((IMethod)input); return result; } catch (CoreException e) { ExceptionHandler.handle(e, window.getShell(), CallHierarchyMessages.CallHierarchyUI_error_open_view, e.getMessage()); } return null; }
private void run(IWorkspaceRunnable runnable, IProgressMonitor monitor) { monitor = Policy.monitorFor(monitor); monitor.beginTask(null, 100); try { beginInput(); runnable.run(Policy.subMonitorFor(monitor, 80)); } catch (CoreException e) { addError(new TeamStatus(IStatus.ERROR, TeamPlugin.ID, ITeamStatus.SYNC_INFO_SET_ERROR, e.getMessage(), e, null)); } finally { endInput(Policy.subMonitorFor(monitor, 20)); } }
public static void clearMarkers(ISonarLintFile file) { resetExtraPositions(file.getDocument()); try { file.getResource().deleteMarkers(SonarLintCorePlugin.MARKER_ON_THE_FLY_ID, false, IResource.DEPTH_ZERO); } catch (CoreException e) { SonarLintLogger.get().error(e.getMessage(), e); } }