public static void addProjectSetupFixProposal(IInvocationContext context, IProblemLocation problem, String missingType, Collection<ICommandAccess> proposals) { proposals.add(new ClasspathFixCorrectionProposal(context.getCompilationUnit(), problem.getOffset(), problem.getLength(), missingType)); }
@Override public void apply(IDocument document) { IRunnableContext context= JavaPlugin.getActiveWorkbenchWindow(); if (context == null) { context= new BusyIndicatorRunnableContext(); } Shell shell= JavaPlugin.getActiveWorkbenchShell(); if (ClasspathFixSelectionDialog.openClasspathFixSelectionDialog(shell, getCompilationUnit().getJavaProject(), fMissingType, context)) { if (fMissingType.indexOf('.') == -1) { try { IChooseImportQuery query= AddImportOnSelectionAction.newDialogQuery(shell); AddImportsOperation op= new AddImportsOperation(getCompilationUnit(), fOffset, fLength, query, false, false); IProgressService progressService= PlatformUI.getWorkbench().getProgressService(); progressService.runInUI(context, new WorkbenchRunnableAdapter(op, op.getScheduleRule()), op.getScheduleRule()); fResultingEdit= op.getResultingEdit(); super.apply(document); } catch (InvocationTargetException e) { JavaPlugin.log(e); } catch (InterruptedException e) { // ignore } } } }
@Override public void apply(IDocument document) { IRunnableContext context= JavaPlugin.getActiveWorkbenchWindow(); if (context == null) { context= new BusyIndicatorRunnableContext(); } Shell shell= JavaPlugin.getActiveWorkbenchShell(); if (ClasspathFixSelectionDialog.openClasspathFixSelectionDialog(shell, getCompilationUnit().getJavaProject(), fMissingType, context)) { if (fMissingType.indexOf('.') == -1) { try { IChooseImportQuery query= AddImportOnSelectionAction.newDialogQuery(shell); AddImportsOperation op= new AddImportsOperation(getCompilationUnit(), fOffset, fLength, query, false, false); IProgressService progressService= PlatformUI.getWorkbench().getProgressService(); progressService.runInUI(context, new WorkbenchRunnableAdapter(op, op.getScheduleRule()), op.getScheduleRule()); fResultingEdit= op.getResultingEdit(); super.apply(document); } catch (InvocationTargetException e) { JavaPlugin.log(e); } catch (InterruptedException e) { // ignore } } } }
public static void addProjectSetupFixProposal(IInvocationContext context, IProblemLocation problem, String missingType, Collection<ICommandAccess> proposals) { proposals.add(new ClasspathFixCorrectionProposal(context.getCompilationUnit(), problem.getOffset(), problem.getLength(), missingType)); }