diff options
author | Mickael Istria | 2020-09-10 13:32:15 +0000 |
---|---|---|
committer | Mickael Istria | 2020-09-10 20:30:02 +0000 |
commit | 22e289d31606b7e610972f220c527273883c3678 (patch) | |
tree | 284983e3ce3a65ccbade016b0a730fdc3f909866 | |
parent | d55fd34fd1ad0408220b676d824382a0f66861cc (diff) | |
download | eclipse.platform.text-22e289d31606b7e610972f220c527273883c3678.tar.gz eclipse.platform.text-22e289d31606b7e610972f220c527273883c3678.tar.xz eclipse.platform.text-22e289d31606b7e610972f220c527273883c3678.zip |
Bug 566872 - Generic Editor adds UNDEFINED_VARIABLE for enabledWhenI20200913-1800I20200912-1800I20200912-0010I20200911-1800I20200910-1800
This allows to use variables in any case, without receiving an
ExpressionException if undefined
Change-Id: I506d7f6f233a068f266868133c500240bf83d1ab
Signed-off-by: Mickael Istria <mistria@redhat.com>
4 files changed, 126 insertions, 99 deletions
diff --git a/org.eclipse.ui.genericeditor/META-INF/MANIFEST.MF b/org.eclipse.ui.genericeditor/META-INF/MANIFEST.MF index fc5a4ec2a2d..05b438dba0b 100644 --- a/org.eclipse.ui.genericeditor/META-INF/MANIFEST.MF +++ b/org.eclipse.ui.genericeditor/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.ui.genericeditor;singleton:=true -Bundle-Version: 1.1.800.qualifier +Bundle-Version: 1.1.900.qualifier Bundle-Vendor: %Bundle-Vendor Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: org.eclipse.ui.workbench.texteditor;bundle-version="3.10.0", diff --git a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ExtensionBasedTextViewerConfiguration.java b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ExtensionBasedTextViewerConfiguration.java index 70510752e92..41ae32499e3 100644 --- a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ExtensionBasedTextViewerConfiguration.java +++ b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ExtensionBasedTextViewerConfiguration.java @@ -58,13 +58,15 @@ import org.eclipse.ui.internal.genericeditor.markers.MarkerResoltionQuickAssistP import org.eclipse.ui.texteditor.ITextEditor; /** - * The configuration of the {@link ExtensionBasedTextEditor}. It registers the proxy composite for hover, completion, syntax highlighting, and then those proxy take care of resolving to the right - * extensions on-demand. + * The configuration of the {@link ExtensionBasedTextEditor}. It registers the + * proxy composite for hover, completion, syntax highlighting, and then those + * proxy take care of resolving to the right extensions on-demand. * * @since 1.0 */ @SuppressWarnings("restriction") -public final class ExtensionBasedTextViewerConfiguration extends TextSourceViewerConfiguration implements IDocumentPartitioningListener { +public final class ExtensionBasedTextViewerConfiguration extends TextSourceViewerConfiguration + implements IDocumentPartitioningListener { private ITextEditor editor; private Set<IContentType> contentTypes; @@ -75,10 +77,8 @@ public final class ExtensionBasedTextViewerConfiguration extends TextSourceViewe /** * - * @param editor - * the editor we're creating. - * @param preferenceStore - * the preference store. + * @param editor the editor we're creating. + * @param preferenceStore the preference store. */ public ExtensionBasedTextViewerConfiguration(ITextEditor editor, IPreferenceStore preferenceStore) { super(preferenceStore); @@ -89,21 +89,12 @@ public final class ExtensionBasedTextViewerConfiguration extends TextSourceViewe if (this.contentTypes == null) { this.contentTypes = new LinkedHashSet<>(); String fileName = null; - if (this.editor != null) { - fileName = editor.getEditorInput().getName(); - } else { - IDocument document = viewer.getDocument(); - if (document != null) { - ITextFileBuffer buffer = FileBuffers.getTextFileBufferManager().getTextFileBuffer(document); - if (buffer != null) { - fileName = buffer.getLocation().lastSegment(); - } - } - } + fileName = getCurrentFileName(viewer); if (fileName == null) { return Collections.emptySet(); } - Queue<IContentType> types = new LinkedList<>(Arrays.asList(Platform.getContentTypeManager().findContentTypesFor(fileName))); + Queue<IContentType> types = new LinkedList<>( + Arrays.asList(Platform.getContentTypeManager().findContentTypesFor(fileName))); while (!types.isEmpty()) { IContentType type = types.poll(); this.contentTypes.add(type); @@ -116,8 +107,27 @@ public final class ExtensionBasedTextViewerConfiguration extends TextSourceViewe return this.contentTypes; } - @Override public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) { - List<ITextHover> hovers = GenericEditorPlugin.getDefault().getHoverRegistry().getAvailableHovers(sourceViewer, editor, getContentTypes(sourceViewer)); + private String getCurrentFileName(ISourceViewer viewer) { + String fileName = null; + if (this.editor != null) { + fileName = editor.getEditorInput().getName(); + } + if (fileName == null) { + IDocument viewerDocument = viewer.getDocument(); + if (document != null) { + ITextFileBuffer buffer = FileBuffers.getTextFileBufferManager().getTextFileBuffer(viewerDocument); + if (buffer != null) { + fileName = buffer.getLocation().lastSegment(); + } + } + } + return fileName; + } + + @Override + public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) { + List<ITextHover> hovers = GenericEditorPlugin.getDefault().getHoverRegistry().getAvailableHovers(sourceViewer, + editor, getContentTypes(sourceViewer)); if (hovers == null || hovers.isEmpty()) { return null; } else if (hovers.size() == 1) { @@ -127,11 +137,12 @@ public final class ExtensionBasedTextViewerConfiguration extends TextSourceViewe } } - @Override public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { + @Override + public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { ContentAssistProcessorRegistry registry = GenericEditorPlugin.getDefault().getContentAssistProcessorRegistry(); contentAssistant = new ContentAssistant(true); - contentAssistant.setContextInformationPopupOrientation(ContentAssistant.CONTEXT_INFO_BELOW); - contentAssistant.setProposalPopupOrientation(ContentAssistant.PROPOSAL_REMOVE); + contentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_BELOW); + contentAssistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_REMOVE); contentAssistant.setAutoActivationDelay(0); contentAssistant.enableColoredLabels(true); contentAssistant.enableAutoActivation(true); @@ -146,7 +157,8 @@ public final class ExtensionBasedTextViewerConfiguration extends TextSourceViewe associateTokenContentTypes(this.document); } contentAssistant.setInformationControlCreator(new AbstractReusableInformationControlCreator() { - @Override protected IInformationControl doCreateInformationControl(Shell parent) { + @Override + protected IInformationControl doCreateInformationControl(Shell parent) { return new DefaultInformationControl(parent); } }); @@ -154,9 +166,11 @@ public final class ExtensionBasedTextViewerConfiguration extends TextSourceViewe return contentAssistant; } - @Override public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { + @Override + public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { PresentationReconcilerRegistry registry = GenericEditorPlugin.getDefault().getPresentationReconcilerRegistry(); - List<IPresentationReconciler> reconciliers = registry.getPresentationReconcilers(sourceViewer, editor, getContentTypes(sourceViewer)); + List<IPresentationReconciler> reconciliers = registry.getPresentationReconcilers(sourceViewer, editor, + getContentTypes(sourceViewer)); if (!reconciliers.isEmpty()) { return reconciliers.get(0); } @@ -177,7 +191,8 @@ public final class ExtensionBasedTextViewerConfiguration extends TextSourceViewe } } - @Override public void documentPartitioningChanged(IDocument document) { + @Override + public void documentPartitioningChanged(IDocument document) { associateTokenContentTypes(document); } @@ -192,30 +207,38 @@ public final class ExtensionBasedTextViewerConfiguration extends TextSourceViewe } } - @Override public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) { + @Override + public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) { QuickAssistAssistant quickAssistAssistant = new QuickAssistAssistant(); List<IQuickAssistProcessor> quickAssistProcessors = new ArrayList<>(); quickAssistProcessors.add(new MarkerResoltionQuickAssistProcessor()); - quickAssistProcessors.addAll(GenericEditorPlugin.getDefault().getQuickAssistProcessorRegistry().getQuickAssistProcessors(sourceViewer, editor, getContentTypes(sourceViewer))); - CompositeQuickAssistProcessor compQuickAssistProcessor = new CompositeQuickAssistProcessor(quickAssistProcessors); + quickAssistProcessors.addAll(GenericEditorPlugin.getDefault().getQuickAssistProcessorRegistry() + .getQuickAssistProcessors(sourceViewer, editor, getContentTypes(sourceViewer))); + CompositeQuickAssistProcessor compQuickAssistProcessor = new CompositeQuickAssistProcessor( + quickAssistProcessors); quickAssistAssistant.setQuickAssistProcessor(compQuickAssistProcessor); - quickAssistAssistant.setRestoreCompletionProposalSize(EditorsPlugin.getDefault().getDialogSettingsSection("quick_assist_proposal_size")); //$NON-NLS-1$ - quickAssistAssistant.setInformationControlCreator(parent -> new DefaultInformationControl(parent, EditorsPlugin.getAdditionalInfoAffordanceString())); + quickAssistAssistant.setRestoreCompletionProposalSize( + EditorsPlugin.getDefault().getDialogSettingsSection("quick_assist_proposal_size")); //$NON-NLS-1$ + quickAssistAssistant.setInformationControlCreator( + parent -> new DefaultInformationControl(parent, EditorsPlugin.getAdditionalInfoAffordanceString())); return quickAssistAssistant; } - @Override public IReconciler getReconciler(ISourceViewer sourceViewer) { + @Override + public IReconciler getReconciler(ISourceViewer sourceViewer) { ReconcilerRegistry registry = GenericEditorPlugin.getDefault().getReconcilerRegistry(); List<IReconciler> reconcilers = registry.getReconcilers(sourceViewer, editor, getContentTypes(sourceViewer)); // Fill with highlight reconcilers - List<IReconciler> highlightReconcilers = registry.getHighlightReconcilers(sourceViewer, editor, getContentTypes(sourceViewer)); + List<IReconciler> highlightReconcilers = registry.getHighlightReconcilers(sourceViewer, editor, + getContentTypes(sourceViewer)); if (!highlightReconcilers.isEmpty()) { reconcilers.addAll(highlightReconcilers); } else { reconcilers.add(new DefaultWordHighlightReconciler()); } // Fill with folding reconcilers - List<IReconciler> foldingReconcilers = registry.getFoldingReconcilers(sourceViewer, editor, getContentTypes(sourceViewer)); + List<IReconciler> foldingReconcilers = registry.getFoldingReconcilers(sourceViewer, editor, + getContentTypes(sourceViewer)); if (!foldingReconcilers.isEmpty()) { reconcilers.addAll(foldingReconcilers); } else { @@ -228,16 +251,19 @@ public final class ExtensionBasedTextViewerConfiguration extends TextSourceViewe return null; } - @Override public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) { + @Override + public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) { AutoEditStrategyRegistry registry = GenericEditorPlugin.getDefault().getAutoEditStrategyRegistry(); - List<IAutoEditStrategy> editStrategies = registry.getAutoEditStrategies(sourceViewer, editor, getContentTypes(sourceViewer)); + List<IAutoEditStrategy> editStrategies = registry.getAutoEditStrategies(sourceViewer, editor, + getContentTypes(sourceViewer)); if (!editStrategies.isEmpty()) { return editStrategies.toArray(new IAutoEditStrategy[editStrategies.size()]); } return super.getAutoEditStrategies(sourceViewer, contentType); } - @Override protected Map<String, IAdaptable> getHyperlinkDetectorTargets(ISourceViewer sourceViewer) { + @Override + protected Map<String, IAdaptable> getHyperlinkDetectorTargets(ISourceViewer sourceViewer) { Map<String, IAdaptable> targets = super.getHyperlinkDetectorTargets(sourceViewer); targets.put(ExtensionBasedTextEditor.GENERIC_EDITOR_ID, editor); return targets; diff --git a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/GenericContentTypeRelatedExtension.java b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/GenericContentTypeRelatedExtension.java index ed8cf24fee5..558655a919a 100644 --- a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/GenericContentTypeRelatedExtension.java +++ b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/GenericContentTypeRelatedExtension.java @@ -18,6 +18,7 @@ import org.eclipse.core.expressions.EvaluationContext; import org.eclipse.core.expressions.EvaluationResult; import org.eclipse.core.expressions.Expression; import org.eclipse.core.expressions.ExpressionConverter; +import org.eclipse.core.expressions.IEvaluationContext; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IStatus; @@ -28,10 +29,12 @@ import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.ui.texteditor.ITextEditor; /** - * This class wraps and proxies an instance of T provided through extensions and loads it lazily when it can contribute to the editor, then delegates all operations to actual instance. + * This class wraps and proxies an instance of T provided through extensions and + * loads it lazily when it can contribute to the editor, then delegates all + * operations to actual instance. * - * @param <T> - * the actual type to proxy, typically the one defined on the extension point. + * @param <T> the actual type to proxy, typically the one defined on the + * extension point. */ public class GenericContentTypeRelatedExtension<T> { private static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$ @@ -45,35 +48,39 @@ public class GenericContentTypeRelatedExtension<T> { public GenericContentTypeRelatedExtension(IConfigurationElement element) throws Exception { this.extension = element; - this.targetContentType = Platform.getContentTypeManager().getContentType(element.getAttribute(CONTENT_TYPE_ATTRIBUTE)); + this.targetContentType = Platform.getContentTypeManager() + .getContentType(element.getAttribute(CONTENT_TYPE_ATTRIBUTE)); this.enabledWhen = buildEnabledWhen(element); } - @SuppressWarnings("unchecked") public T createDelegate() { + @SuppressWarnings("unchecked") + public T createDelegate() { try { return (T) extension.createExecutableExtension(CLASS_ATTRIBUTE); } catch (CoreException e) { - GenericEditorPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, GenericEditorPlugin.BUNDLE_ID, e.getMessage(), e)); + GenericEditorPlugin.getDefault().getLog() + .log(new Status(IStatus.ERROR, GenericEditorPlugin.BUNDLE_ID, e.getMessage(), e)); } return null; } /** - * Returns the expression {@link Expression} declared in the <code>enabledWhen</code> element. + * Returns the expression {@link Expression} declared in the + * <code>enabledWhen</code> element. * - * @param configElement - * the configuration element - * @return the expression {@link Expression} declared in the enabledWhen element. - * @throws CoreException - * when enabledWhen expression is not valid. + * @param configElement the configuration element + * @return the expression {@link Expression} declared in the enabledWhen + * element. + * @throws CoreException when enabledWhen expression is not valid. */ private static Expression buildEnabledWhen(IConfigurationElement configElement) throws CoreException { final IConfigurationElement[] children = configElement.getChildren(ENABLED_WHEN_ATTRIBUTE); if (children.length > 0) { IConfigurationElement[] subChildren = children[0].getChildren(); if (subChildren.length != 1) { - throw new CoreException(new Status(IStatus.ERROR, GenericEditorPlugin.BUNDLE_ID, "One <enabledWhen> element is accepted. Disabling " //$NON-NLS-1$ - + configElement.getAttribute(ID_ATTRIBUTE))); + throw new CoreException(new Status(IStatus.ERROR, GenericEditorPlugin.BUNDLE_ID, + "One <enabledWhen> element is accepted. Disabling " //$NON-NLS-1$ + + configElement.getAttribute(ID_ATTRIBUTE))); } final ElementHandler elementHandler = ElementHandler.getDefault(); final ExpressionConverter converter = ExpressionConverter.getDefault(); @@ -83,13 +90,13 @@ public class GenericContentTypeRelatedExtension<T> { } /** - * Returns true if the given viewer, editor matches the enabledWhen expression and false otherwise. + * Returns true if the given viewer, editor matches the enabledWhen expression + * and false otherwise. * - * @param viewer - * the viewer - * @param editor - * the editor - * @return true if the given viewer, editor matches the enabledWhen expression and false otherwise. + * @param viewer the viewer + * @param editor the editor + * @return true if the given viewer, editor matches the enabledWhen expression + * and false otherwise. */ public boolean matches(ISourceViewer viewer, ITextEditor editor) { if (enabledWhen == null) { @@ -100,15 +107,17 @@ public class GenericContentTypeRelatedExtension<T> { context.addVariable("viewer", viewer); //$NON-NLS-1$ if (viewer.getDocument() != null) { context.addVariable("document", viewer.getDocument()); //$NON-NLS-1$ + } else { + context.addVariable("document", IEvaluationContext.UNDEFINED_VARIABLE); //$NON-NLS-1$ } - if (editor != null) { - context.addVariable("editor", editor); //$NON-NLS-1$ - context.addVariable("editorInput", editor.getEditorInput()); //$NON-NLS-1$ - } + context.addVariable("editor", editor != null ? editor : IEvaluationContext.UNDEFINED_VARIABLE); //$NON-NLS-1$ + context.addVariable("editorInput", //$NON-NLS-1$ + editor != null ? editor.getEditorInput() : IEvaluationContext.UNDEFINED_VARIABLE); try { return enabledWhen.evaluate(context) == EvaluationResult.TRUE; } catch (CoreException e) { - GenericEditorPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, GenericEditorPlugin.BUNDLE_ID, "Error while 'enabledWhen' evaluation", e)); //$NON-NLS-1$ + GenericEditorPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, GenericEditorPlugin.BUNDLE_ID, + "Error while 'enabledWhen' evaluation", e)); //$NON-NLS-1$ return false; } } diff --git a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ReconcilerRegistry.java b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ReconcilerRegistry.java index c5e9bda47da..a8e11b99f46 100644 --- a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ReconcilerRegistry.java +++ b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ReconcilerRegistry.java @@ -54,17 +54,11 @@ public class ReconcilerRegistry { * Creates the registry and binds it to the extension point. */ public ReconcilerRegistry() { - Platform.getExtensionRegistry().addRegistryChangeListener(event -> { - outOfSync = true; - }, EXTENSION_POINT_ID); - - Platform.getExtensionRegistry().addRegistryChangeListener(event -> { - highlightOutOfSync = true; - }, HIGHLIGHT_EXTENSION_POINT_ID); - - Platform.getExtensionRegistry().addRegistryChangeListener(event -> { - foldingOutOfSync = true; - }, FOLDING_EXTENSION_POINT_ID); + Platform.getExtensionRegistry().addRegistryChangeListener(event -> outOfSync = true, EXTENSION_POINT_ID); + Platform.getExtensionRegistry().addRegistryChangeListener(event -> highlightOutOfSync = true, + HIGHLIGHT_EXTENSION_POINT_ID); + Platform.getExtensionRegistry().addRegistryChangeListener(event -> foldingOutOfSync = true, + FOLDING_EXTENSION_POINT_ID); } /** @@ -82,12 +76,12 @@ public class ReconcilerRegistry { if (this.outOfSync) { sync(); } - List<IReconciler> reconcilers = this.extensions.values().stream() - .filter(ext -> contentTypes.contains(ext.targetContentType)) - .filter(ext -> ext.matches(sourceViewer, editor)) - .sorted(new ContentTypeSpecializationComparator<IReconciler>().reversed()) - .map(GenericContentTypeRelatedExtension<IReconciler>::createDelegate).collect(Collectors.toList()); - return reconcilers; + return this.extensions.values().stream() // + .filter(ext -> contentTypes.contains(ext.targetContentType)) // + .filter(ext -> ext.matches(sourceViewer, editor)) // + .sorted(new ContentTypeSpecializationComparator<IReconciler>().reversed()) // + .map(GenericContentTypeRelatedExtension<IReconciler>::createDelegate) // + .collect(Collectors.toList()); } /** @@ -106,12 +100,12 @@ public class ReconcilerRegistry { if (this.highlightOutOfSync) { syncHighlight(); } - List<IReconciler> highlightReconcilers = this.highlightExtensions.values().stream() - .filter(ext -> contentTypes.contains(ext.targetContentType)) - .filter(ext -> ext.matches(sourceViewer, editor)) - .sorted(new ContentTypeSpecializationComparator<IReconciler>().reversed()) - .map(GenericContentTypeRelatedExtension<IReconciler>::createDelegate).collect(Collectors.toList()); - return highlightReconcilers; + return this.highlightExtensions.values().stream() // + .filter(ext -> contentTypes.contains(ext.targetContentType)) // + .filter(ext -> ext.matches(sourceViewer, editor)) // + .sorted(new ContentTypeSpecializationComparator<IReconciler>().reversed()) // + .map(GenericContentTypeRelatedExtension<IReconciler>::createDelegate) // + .collect(Collectors.toList()); } /** @@ -130,12 +124,12 @@ public class ReconcilerRegistry { if (this.foldingOutOfSync) { syncFolding(); } - List<IReconciler> foldingReconcilers = this.foldingExtensions.values().stream() - .filter(ext -> contentTypes.contains(ext.targetContentType)) - .filter(ext -> ext.matches(sourceViewer, editor)) - .sorted(new ContentTypeSpecializationComparator<IReconciler>().reversed()) - .map(GenericContentTypeRelatedExtension<IReconciler>::createDelegate).collect(Collectors.toList()); - return foldingReconcilers; + return this.foldingExtensions.values().stream() // + .filter(ext -> contentTypes.contains(ext.targetContentType)) // + .filter(ext -> ext.matches(sourceViewer, editor)) // + .sorted(new ContentTypeSpecializationComparator<IReconciler>().reversed()) // + .map(GenericContentTypeRelatedExtension<IReconciler>::createDelegate) // + .collect(Collectors.toList()); } private void sync() { @@ -145,7 +139,7 @@ public class ReconcilerRegistry { toRemoveExtensions.remove(extension); if (!this.extensions.containsKey(extension)) { try { - this.extensions.put(extension, new GenericContentTypeRelatedExtension<IReconciler>(extension)); + this.extensions.put(extension, new GenericContentTypeRelatedExtension<>(extension)); } catch (Exception ex) { GenericEditorPlugin.getDefault().getLog() .log(new Status(IStatus.ERROR, GenericEditorPlugin.BUNDLE_ID, ex.getMessage(), ex)); @@ -165,8 +159,7 @@ public class ReconcilerRegistry { toRemoveExtensions.remove(extension); if (!this.highlightExtensions.containsKey(extension)) { try { - this.highlightExtensions.put(extension, - new GenericContentTypeRelatedExtension<IReconciler>(extension)); + this.highlightExtensions.put(extension, new GenericContentTypeRelatedExtension<>(extension)); } catch (Exception ex) { GenericEditorPlugin.getDefault().getLog() .log(new Status(IStatus.ERROR, GenericEditorPlugin.BUNDLE_ID, ex.getMessage(), ex)); @@ -186,8 +179,7 @@ public class ReconcilerRegistry { toRemoveExtensions.remove(extension); if (!this.foldingExtensions.containsKey(extension)) { try { - this.foldingExtensions.put(extension, - new GenericContentTypeRelatedExtension<IReconciler>(extension)); + this.foldingExtensions.put(extension, new GenericContentTypeRelatedExtension<>(extension)); } catch (Exception ex) { GenericEditorPlugin.getDefault().getLog() .log(new Status(IStatus.ERROR, GenericEditorPlugin.BUNDLE_ID, ex.getMessage(), ex)); |