private void init() { IExtensionRegistry registry= Platform.getExtensionRegistry(); IConfigurationElement[] ces= registry.getConfigurationElementsFor(fPluginId, fParticipantID); fParticipants= new ArrayList<>(ces.length); for (int i= 0; i < ces.length; i++) { ParticipantDescriptor descriptor= new ParticipantDescriptor(ces[i]); IStatus status= descriptor.checkSyntax(); switch (status.getSeverity()) { case IStatus.ERROR: RefactoringCorePlugin.log(status); break; case IStatus.WARNING: case IStatus.INFO: RefactoringCorePlugin.log(status); fParticipants.add(descriptor); break; default: fParticipants.add(descriptor); } } }
protected void internalHandleException(Change change, Throwable e) { if (e instanceof OperationCanceledException) return; RefactoringParticipant participant= (RefactoringParticipant)fParticipantMap.get(change); if (participant != null) { ParticipantDescriptor descriptor= participant.getDescriptor(); descriptor.disable(); RefactoringCorePlugin.logRemovedParticipant(descriptor, e); } } protected boolean internalContinueOnCancel() {
for (Iterator iter= fParticipants.iterator(); iter.hasNext();) { ParticipantDescriptor descriptor= (ParticipantDescriptor)iter.next(); if (!descriptor.isEnabled()) { iter.remove(); } else { try { RefactoringStatus filterStatus= new RefactoringStatus(); if (descriptor.matches(evalContext, filter, filterStatus)) { RefactoringParticipant participant= shared.get(descriptor); if (participant != null) { ((ISharableParticipant)participant).addElement(element, arguments); } else { participant= descriptor.createParticipant(); if (fParticipantClass.isInstance(participant)) { if (participant.initialize(processor, element, arguments)) { status.addError(Messages.format( RefactoringCoreMessages.ParticipantExtensionPoint_participant_removed, descriptor.getName())); RefactoringCorePlugin.logErrorMessage( Messages.format( RefactoringCoreMessages.ParticipantExtensionPoint_wrong_type, new String[] {descriptor.getName(), fParticipantClass.getName()})); iter.remove();
public IStatus checkSyntax() { if (fConfigurationElement.getAttribute(ID) == null) { return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, RefactoringCoreMessages.ParticipantDescriptor_error_id_missing, null); } if (fConfigurationElement.getAttribute(NAME) == null) { return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, Messages.format( RefactoringCoreMessages.ParticipantDescriptor_error_name_missing, getId()), null); } if (fConfigurationElement.getAttribute(CLASS) == null) { return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, Messages.format( RefactoringCoreMessages.ParticipantDescriptor_error_class_missing, getId()), null); } return Status.OK_STATUS; }
private void logMalfunctioningParticipant(RefactoringStatus status, ParticipantDescriptor descriptor, Throwable e) { status.addError(Messages.format( RefactoringCoreMessages.ParticipantExtensionPoint_participant_removed, descriptor.getName())); RefactoringCorePlugin.logRemovedParticipant(descriptor, e); }
public boolean matches(IEvaluationContext context, IParticipantDescriptorFilter filter, RefactoringStatus status) throws CoreException { IConfigurationElement[] elements= fConfigurationElement.getChildren(ExpressionTagNames.ENABLEMENT); if (elements.length == 0) return false; Assert.isTrue(elements.length == 1); Expression exp= ExpressionConverter.getDefault().perform(elements[0]); if (!convert(exp.evaluate(context))) return false; if (filter != null && !filter.select(fConfigurationElement, status)) return false; return true; }
protected boolean internalProcessOnCancel(Change change) { RefactoringParticipant participant= (RefactoringParticipant)fParticipantMap.get(change); if (participant == null) return false; return participant.getDescriptor().processOnCancel(); } }
for (Iterator<ParticipantDescriptor> iter= fParticipants.iterator(); iter.hasNext();) { ParticipantDescriptor descriptor= iter.next(); if (!descriptor.isEnabled()) { iter.remove(); } else { try { RefactoringStatus filterStatus= new RefactoringStatus(); if (descriptor.matches(evalContext, filter, filterStatus)) { RefactoringParticipant participant= shared.get(descriptor); if (participant != null) { ((ISharableParticipant)participant).addElement(element, arguments); } else { participant= descriptor.createParticipant(); if (fParticipantClass.isInstance(participant)) { if (participant.initialize(processor, element, arguments)) { status.addError(Messages.format( RefactoringCoreMessages.ParticipantExtensionPoint_participant_removed, descriptor.getName())); RefactoringCorePlugin.logErrorMessage( Messages.format( RefactoringCoreMessages.ParticipantExtensionPoint_wrong_type, new String[] {descriptor.getName(), fParticipantClass.getName()})); iter.remove();
public IStatus checkSyntax() { if (fConfigurationElement.getAttribute(ID) == null) { return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, RefactoringCoreMessages.ParticipantDescriptor_error_id_missing, null); } if (fConfigurationElement.getAttribute(NAME) == null) { return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, Messages.format( RefactoringCoreMessages.ParticipantDescriptor_error_name_missing, getId()), null); } if (fConfigurationElement.getAttribute(CLASS) == null) { return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, Messages.format( RefactoringCoreMessages.ParticipantDescriptor_error_class_missing, getId()), null); } return Status.OK_STATUS; }
private void logMalfunctioningParticipant(RefactoringStatus status, ParticipantDescriptor descriptor, Throwable e) { status.addError(Messages.format( RefactoringCoreMessages.ParticipantExtensionPoint_participant_removed, descriptor.getName())); RefactoringCorePlugin.logRemovedParticipant(descriptor, e); }
public boolean matches(IEvaluationContext context, IParticipantDescriptorFilter filter, RefactoringStatus status) throws CoreException { IConfigurationElement[] elements= fConfigurationElement.getChildren(ExpressionTagNames.ENABLEMENT); if (elements.length == 0) return false; Assert.isTrue(elements.length == 1); Expression exp= ExpressionConverter.getDefault().perform(elements[0]); if (!convert(exp.evaluate(context))) return false; if (filter != null && !filter.select(fConfigurationElement, status)) return false; return true; }
@Override protected boolean internalProcessOnCancel(Change change) { RefactoringParticipant participant= fParticipantMap.get(change); if (participant == null) return false; return participant.getDescriptor().processOnCancel(); } }
for (Iterator<ParticipantDescriptor> iter= fParticipants.iterator(); iter.hasNext();) { ParticipantDescriptor descriptor= iter.next(); if (!descriptor.isEnabled()) { iter.remove(); } else { try { RefactoringStatus filterStatus= new RefactoringStatus(); if (descriptor.matches(evalContext, filter, filterStatus)) { RefactoringParticipant participant= shared.get(descriptor); if (participant != null) { ((ISharableParticipant)participant).addElement(element, arguments); } else { participant= descriptor.createParticipant(); if (fParticipantClass.isInstance(participant)) { if (participant.initialize(processor, element, arguments)) { status.addError(Messages.format( RefactoringCoreMessages.ParticipantExtensionPoint_participant_removed, descriptor.getName())); RefactoringCorePlugin.logErrorMessage( Messages.format( RefactoringCoreMessages.ParticipantExtensionPoint_wrong_type, new String[] {descriptor.getName(), fParticipantClass.getName()})); iter.remove();
private void init() { IExtensionRegistry registry= Platform.getExtensionRegistry(); IConfigurationElement[] ces= registry.getConfigurationElementsFor(fPluginId, fParticipantID); fParticipants= new ArrayList<>(ces.length); for (int i= 0; i < ces.length; i++) { ParticipantDescriptor descriptor= new ParticipantDescriptor(ces[i]); IStatus status= descriptor.checkSyntax(); switch (status.getSeverity()) { case IStatus.ERROR: RefactoringCorePlugin.log(status); break; case IStatus.WARNING: case IStatus.INFO: RefactoringCorePlugin.log(status); fParticipants.add(descriptor); break; default: fParticipants.add(descriptor); } } }
public IStatus checkSyntax() { if (fConfigurationElement.getAttribute(ID) == null) { return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, RefactoringCoreMessages.ParticipantDescriptor_error_id_missing, null); } if (fConfigurationElement.getAttribute(NAME) == null) { return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, Messages.format( RefactoringCoreMessages.ParticipantDescriptor_error_name_missing, getId()), null); } if (fConfigurationElement.getAttribute(CLASS) == null) { return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, Messages.format( RefactoringCoreMessages.ParticipantDescriptor_error_class_missing, getId()), null); } return new Status(IStatus.OK, RefactoringCorePlugin.getPluginId(), IStatus.OK, RefactoringCoreMessages.ParticipantDescriptor_correct, null); }
private static void disableParticipant(final RefactoringParticipant participant, Throwable e) { ParticipantDescriptor descriptor= participant.getDescriptor(); descriptor.disable(); RefactoringCorePlugin.logRemovedParticipant(descriptor, e); }
private void logMalfunctioningParticipant(RefactoringStatus status, ParticipantDescriptor descriptor, Throwable e) { status.addError(Messages.format( RefactoringCoreMessages.ParticipantExtensionPoint_participant_removed, descriptor.getName())); RefactoringCorePlugin.logRemovedParticipant(descriptor, e); }
public boolean matches(IEvaluationContext context, IParticipantDescriptorFilter filter, RefactoringStatus status) throws CoreException { IConfigurationElement[] elements= fConfigurationElement.getChildren(ExpressionTagNames.ENABLEMENT); if (elements.length == 0) return false; Assert.isTrue(elements.length == 1); Expression exp= ExpressionConverter.getDefault().perform(elements[0]); if (!convert(exp.evaluate(context))) return false; if (filter != null && !filter.select(fConfigurationElement, status)) return false; return true; }