/** * Applies the <code>org.eclipse.ui.ide.editorAssociationOverride</code> extensions to the given * input. * * @param fileName the name of the file for which to choose the editor * @param contentType the content type of the input or <code>null</code> if not available * @param editorDescriptor the current association for the given input or <code>null</code> if * none * @return the editor descriptor to be used for the given input or <code>null</code> if none. * Can be <code>editorDescriptor</code>. * @see IEditorAssociationOverride#overrideDefaultEditor(String, IContentType, * IEditorDescriptor) * @since 3.8 */ private static IEditorDescriptor overrideDefaultEditorAssociation(String fileName, IContentType contentType, IEditorDescriptor editorDescriptor) { IEditorAssociationOverride[] overrides = getEditorAssociationOverrides(); for (int i = 0; i < overrides.length; i++) { editorDescriptor = overrides[i].overrideDefaultEditor(fileName, contentType, editorDescriptor); } return editorDescriptor; }
/** * Applies the <code>org.eclipse.ui.ide.editorAssociationOverride</code> extensions to the given * input. * <p> * <strong>Note:</strong> It is recommended to get the descriptor for the default editor by * calling {@link #getDefaultEditor(IFile, boolean)}. This method here should only be used if * this is not possible for whatever reason. * </p> * * @param editorInput the editor input for the editor * @param contentType the content type of the input or <code>null</code> if not available * @param editorDescriptor the current association for the given input or <code>null</code> if * none * @return the editor descriptor to be used for the given input or <code>null</code> if none. * Can be <code>editorDescriptor</code>. * @see IEditorAssociationOverride#overrideDefaultEditor(IEditorInput, IContentType, * IEditorDescriptor) * @since 3.8 */ public static IEditorDescriptor overrideDefaultEditorAssociation(IEditorInput editorInput, IContentType contentType, IEditorDescriptor editorDescriptor) { IEditorAssociationOverride[] overrides = getEditorAssociationOverrides(); for (int i = 0; i < overrides.length; i++) { editorDescriptor = overrides[i].overrideDefaultEditor(editorInput, contentType, editorDescriptor); } return editorDescriptor; }