This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 208670
Collapse All | Expand All

(-)a/openide.loaders/apichanges.xml (-1 / +2 lines)
Lines 111-117 Link Here
111
  <changes>
111
  <changes>
112
      <change id="DataObjec.Registration">
112
      <change id="DataObjec.Registration">
113
          <api name="loaders"/>
113
          <api name="loaders"/>
114
          <summary>Introduced <code>DataObject.Registration</code></summary>
114
          <summary>Introduced <code>DataObject.Registration</code> and <code>DataObject.Registrations</code></summary>
115
          <version major="7" minor="36"/>
115
          <version major="7" minor="36"/>
116
          <date day="23" month="1" year="2012"/>
116
          <date day="23" month="1" year="2012"/>
117
          <author login="skygo"/>
117
          <author login="skygo"/>
Lines 123-128 Link Here
123
          </description>
123
          </description>
124
          <class package="org.openide.loaders" name="DataObject"/>
124
          <class package="org.openide.loaders" name="DataObject"/>
125
          <issue number="207219"/>
125
          <issue number="207219"/>
126
          <issue number="208670"/>
126
      </change>
127
      </change>
127
      <change id="ToolbarPool.isFinished">
128
      <change id="ToolbarPool.isFinished">
128
          <api name="awt"/>
129
          <api name="awt"/>
(-)a/openide.loaders/src/org/netbeans/modules/openide/loaders/DataObjectFactoryProcessor.java (-92 / +97 lines)
Lines 68-183 Link Here
68
 */
68
 */
69
@ServiceProvider(service = Processor.class)
69
@ServiceProvider(service = Processor.class)
70
@SupportedSourceVersion(SourceVersion.RELEASE_6)
70
@SupportedSourceVersion(SourceVersion.RELEASE_6)
71
@SupportedAnnotationTypes("org.openide.loaders.DataObject.Registration")
71
@SupportedAnnotationTypes({"org.openide.loaders.DataObject.Registration", "org.openide.loaders.DataObject.Registrations"})
72
public class DataObjectFactoryProcessor extends LayerGeneratingProcessor {
72
public class DataObjectFactoryProcessor extends LayerGeneratingProcessor {
73
73
    @Override
74
    @Override
74
    protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
75
    protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
75
        if (roundEnv.processingOver()) {
76
        if (roundEnv.processingOver()) {
76
            return false;
77
            return false;
77
        }
78
        }
78
        TypeMirror dataObjectType = type(DataObject.class);
79
        TypeMirror fileObjectType = type(FileObject.class);
80
        TypeMirror multiFileLoaderType = type(MultiFileLoader.class);
81
        TypeMirror dataObjectFactoryType = type(DataObject.Factory.class);
82
83
79
84
        for (Element e : roundEnv.getElementsAnnotatedWith(DataObject.Registration.class)) {
80
        for (Element e : roundEnv.getElementsAnnotatedWith(DataObject.Registration.class)) {
85
            DataObject.Registration dfr = e.getAnnotation(DataObject.Registration.class);
81
            DataObject.Registration dfr = e.getAnnotation(DataObject.Registration.class);
86
            if (dfr == null) {
82
            if (dfr == null) {
87
                continue;
83
                continue;
88
            }
84
            }
89
            LayerBuilder builder = layer(e);
85
            process(e, dfr);
90
            //need class name to generate id and factory dataObjectClass parameter
86
        }
91
            String className = processingEnv.getElementUtils().getBinaryName((TypeElement)e).toString();
87
        for (Element e : roundEnv.getElementsAnnotatedWith(DataObject.Registrations.class)) {
92
            String factoryId = className.replace(".", "-");
88
            DataObject.Registrations dfrr = e.getAnnotation(DataObject.Registrations.class);
93
89
            if (dfrr == null) {
94
            boolean useFactory = true;
90
                continue;
95
96
            // test if enclosing element is of DataObject type;
97
98
            if (isAssignable(e.asType(), dataObjectType)) {
99
                //attempt to use default factory 
100
                List<Element> ee = new LinkedList<Element>();
101
                // should be a public constructor with FileObject and MultiFileLoader as param
102
                for (ExecutableElement element : ElementFilter.constructorsIn(e.getEnclosedElements())) {
103
104
                    if ((element.getKind() == ElementKind.CONSTRUCTOR) && (element.getModifiers().contains(Modifier.PUBLIC))) {  // found a public constructor ;                        
105
                        if ((element.getParameters().size() == 2) // parameters of constructor ok
106
                                && (isAssignable(element.getParameters().get(0).asType(), fileObjectType))
107
                                && (isAssignable(element.getParameters().get(1).asType(), multiFileLoaderType))) {
108
                            ee.add(element);
109
                        }
110
                    }
111
                }
112
                // nothing is found 
113
                if (ee.isEmpty()) {
114
                    throw new LayerGenerationException("DataObject subclass with @DataObject.Registration needs a public constructor with FileObject and MultiFileLoader parameters", e, processingEnv, dfr); // NOI18N
115
                } else {
116
                    useFactory = true;
117
                }
118
119
            } else if (isAssignable(e.asType(), dataObjectFactoryType)) {
120
                List<Element> ee = new LinkedList<Element>();
121
                for (ExecutableElement element : ElementFilter.constructorsIn(e.getEnclosedElements())) {
122
                    if ((element.getKind() == ElementKind.CONSTRUCTOR) && (element.getModifiers().contains(Modifier.PUBLIC))) {  // found a public constructor ;                        
123
                        if ((element.getParameters().isEmpty())) {// parameters of constructor ok
124
                            ee.add(element);
125
                        }
126
                    }
127
                }
128
                if (ee.isEmpty()) {
129
                    throw new LayerGenerationException("DataObject.Factory subclass with @DataObject.Registration needs a public default constructor", e, processingEnv, dfr); // NOI18N
130
                } else {
131
                    useFactory = false;
132
                    factoryId = className.replace(".class", "").replace(".", "-");
133
                }
134
            } else {
135
                throw new LayerGenerationException("Usage @DataObject.Registration only on DataObject.Factory subclass or DataObject subclass", e, processingEnv, dfr); // NOI18N
136
            }
91
            }
137
92
            for (DataObject.Registration t : dfrr.value()) {
138
            // check if mimeType annotation is set
93
                process(e, t);
139
            if (dfr.mimeType().length == 0) {
140
                throw new LayerGenerationException("@DataObject.Factory.Registration mimeTypes() cannot be null", e, processingEnv, dfr, "mimeTypes");
141
            }
94
            }
142
            // verify if all mimeType are valid
143
            for (String aMimeType : dfr.mimeType()) {
144
                if (aMimeType.isEmpty()) {
145
                    throw new LayerGenerationException("@DataObject.Factory.Registration mimeTypes() cannot have a empty mimeType", e, processingEnv, dfr, "mimeTypes");
146
                }
147
            }
148
149
150
            for (String aMimeType : dfr.mimeType()) {
151
                LayerBuilder.File f = builder.file("Loaders/" + aMimeType + "/Factories/" + factoryId + ".instance");
152
153
                // iconBase is optional but if set then shoud be in classpath
154
                if (dfr.iconBase().length() > 0) {
155
                    builder.validateResource(dfr.iconBase(), e.getEnclosingElement(), dfr, "icon", true);
156
                    f.stringvalue("iconBase", dfr.iconBase());
157
                }
158
                // position LayerBuilder 
159
                f.position(dfr.position());
160
161
                if (!dfr.displayName().isEmpty()) {
162
                    f.bundlevalue("displayName", dfr.displayName(), dfr, "displayName");
163
                }
164
165
                if (useFactory) {
166
                    f.methodvalue("instanceCreate", "org.openide.loaders.DataLoaderPool", "factory");
167
                    f.stringvalue("dataObjectClass", className);
168
                    // if factory mimetype is needed otherwise not
169
                    f.stringvalue("mimeType", aMimeType);
170
171
                }
172
                f.write();
173
            }
174
175
        }
95
        }
176
177
        return true;
96
        return true;
178
    }
97
    }
179
98
180
    // reuse from Action Processor
99
    //
100
    private void process(Element e, DataObject.Registration dfr) throws LayerGenerationException {
101
        TypeMirror dataObjectType = type(DataObject.class);
102
        TypeMirror fileObjectType = type(FileObject.class);
103
        TypeMirror multiFileLoaderType = type(MultiFileLoader.class);
104
        TypeMirror dataObjectFactoryType = type(DataObject.Factory.class);
105
        LayerBuilder builder = layer(e);
106
        //need class name to generate id and factory dataObjectClass parameter
107
        String className = processingEnv.getElementUtils().getBinaryName((TypeElement) e).toString();
108
        String factoryId = className.replace(".", "-");
109
110
        boolean useFactory = true;
111
112
        // test if enclosing element is of DataObject type;
113
114
        if (isAssignable(e.asType(), dataObjectType)) {
115
            //attempt to use default factory 
116
            List<Element> ee = new LinkedList<Element>();
117
            // should be a public constructor with FileObject and MultiFileLoader as param
118
            for (ExecutableElement element : ElementFilter.constructorsIn(e.getEnclosedElements())) {
119
120
                if ((element.getKind() == ElementKind.CONSTRUCTOR) && (element.getModifiers().contains(Modifier.PUBLIC))) {  // found a public constructor ;                        
121
                    if ((element.getParameters().size() == 2) // parameters of constructor ok
122
                            && (isAssignable(element.getParameters().get(0).asType(), fileObjectType))
123
                            && (isAssignable(element.getParameters().get(1).asType(), multiFileLoaderType))) {
124
                        ee.add(element);
125
                    }
126
                }
127
            }
128
            // nothing is found 
129
            if (ee.isEmpty()) {
130
                throw new LayerGenerationException("DataObject subclass with @DataObject.Registration needs a public constructor with FileObject and MultiFileLoader parameters", e, processingEnv, dfr); // NOI18N
131
            } else {
132
                useFactory = true;
133
            }
134
135
        } else if (isAssignable(e.asType(), dataObjectFactoryType)) {
136
            List<Element> ee = new LinkedList<Element>();
137
            for (ExecutableElement element : ElementFilter.constructorsIn(e.getEnclosedElements())) {
138
                if ((element.getKind() == ElementKind.CONSTRUCTOR) && (element.getModifiers().contains(Modifier.PUBLIC))) {  // found a public constructor ;                        
139
                    if ((element.getParameters().isEmpty())) {// parameters of constructor ok
140
                        ee.add(element);
141
                    }
142
                }
143
            }
144
            if (ee.isEmpty()) {
145
                throw new LayerGenerationException("DataObject.Factory subclass with @DataObject.Registration needs a public default constructor", e, processingEnv, dfr); // NOI18N
146
            } else {
147
                useFactory = false;
148
                factoryId = className.replace(".class", "").replace(".", "-");
149
            }
150
        } else {
151
            throw new LayerGenerationException("Usage @DataObject.Registration only on DataObject.Factory subclass or DataObject subclass", e, processingEnv, dfr); // NOI18N
152
        }
153
154
        // check if mimeType annotation is set
155
        if (dfr.mimeType() == null) {
156
            throw new LayerGenerationException("@DataObject.Factory.Registration mimeType() cannot be null", e, processingEnv, dfr, "mimeTypes");
157
        }
158
        // verify if all mimeType are valid
159
160
        String aMimeType = dfr.mimeType();
161
        LayerBuilder.File f = builder.file("Loaders/" + aMimeType + "/Factories/" + factoryId + ".instance");
162
163
        // iconBase is optional but if set then shoud be in classpath
164
        if (dfr.iconBase().length() > 0) {
165
            builder.validateResource(dfr.iconBase(), e.getEnclosingElement(), dfr, "icon", true);
166
            f.stringvalue("iconBase", dfr.iconBase());
167
        }
168
169
        // position LayerBuilder 
170
        f.position(dfr.position());
171
172
        if (!dfr.displayName().isEmpty()) {
173
            f.bundlevalue("displayName", dfr.displayName(), dfr, "displayName");
174
        }
175
176
        if (useFactory) {
177
            f.methodvalue("instanceCreate", "org.openide.loaders.DataLoaderPool", "factory");
178
            f.stringvalue("dataObjectClass", className);
179
            // if factory mimetype is needed otherwise not
180
            f.stringvalue("mimeType", aMimeType);
181
        }
182
        f.write();
183
184
    }
185
// reuse from Action Processor
181
    private TypeMirror type(Class<?> type) {
186
    private TypeMirror type(Class<?> type) {
182
        final TypeElement e = processingEnv.getElementUtils().getTypeElement(type.getCanonicalName());
187
        final TypeElement e = processingEnv.getElementUtils().getTypeElement(type.getCanonicalName());
183
        return e == null ? null : e.asType();
188
        return e == null ? null : e.asType();
(-)a/openide.loaders/src/org/openide/loaders/DataObject.java (-1 / +13 lines)
Lines 1185-1191 Link Here
1185
         * {@link MIMEResolver.ExtensionRegistration} and co. to assign
1185
         * {@link MIMEResolver.ExtensionRegistration} and co. to assign
1186
         * a mime types to {@link FileObject files} in the system.
1186
         * a mime types to {@link FileObject files} in the system.
1187
         */
1187
         */
1188
        String[] mimeType();
1188
        String mimeType();
1189
1189
1190
        /**
1190
        /**
1191
         * Display name for the file type created by this registration.
1191
         * Display name for the file type created by this registration.
Lines 1206-1211 Link Here
1206
        int position() default Integer.MAX_VALUE;
1206
        int position() default Integer.MAX_VALUE;
1207
    }
1207
    }
1208
    
1208
    
1209
     /**
1210
     * May be uses to allow multiple {@link DataObject.Registration DataObject.Registration} at one place.
1211
     * @since 7.36
1212
     */
1213
    @Retention(RetentionPolicy.SOURCE)
1214
    @Target({ElementType.TYPE})
1215
    public static @interface Registrations {
1216
        
1217
        Registration[] value();
1218
    }
1219
    
1220
    
1209
    /** Registry of modified data objects.
1221
    /** Registry of modified data objects.
1210
     * The registry permits attaching of a change listener
1222
     * The registry permits attaching of a change listener
1211
    * to be informed when the count of modified objects changes.
1223
    * to be informed when the count of modified objects changes.
(-)a/openide.loaders/test/unit/src/org/netbeans/modules/openide/loaders/DataObjectFactoryProcessorTest.java (-27 / +9 lines)
Lines 45-53 Link Here
45
import java.io.ByteArrayOutputStream;
45
import java.io.ByteArrayOutputStream;
46
import java.io.IOException;
46
import java.io.IOException;
47
import java.io.OutputStream;
47
import java.io.OutputStream;
48
import java.io.PrintStream;
49
import org.netbeans.junit.NbTestCase;
48
import org.netbeans.junit.NbTestCase;
50
import org.netbeans.modules.openide.loaders.data.DoFPDataObject;
49
import org.netbeans.modules.openide.loaders.data.DoFPDataObject;
50
import org.netbeans.modules.openide.loaders.data.DoFPDataObjectMultiple;
51
import org.openide.filesystems.FileLock;
51
import org.openide.filesystems.FileLock;
52
import org.openide.filesystems.FileObject;
52
import org.openide.filesystems.FileObject;
53
import org.openide.filesystems.FileUtil;
53
import org.openide.filesystems.FileUtil;
Lines 78-84 Link Here
78
    @Override
78
    @Override
79
    protected void setUp() throws Exception {
79
    protected void setUp() throws Exception {
80
        super.setUp();
80
        super.setUp();
81
        createMIMEs();
82
    }
81
    }
83
82
84
// Several test for javac
83
// Several test for javac
Lines 209-216 Link Here
209
            assertEquals("Icon found", "org/openide/loaders/unknown.gif", icon);
208
            assertEquals("Icon found", "org/openide/loaders/unknown.gif", icon);
210
            assertEquals("DataObjectClass found", DoFPDataObject.class.getName(), fo.getAttribute("dataObjectClass"));
209
            assertEquals("DataObjectClass found", DoFPDataObject.class.getName(), fo.getAttribute("dataObjectClass"));
211
210
212
        }
211
        }        
213
214
    }
212
    }
215
213
216
// use external DoFP* class and their registration to test if dataobject return is good
214
// use external DoFP* class and their registration to test if dataobject return is good
Lines 223-257 Link Here
223
            assertEquals("DataLoader type", DoFPDataObject.class, find.getClass());
221
            assertEquals("DataLoader type", DoFPDataObject.class, find.getClass());
224
        }
222
        }
225
        {
223
        {
226
            FileObject fo = createXmlFile("sdfsdf", ".tt2");
227
            assertEquals("text/test2", fo.getMIMEType());
228
            DataObject find = DataObject.find(fo);
229
            assertEquals("DataLoader type", DoFPDataObject.class, find.getClass());
230
        }
231
        {
232
            FileObject fo = createXmlFile("sdfsdf", ".tt3");
224
            FileObject fo = createXmlFile("sdfsdf", ".tt3");
233
            assertEquals("text/test3", fo.getMIMEType());
225
            assertEquals("text/test3", fo.getMIMEType());
234
            // XXX DoFPCustomLoader not loaded cannot assert for loader
226
            // XXX DoFPCustomLoader not loaded cannot assert for loader
235
        }
227
        }
228
        {
229
            FileObject fo = createXmlFile("sdfsdf", ".ttm2");
230
            assertEquals("text/testm2", fo.getMIMEType());
231
            DataObject find = DataObject.find(fo);
232
            assertEquals("DataLoader type", DoFPDataObjectMultiple.class, find.getClass());
233
        }
236
    }
234
    }
237
235
238
    // utility method inspired by FsMimeResolverTest
236
   
239
    private void createMIMEs() throws Exception {
240
// create  resolver to get tt1 extension resolve as test/test1 and do so for 3 different
241
        FileObject resolver = FileUtil.createData(FileUtil.getConfigRoot(), "Services/MIMEResolver/resolver.xml");
242
        OutputStream os = resolver.getOutputStream();
243
        PrintStream ps = new PrintStream(os);
244
        ps.println("<!DOCTYPE MIME-resolver PUBLIC '-//NetBeans//DTD MIME Resolver 1.0//EN' 'http://www.netbeans.org/dtds/mime-resolver-1_0.dtd'>");
245
        ps.println("<MIME-resolver>");
246
        for (int i = 1; i < 4; i++) {
247
            ps.println(" <file>");
248
            ps.println("  <ext name=\"tt" + i + "\"/>");
249
            ps.println("    <resolver mime=\"text/test" + i + "\"/>");
250
            ps.println(" </file>");
251
        }
252
        ps.println("</MIME-resolver>");
253
        os.close();
254
    }
255
237
256
    private FileObject createXmlFile(String content, String ext) throws Exception {
238
    private FileObject createXmlFile(String content, String ext) throws Exception {
257
        FileObject file = FileUtil.createMemoryFileSystem().getRoot().createData("file" + ext);
239
        FileObject file = FileUtil.createMemoryFileSystem().getRoot().createData("file" + ext);
(-)a/openide.loaders/test/unit/src/org/netbeans/modules/openide/loaders/data/DoFPDataObject.java (-1 / +1 lines)
Lines 53-59 Link Here
53
 * @see DataObjectFactoryProcessorTest
53
 * @see DataObjectFactoryProcessorTest
54
 * @author Eric Barboni <skygo@netbeans.org>
54
 * @author Eric Barboni <skygo@netbeans.org>
55
 */
55
 */
56
@DataObject.Registration(mimeType =  {"text/test1","text/test2"}, displayName = "labeltest", position = 3565, iconBase = "org/openide/loaders/unknown.gif")
56
@DataObject.Registration(mimeType =  "text/test1", displayName = "labeltest", position = 3565, iconBase = "org/openide/loaders/unknown.gif")
57
public class DoFPDataObject extends DataObject {
57
public class DoFPDataObject extends DataObject {
58
58
59
    public DoFPDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException {
59
    public DoFPDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException {
(-)a/openide.loaders/test/unit/src/org/netbeans/modules/openide/loaders/data/DoFPDataObjectMultiple.java (+114 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.openide.loaders.data;
43
44
import java.io.IOException;
45
import org.openide.filesystems.FileObject;
46
import org.openide.loaders.DataFolder;
47
import org.openide.loaders.DataObject;
48
import org.openide.loaders.DataObjectExistsException;
49
import org.openide.loaders.MultiFileLoader;
50
import org.openide.util.HelpCtx;
51
52
/**
53
 * @see DataObjectFactoryProcessorTest
54
 * @author Eric Barboni <skygo@netbeans.org>
55
 */
56
@DataObject.Registrations({
57
    @DataObject.Registration(mimeType = "text/testm1", displayName = "labeltest", position = 3565, iconBase = "org/openide/loaders/unknown.gif"),
58
    @DataObject.Registration(mimeType = "text/testm2", displayName = "labeltestm1", position = 4050, iconBase = "org/openide/loaders/unknown.gif")})
59
public class DoFPDataObjectMultiple extends DataObject {
60
61
    public DoFPDataObjectMultiple(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException {
62
        super(pf, loader);
63
    }
64
65
    @Override
66
    public boolean isDeleteAllowed() {
67
        throw new UnsupportedOperationException("Not supported yet.");
68
    }
69
70
    @Override
71
    public boolean isCopyAllowed() {
72
        throw new UnsupportedOperationException("Not supported yet.");
73
    }
74
75
    @Override
76
    public boolean isMoveAllowed() {
77
        throw new UnsupportedOperationException("Not supported yet.");
78
    }
79
80
    @Override
81
    public boolean isRenameAllowed() {
82
        throw new UnsupportedOperationException("Not supported yet.");
83
    }
84
85
    @Override
86
    public HelpCtx getHelpCtx() {
87
        throw new UnsupportedOperationException("Not supported yet.");
88
    }
89
90
    @Override
91
    protected DataObject handleCopy(DataFolder f) throws IOException {
92
        throw new UnsupportedOperationException("Not supported yet.");
93
    }
94
95
    @Override
96
    protected void handleDelete() throws IOException {
97
        throw new UnsupportedOperationException("Not supported yet.");
98
    }
99
100
    @Override
101
    protected FileObject handleRename(String name) throws IOException {
102
        throw new UnsupportedOperationException("Not supported yet.");
103
    }
104
105
    @Override
106
    protected FileObject handleMove(DataFolder df) throws IOException {
107
        throw new UnsupportedOperationException("Not supported yet.");
108
    }
109
110
    @Override
111
    protected DataObject handleCreateFromTemplate(DataFolder df, String name) throws IOException {
112
        throw new UnsupportedOperationException("Not supported yet.");
113
    }
114
}
(-)a/openide.loaders/test/unit/src/org/netbeans/modules/openide/loaders/data/DoFPMIMEType.java (+67 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.openide.loaders.data;
43
44
import org.openide.filesystems.MIMEResolver;
45
46
/**
47
 *
48
 * @author Eric Barboni <skygo@netbeans.org>
49
 */
50
public class DoFPMIMEType {
51
52
    @MIMEResolver.ExtensionRegistration(displayName = "tt1", extension = "tt1", mimeType = "text/test1",position=1000)
53
    public void tt1() {
54
    }
55
56
    @MIMEResolver.ExtensionRegistration(displayName = "tt3", extension = "tt3", mimeType = "text/test3",position=1002)
57
    public void tt3() {
58
    }
59
60
    @MIMEResolver.ExtensionRegistration(displayName = "ttm1", extension = "ttm1", mimeType = "text/testm1",position=1003)
61
    public void ttm1() {
62
    }
63
64
    @MIMEResolver.ExtensionRegistration(displayName = "ttm2", extension = "ttm2", mimeType = "text/testm2",position=1004)
65
    public void ttm2() {
66
    }
67
}

Return to bug 208670