Adjusting to recent changes w.r.t. Util.allMimeTypes
authorJan Lahoda <jlahoda@netbeans.org>
Mon, 26 Dec 2011 15:34:00 +0100
changeset 718dc6026f33021
parent 717 70ec814048a5
child 719 2b14a9a42066
Adjusting to recent changes w.r.t. Util.allMimeTypes
remoting/server/indexer/usages/test/unit/src/org/netbeans/modules/jackpot30/indexer/usages/IndexerImplTest.java
remoting/server/indexer/usages/test/unit/src/org/netbeans/modules/parsing/impl/indexing/MimeTypes.java
     1.1 --- a/remoting/server/indexer/usages/test/unit/src/org/netbeans/modules/jackpot30/indexer/usages/IndexerImplTest.java	Sat Dec 17 12:14:20 2011 +0100
     1.2 +++ b/remoting/server/indexer/usages/test/unit/src/org/netbeans/modules/jackpot30/indexer/usages/IndexerImplTest.java	Mon Dec 26 15:34:00 2011 +0100
     1.3 @@ -45,6 +45,7 @@
     1.4  import java.io.IOException;
     1.5  import java.io.OutputStream;
     1.6  import java.util.HashSet;
     1.7 +import java.util.Set;
     1.8  import javax.lang.model.element.ExecutableElement;
     1.9  import javax.lang.model.util.ElementFilter;
    1.10  import org.netbeans.api.editor.mimelookup.MimePath;
    1.11 @@ -56,7 +57,7 @@
    1.12  import org.netbeans.modules.java.source.parsing.JavacParser;
    1.13  import org.netbeans.modules.java.source.parsing.JavacParserFactory;
    1.14  import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
    1.15 -import org.netbeans.modules.parsing.impl.indexing.Util;
    1.16 +import org.netbeans.modules.parsing.impl.indexing.MimeTypes;
    1.17  import org.netbeans.spi.editor.mimelookup.MimeDataProvider;
    1.18  import org.openide.filesystems.FileObject;
    1.19  import org.openide.filesystems.FileUtil;
    1.20 @@ -77,13 +78,16 @@
    1.21  
    1.22      @Override
    1.23      protected void setUp() throws Exception {
    1.24 -        if (Util.allMimeTypes == null) {
    1.25 -            Util.allMimeTypes = new HashSet<String>();
    1.26 +        Set<String> mimeTypes = MimeTypes.getAllMimeTypes();
    1.27 +        if (mimeTypes == null) {
    1.28 +            mimeTypes = new HashSet<String>();
    1.29          } else {
    1.30 -            Util.allMimeTypes = new HashSet<String>(Util.allMimeTypes);
    1.31 +            mimeTypes = new HashSet<String>(mimeTypes);
    1.32          }
    1.33  
    1.34 -        Util.allMimeTypes.add("text/x-java");
    1.35 +        mimeTypes.add("text/x-java");
    1.36 +        MimeTypes.setAllMimeTypes(mimeTypes);
    1.37 +        
    1.38          org.netbeans.api.project.ui.OpenProjects.getDefault().getOpenProjects();
    1.39          clearWorkDir();
    1.40          CacheFolder.setCacheFolder(FileUtil.toFileObject(getWorkDir()));
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/remoting/server/indexer/usages/test/unit/src/org/netbeans/modules/parsing/impl/indexing/MimeTypes.java	Mon Dec 26 15:34:00 2011 +0100
     2.3 @@ -0,0 +1,66 @@
     2.4 +/*
     2.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     2.6 + *
     2.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
     2.8 + *
     2.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    2.10 + * Other names may be trademarks of their respective owners.
    2.11 + *
    2.12 + * The contents of this file are subject to the terms of either the GNU
    2.13 + * General Public License Version 2 only ("GPL") or the Common
    2.14 + * Development and Distribution License("CDDL") (collectively, the
    2.15 + * "License"). You may not use this file except in compliance with the
    2.16 + * License. You can obtain a copy of the License at
    2.17 + * http://www.netbeans.org/cddl-gplv2.html
    2.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    2.19 + * specific language governing permissions and limitations under the
    2.20 + * License.  When distributing the software, include this License Header
    2.21 + * Notice in each file and include the License file at
    2.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    2.23 + * particular file as subject to the "Classpath" exception as provided
    2.24 + * by Oracle in the GPL Version 2 section of the License file that
    2.25 + * accompanied this code. If applicable, add the following below the
    2.26 + * License Header, with the fields enclosed by brackets [] replaced by
    2.27 + * your own identifying information:
    2.28 + * "Portions Copyrighted [year] [name of copyright owner]"
    2.29 + *
    2.30 + * If you wish your version of this file to be governed by only the CDDL
    2.31 + * or only the GPL Version 2, indicate your decision by adding
    2.32 + * "[Contributor] elects to include this software in this distribution
    2.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    2.34 + * single choice of license, a recipient has the option to distribute
    2.35 + * your version of this file under either the CDDL, the GPL Version 2 or
    2.36 + * to extend the choice of license to its licensees as provided above.
    2.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    2.38 + * Version 2 license, then the option applies only if the new code is
    2.39 + * made subject to such option by the copyright holder.
    2.40 + *
    2.41 + * Contributor(s):
    2.42 + *
    2.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
    2.44 + */
    2.45 +package org.netbeans.modules.parsing.impl.indexing;
    2.46 +
    2.47 +import java.util.Set;
    2.48 +import org.netbeans.api.annotations.common.CheckForNull;
    2.49 +import org.netbeans.api.annotations.common.NonNull;
    2.50 +import org.openide.util.Parameters;
    2.51 +
    2.52 +/**
    2.53 + *
    2.54 + * @author Tomas Zezula
    2.55 + */
    2.56 +public class MimeTypes {
    2.57 +
    2.58 +    private MimeTypes() {}
    2.59 +
    2.60 +    public static void setAllMimeTypes(@NonNull final Set<String> allMimeTypes) {
    2.61 +        Parameters.notNull("allMimeTypes", allMimeTypes);   //NOI18N
    2.62 +        Util.allMimeTypes = allMimeTypes;
    2.63 +    }
    2.64 +
    2.65 +    @CheckForNull
    2.66 +    public static Set<String> getAllMimeTypes() {
    2.67 +        return Util.allMimeTypes;
    2.68 +    }
    2.69 +}