KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > runtime > content > IContentTypeSettings


1 /*******************************************************************************
2  * Copyright (c) 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.core.runtime.content;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.core.runtime.preferences.IScopeContext;
15
16 /**
17  * Gives access to the user settings for a content type.
18  * <p>
19  * This interface is not intended to be implemented by clients.
20  * </p>
21  *
22  * @see IContentType
23  * @see IContentType#getSettings(IScopeContext)
24  * @since 3.1
25  */

26 public interface IContentTypeSettings {
27     /**
28      * File spec type constant, indicating a file extension specification.
29      */

30     public static final int FILE_EXTENSION_SPEC = 0x08;
31     /**
32      * File spec type constant, indicating a file name specification.
33      */

34     public static final int FILE_NAME_SPEC = 0x04;
35
36     /**
37      * Adds a user-defined file specification to the corresponding content type. Has no
38      * effect if the given file specification is already defined.
39      *
40      * @param fileSpec the file specification
41      * @param type the type of the file specification. One of
42      * <code>FILE_NAME_SPEC</code>,
43      * <code>FILE_EXTENSION_SPEC</code>.
44      * @throws IllegalArgumentException if the type bit mask is
45      * incorrect
46      * @throws CoreException if this method fails. Reasons include:
47      * <ul>
48      * <li> An error occurred persisting this setting.</li>
49      * </ul>
50      * @see #FILE_NAME_SPEC
51      * @see #FILE_EXTENSION_SPEC
52      */

53     public void addFileSpec(String JavaDoc fileSpec, int type) throws CoreException;
54
55     /**
56      * Returns the default charset for the corresponding content type if
57      * it has been set, or
58      * <code>null</code> otherwise.
59      *
60      * @return the default charset, or <code>null</code>
61      */

62     public String JavaDoc getDefaultCharset();
63
64     /**
65      * Returns the file specifications for the corresponding content type. The type mask
66      * is a bit-wise or of file specification type constants indicating the
67      * file specification types of interest.
68      *
69      * @param type a bit-wise or of file specification type constants. Valid
70      * flags are one of <code>FILE_EXTENSION_SPEC</code> or
71      *<code>FILE_NAME_SPEC</code>
72      * @return the file specification
73      * @see #FILE_NAME_SPEC
74      * @see #FILE_EXTENSION_SPEC
75      */

76     public String JavaDoc[] getFileSpecs(int type);
77
78     /**
79      * Returns the corresponding content type's unique identifier. Each content
80      * type has an identifier by which they can be retrieved from the content
81      * type catalog.
82      *
83      * @return the content type unique identifier
84      */

85     public String JavaDoc getId();
86
87     /**
88      * Removes a user-defined file specification from the corresponding content type. Has no
89      * effect if the given file specification was not defined by the user.
90      *
91      * @param fileSpec the file specification
92      * @param type the type of the file specification. One of
93      * <code>FILE_NAME_SPEC</code>,
94      * <code>FILE_EXTENSION_SPEC</code>.
95      * @throws IllegalArgumentException if the type bit mask is
96      * incorrect
97      * @throws CoreException if this method fails. Reasons include:
98      * <ul>
99      * <li> An error occurred persisting this setting.</li>
100      * </ul>
101      * @see #FILE_NAME_SPEC
102      * @see #FILE_EXTENSION_SPEC
103      */

104     public void removeFileSpec(String JavaDoc fileSpec, int type) throws CoreException;
105
106     /**
107      * Sets the default charset for the corresponding content type. If
108      * <code>null</code> is provided, restores the pre-defined default charset.
109      *
110      * @param userCharset the new charset for the content type, or
111      * <code>null</code>
112      * @throws CoreException if this method fails. Reasons include:
113      * <ul>
114      * <li> An error occurred persisting this setting.</li>
115      * </ul>
116      */

117     public void setDefaultCharset(String JavaDoc userCharset) throws CoreException;
118 }
119
Popular Tags