Index: src/org/eclipse/core/internal/content/ContentTypeManager.java =================================================================== RCS file: /home/eclipse/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeManager.java,v retrieving revision 1.31 diff -u -r1.31 ContentTypeManager.java --- src/org/eclipse/core/internal/content/ContentTypeManager.java 16 Jun 2004 23:33:55 -0000 1.31 +++ src/org/eclipse/core/internal/content/ContentTypeManager.java 18 Jun 2004 19:27:31 -0000 @@ -368,4 +368,20 @@ builder.startup(); builder.buildContentTypes(); } + + /* (non-Javadoc) + * @see IContentTypeManager#addContentTypeChangeListener(IContentTypeChangeListener) + */ + public void addContentTypeChangeListener(IContentTypeChangeListener listener) { + // TODO https://bugs.eclipse.org/bugs/show_bug.cgi?id=67884 + // Content type change events not reported + } + + /* (non-Javadoc) + * @see IContentTypeManager#removeContentTypeChangeListener(IContentTypeChangeListener) + */ + public void removeContentTypeChangeListener(IContentTypeChangeListener listener) { + // TODO https://bugs.eclipse.org/bugs/show_bug.cgi?id=67884 + // Content type change events not reported + } } Index: src/org/eclipse/core/runtime/content/IContentTypeManager.java =================================================================== RCS file: /home/eclipse/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/IContentTypeManager.java,v retrieving revision 1.14 diff -u -r1.14 IContentTypeManager.java --- src/org/eclipse/core/runtime/content/IContentTypeManager.java 3 Jun 2004 14:25:14 -0000 1.14 +++ src/org/eclipse/core/runtime/content/IContentTypeManager.java 18 Jun 2004 19:27:31 -0000 @@ -41,6 +41,17 @@ public final static String CT_TEXT = "org.eclipse.core.runtime.text"; //$NON-NLS-1$ /** + * Register the given listener for notification of content type changes. + * Calling this method multiple times with the same listener has no effect. The + * given listener argument must not be null. + * + * @param listener the content type change listener to register + * @see #removeContentTypeChangeListener(IContentTypeChangeListener) + * @see IContentTypeChangeListener + */ + public void addContentTypeChangeListener(IContentTypeChangeListener listener); + + /** * Returns the preferred content type for the given contents and file name. *

* Returns null if no associated content types are @@ -172,4 +183,15 @@ * @see IContentDescription */ public IContentDescription getDescriptionFor(Reader contents, String fileName, QualifiedName[] options) throws IOException; + + /** + * De-register the given listener from receiving notification of content type changes. + * Calling this method multiple times with the same listener has no + * effect. The given listener argument must not be null. + * + * @param listener the content type change listener to remove + * @see #addContentTypeChangeListener(IContentTypeChangeListener) + * @see IContentTypeChangeListener + */ + public void removeContentTypeChangeListener(IContentTypeChangeListener listener); } Index: src/org/eclipse/core/runtime/content/IContentTypeChangeListener.java =================================================================== RCS file: src/org/eclipse/core/runtime/content/IContentTypeChangeListener.java diff -N src/org/eclipse/core/runtime/content/IContentTypeChangeListener.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/core/runtime/content/IContentTypeChangeListener.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.core.runtime.content; + +import java.util.EventObject; + +/** + * A listener to be used to receive content type change events. + *

+ * Clients may implement this interface. + *

+ * + * @since 3.0 + */ +public interface IContentTypeChangeListener { + + /** + * An event object which describes the details of a change to a + * content type. + *

+ * Types of changes include a change in the file associations or + * a change in the encoding setting. + *

+ * + * @since 3.0 + */ + public final class ContentTypeChangeEvent extends EventObject { + + /** + * Constructor for a new content type change event. + * + * @param source the content type that changed + */ + public ContentTypeChangeEvent(IContentType source) { + super(source); + } + + /** + * Return the content type object associated with this change event. + * + * @return the content type + */ + public IContentType getContentType() { + return (IContentType) source; + } + } + + /** + * Notification that a content type has changed in the content type manager. + * The given event object contains the content type which changed and must not + * be null. + * + * @param event the content type change event + */ + public void contentTypeChanged(ContentTypeChangeEvent event); + +}