Removing forgotten layer registration and a hint that should have also been removed already.
authorJan Lahoda <jlahoda@netbeans.org>
Thu, 17 Nov 2011 16:40:46 +0100
changeset 1768170f8b2168cd4
parent 17680 e83c215c8aa3
child 17684 5ff58e374e5e
Removing forgotten layer registration and a hint that should have also been removed already.
javahints/src/org/netbeans/modules/javahints/NoDOGetCookie.java
javahints/src/org/netbeans/modules/javahints/resources/layer.xml
     1.1 --- a/javahints/src/org/netbeans/modules/javahints/NoDOGetCookie.java	Thu Nov 17 12:37:33 2011 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,113 +0,0 @@
     1.4 -/*
     1.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     1.6 - *
     1.7 - * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
     1.8 - *
     1.9 - * The contents of this file are subject to the terms of either the GNU
    1.10 - * General Public License Version 2 only ("GPL") or the Common
    1.11 - * Development and Distribution License("CDDL") (collectively, the
    1.12 - * "License"). You may not use this file except in compliance with the
    1.13 - * License. You can obtain a copy of the License at
    1.14 - * http://www.netbeans.org/cddl-gplv2.html
    1.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    1.16 - * specific language governing permissions and limitations under the
    1.17 - * License.  When distributing the software, include this License Header
    1.18 - * Notice in each file and include the License file at
    1.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    1.20 - * particular file as subject to the "Classpath" exception as provided
    1.21 - * by Sun in the GPL Version 2 section of the License file that
    1.22 - * accompanied this code. If applicable, add the following below the
    1.23 - * License Header, with the fields enclosed by brackets [] replaced by
    1.24 - * your own identifying information:
    1.25 - * "Portions Copyrighted [year] [name of copyright owner]"
    1.26 - *
    1.27 - * If you wish your version of this file to be governed by only the CDDL
    1.28 - * or only the GPL Version 2, indicate your decision by adding
    1.29 - * "[Contributor] elects to include this software in this distribution
    1.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    1.31 - * single choice of license, a recipient has the option to distribute
    1.32 - * your version of this file under either the CDDL, the GPL Version 2 or
    1.33 - * to extend the choice of license to its licensees as provided above.
    1.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    1.35 - * Version 2 license, then the option applies only if the new code is
    1.36 - * made subject to such option by the copyright holder.
    1.37 - *
    1.38 - * Contributor(s):
    1.39 - *
    1.40 - * Portions Copyrighted 2008 Sun Microsystems, Inc.
    1.41 - */
    1.42 -
    1.43 -package org.netbeans.modules.javahints;
    1.44 -
    1.45 -import com.sun.source.tree.Tree.Kind;
    1.46 -import com.sun.source.util.TreePath;
    1.47 -import java.util.Collection;
    1.48 -import java.util.Collections;
    1.49 -import java.util.EnumSet;
    1.50 -import java.util.List;
    1.51 -import java.util.Map;
    1.52 -import java.util.Set;
    1.53 -import javax.lang.model.type.TypeMirror;
    1.54 -import org.netbeans.api.java.source.CompilationInfo;
    1.55 -import org.netbeans.modules.java.hints.jackpot.impl.pm.Pattern;
    1.56 -import org.netbeans.modules.java.hints.jackpot.spi.JavaFix;
    1.57 -import org.netbeans.modules.java.hints.spi.AbstractHint;
    1.58 -import org.netbeans.spi.editor.hints.ErrorDescription;
    1.59 -import org.netbeans.spi.editor.hints.Fix;
    1.60 -
    1.61 -/**
    1.62 - *
    1.63 - * @author Jan Lahoda
    1.64 - */
    1.65 -public class NoDOGetCookie extends AbstractHint {
    1.66 -
    1.67 -    public NoDOGetCookie() {
    1.68 -        super(false, false, HintSeverity.WARNING);
    1.69 -    }
    1.70 -
    1.71 -    @Override
    1.72 -    public String getDescription() {
    1.73 -        return "NoDOGetCookie";
    1.74 -    }
    1.75 -
    1.76 -    public Set<Kind> getTreeKinds() {
    1.77 -        return EnumSet.of(Kind.METHOD_INVOCATION);
    1.78 -    }
    1.79 -
    1.80 -    public List<ErrorDescription> run(CompilationInfo info, TreePath treePath) {
    1.81 -        Map<String, TreePath> vars = Pattern.compile(info, "$1:org.openide.loaders.DataObject:.getCookie($2:org.openide.nodes.Node.Cookie:)").match(treePath);
    1.82 -
    1.83 -        if (vars == null) {
    1.84 -            return null;
    1.85 -        }
    1.86 -
    1.87 -        Fix fix = JavaFix.rewriteFix(info,
    1.88 -                                     "Use getLookup",
    1.89 -                                     treePath,
    1.90 -                                     "$1.getLookup().lookup($2)",
    1.91 -                                     vars,
    1.92 -                                     Collections.<String, Collection<? extends TreePath>>emptyMap(),
    1.93 -                                     Collections.<String, String>emptyMap(),
    1.94 -                                     Collections.<String, TypeMirror>emptyMap());
    1.95 -        List<Fix> fixes = Collections.singletonList(fix);
    1.96 -        
    1.97 -        int start = (int) info.getTrees().getSourcePositions().getStartPosition(info.getCompilationUnit(), treePath.getLeaf());
    1.98 -        int end   = (int) info.getTrees().getSourcePositions().getEndPosition(info.getCompilationUnit(), treePath.getLeaf());
    1.99 -        
   1.100 -        ErrorDescription ed = org.netbeans.spi.editor.hints.ErrorDescriptionFactory.createErrorDescription(getSeverity().toEditorSeverity(), "Use of DO.getCookie", fixes, info.getFileObject(), start, end);
   1.101 -
   1.102 -        return Collections.singletonList(ed);
   1.103 -    }
   1.104 -
   1.105 -    public String getId() {
   1.106 -        return NoDOGetCookie.class.getName();
   1.107 -    }
   1.108 -
   1.109 -    public String getDisplayName() {
   1.110 -        return "NoDOGetCookie";
   1.111 -    }
   1.112 -
   1.113 -    public void cancel() {
   1.114 -    }
   1.115 -
   1.116 -}
     2.1 --- a/javahints/src/org/netbeans/modules/javahints/resources/layer.xml	Thu Nov 17 12:37:33 2011 +0100
     2.2 +++ b/javahints/src/org/netbeans/modules/javahints/resources/layer.xml	Thu Nov 17 16:40:46 2011 +0100
     2.3 @@ -57,11 +57,8 @@
     2.4  <!--                <file name="org-netbeans-modules-javahints-DeclarationFixer.instance" />-->
     2.5                  <folder name="experimental">
     2.6                      <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.javahints.resources.Bundle"/>
     2.7 -                    <file name="org-netbeans-modules-javahints-ImageUtilitiesDeprecation.instance"/>
     2.8                      <file name="org-netbeans-modules-javahints-NPECheck.instance"/>
     2.9                      <file name="org-netbeans-modules-javahints-NoFileToURL.instance"/>
    2.10 -                    <file name="org-netbeans-modules-javahints-NoDOGetCookie.instance"/>
    2.11 -                    <file name="org-netbeans-modules-javahints-OrganizeImports.instance"/>
    2.12  		    <file name="org-netbeans-modules-javahints-Excluded.instance"/>
    2.13                  </folder>
    2.14              </folder>