private static ContributedProcessorDescriptor[] getProcessorDescriptors(String contributionId, boolean testMarkerTypes) { IConfigurationElement[] elements= Platform.getExtensionRegistry().getConfigurationElementsFor(JavaUI.ID_PLUGIN, contributionId); ArrayList<ContributedProcessorDescriptor> res= new ArrayList<>(elements.length); for (int i= 0; i < elements.length; i++) { ContributedProcessorDescriptor desc= new ContributedProcessorDescriptor(elements[i], testMarkerTypes); IStatus status= desc.checkSyntax(); if (status.isOK()) { res.add(desc); } else { JavaPlugin.log(status); } } return res.toArray(new ContributedProcessorDescriptor[res.size()]); }
public void safeRun(ContributedProcessorDescriptor desc) throws Exception { IQuickFixProcessor processor= (IQuickFixProcessor) desc.getProcessor(fCu); if (processor != null && processor.hasCorrections(fCu, fProblemId)) { fHasCorrections= true; } } }
public ContributedProcessorDescriptor(IConfigurationElement element, boolean testMarkerTypes) { fConfigurationElement= element; fProcessorInstance= null; fStatus= null; // undefined if (fConfigurationElement.getChildren(ExpressionTagNames.ENABLEMENT).length == 0) { fStatus= Boolean.TRUE; } fRequiredSourceLevel= element.getAttribute(REQUIRED_SOURCE_LEVEL); fHandledMarkerTypes= testMarkerTypes ? getHandledMarkerTypes(element) : null; }
for (int i= 0; i < locations.length; i++) { IProblemLocation curr= locations[i]; if (processor.canHandleMarkerType(curr.getMarkerType())) { if (!allHandled) { // first handled problem if (res == null) {
public Object getProcessor(ICompilationUnit cunit) throws CoreException { if (matches(cunit)) { if (fProcessorInstance == null) { fProcessorInstance= fConfigurationElement.createExecutableExtension(CLASS); } return fProcessorInstance; } return null; }
for (int i= 0; i < locations.length; i++) { IProblemLocation curr= locations[i]; if (processor.canHandleMarkerType(curr.getMarkerType())) { if (!allHandled) { // first handled problem if (res == null) {
public Object getProcessor(ICompilationUnit cunit, Class<?> expectedType) { if (matches(cunit)) { if (fProcessorInstance == null) { try { Object extension= fConfigurationElement.createExecutableExtension(CLASS); if (expectedType.isInstance(extension)) { fProcessorInstance= extension; } else { String message= "Invalid extension to " + fConfigurationElement.getName() //$NON-NLS-1$ + ". Must extends '" + expectedType.getName() + "'." + fConfigurationElement.getContributor().getName(); //$NON-NLS-1$ //$NON-NLS-2$ JavaPlugin.log(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, message)); fStatus= Boolean.FALSE; return null; } } catch (CoreException e) { JavaPlugin.log(e); fStatus= Boolean.FALSE; return null; } } return fProcessorInstance; } return null; }
public void safeRun(ContributedProcessorDescriptor desc) throws Exception { IQuickFixProcessor processor= (IQuickFixProcessor) desc.getProcessor(fCu); if (processor != null && processor.hasCorrections(fCu, fProblemId)) { fHasCorrections= true; } } }
private static ContributedProcessorDescriptor[] getProcessorDescriptors(String contributionId, boolean testMarkerTypes) { IConfigurationElement[] elements= Platform.getExtensionRegistry().getConfigurationElementsFor(JavaUI.ID_PLUGIN, contributionId); ArrayList<ContributedProcessorDescriptor> res= new ArrayList<>(elements.length); for (int i= 0; i < elements.length; i++) { ContributedProcessorDescriptor desc= new ContributedProcessorDescriptor(elements[i], testMarkerTypes); IStatus status= desc.checkSyntax(); if (status.isOK()) { res.add(desc); } else { JavaPlugin.log(status); } } return res.toArray(new ContributedProcessorDescriptor[res.size()]); }
for (int i= 0; i < locations.length; i++) { IProblemLocation curr= locations[i]; if (processor.canHandleMarkerType(curr.getMarkerType())) { if (!allHandled) { // first handled problem if (res == null) {
public ContributedProcessorDescriptor(IConfigurationElement element, boolean testMarkerTypes) { fConfigurationElement= element; fProcessorInstance= null; fStatus= null; // undefined if (fConfigurationElement.getChildren(ExpressionTagNames.ENABLEMENT).length == 0) { fStatus= Boolean.TRUE; } fRequiredSourceLevel= element.getAttribute(REQUIRED_SOURCE_LEVEL); fHandledMarkerTypes= testMarkerTypes ? getHandledMarkerTypes(element) : null; }
public Object getProcessor(ICompilationUnit cunit, Class<?> expectedType) { if (matches(cunit)) { if (fProcessorInstance == null) { try { Object extension= fConfigurationElement.createExecutableExtension(CLASS); if (expectedType.isInstance(extension)) { fProcessorInstance= extension; } else { String message= "Invalid extension to " + fConfigurationElement.getName() //$NON-NLS-1$ + ". Must extends '" + expectedType.getName() + "'." + fConfigurationElement.getContributor().getName(); //$NON-NLS-1$ //$NON-NLS-2$ JavaPlugin.log(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, message)); fStatus= Boolean.FALSE; return null; } } catch (CoreException e) { JavaPlugin.log(e); fStatus= Boolean.FALSE; return null; } } return fProcessorInstance; } return null; }
@Override public void safeRun(ContributedProcessorDescriptor desc) throws Exception { IQuickFixProcessor processor= (IQuickFixProcessor) desc.getProcessor(fCu, IQuickFixProcessor.class); if (processor != null && processor.hasCorrections(fCu, fProblemId)) { fHasCorrections= true; } } }
private static ContributedProcessorDescriptor[] getProcessorDescriptors(String contributionId, boolean testMarkerTypes) { IConfigurationElement[] elements= Platform.getExtensionRegistry().getConfigurationElementsFor(JavaUI.ID_PLUGIN, contributionId); ArrayList res= new ArrayList(elements.length); for (int i= 0; i < elements.length; i++) { ContributedProcessorDescriptor desc= new ContributedProcessorDescriptor(elements[i], testMarkerTypes); IStatus status= desc.checkSyntax(); if (status.isOK()) { res.add(desc); } else { JavaPlugin.log(status); } } return (ContributedProcessorDescriptor[]) res.toArray(new ContributedProcessorDescriptor[res.size()]); }
for (int i= 0; i < locations.length; i++) { IProblemLocation curr= locations[i]; if (processor.canHandleMarkerType(curr.getMarkerType())) { if (!allHandled) { // first handled problem if (res == null) {
public ContributedProcessorDescriptor(IConfigurationElement element, boolean testMarkerTypes) { fConfigurationElement= element; fProcessorInstance= null; fStatus= null; // undefined if (fConfigurationElement.getChildren(ExpressionTagNames.ENABLEMENT).length == 0) { fStatus= Boolean.TRUE; } fRequiredSourceLevel= element.getAttribute(REQUIRED_SOURCE_LEVEL); fHandledMarkerTypes= testMarkerTypes ? getHandledMarkerTypes(element) : null; }
@Override public void safeRun(ContributedProcessorDescriptor desc) throws Exception { IQuickFixProcessor processor= (IQuickFixProcessor) desc.getProcessor(fCu, IQuickFixProcessor.class); if (processor != null && processor.hasCorrections(fCu, fProblemId)) { fHasCorrections= true; } } }
private static ContributedProcessorDescriptor[] getProcessorDescriptors( String contributionId, boolean testMarkerTypes) { IConfigurationElement[] elements = Platform.getExtensionRegistry() .getConfigurationElementsFor(JavaUI.ID_PLUGIN, contributionId); ArrayList res = new ArrayList(elements.length); for (int i = 0; i < elements.length; i++) { // AspectJ Change Begin // skip jdt's processor, as we have registered our own if (!elements[i] .getAttribute("class") //$NON-NLS-1$ .equals( "org.eclipse.jdt.internal.ui.text.correction.QuickFixProcessor")) { //$NON-NLS-1$ ContributedProcessorDescriptor desc = new ContributedProcessorDescriptor( elements[i], testMarkerTypes); IStatus status = desc.checkSyntax(); if (status.isOK()) { res.add(desc); } else { JavaPlugin.log(status); } } // AspectJ Change End } return (ContributedProcessorDescriptor[]) res .toArray(new ContributedProcessorDescriptor[res.size()]); }
public static boolean hasCorrections(ICompilationUnit cu, int problemId, String markerType) { ContributedProcessorDescriptor[] processors= getCorrectionProcessors(); SafeHasCorrections collector= new SafeHasCorrections(cu, problemId); for (int i= 0; i < processors.length; i++) { if (processors[i].canHandleMarkerType(markerType)) { collector.process(processors[i]); if (collector.hasCorrections()) { return true; } } } return false; }
public void safeRun(ContributedProcessorDescriptor desc) throws Exception { IQuickAssistProcessor curr= (IQuickAssistProcessor) desc.getProcessor(fContext.getCompilationUnit()); if (curr != null) { IJavaCompletionProposal[] res= curr.getAssists(fContext, fLocations); if (res != null) { for (int k= 0; k < res.length; k++) { fProposals.add(res[k]); } } } } }