InvertBoolean and ReplaceConstructorWithFactory has been moved to std. distro separate-by-function-cleanup
authorJan Lahoda <jlahoda@netbeans.org>
Fri, 17 Feb 2012 21:37:37 +0100
branchseparate-by-function-cleanup
changeset 734a561406c2d3b
parent 733 26159229c6a1
child 735 9769c807a9d6
InvertBoolean and ReplaceConstructorWithFactory has been moved to std. distro
bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/invertboolean/Bundle.properties
bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/invertboolean/InvertBooleanAction.java
bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/invertboolean/InvertBooleanRefactoring.java
bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/invertboolean/InvertBooleanRefactoringPanel.form
bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/invertboolean/InvertBooleanRefactoringPanel.java
bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/invertboolean/InvertBooleanRefactoringPluginImpl.java
bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/invertboolean/InvertBooleanRefactoringUI.java
bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/noconstructor/Bundle.properties
bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/noconstructor/ReplaceConstructorAction.java
bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/noconstructor/ReplaceConstructorRefactoring.java
bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/noconstructor/ReplaceConstructorRefactoringPluginImpl.java
bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/noconstructor/ReplaceConstructorRefactoringUI.java
bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/noconstructor/ReplaceConstructorWithFactory.form
bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/noconstructor/ReplaceConstructorWithFactory.java
bridges/refactoring/test/unit/src/org/netbeans/modules/jackpot30/refactoring/invertboolean/InvertBooleanRefactoringPluginImplTest.java
bridges/refactoring/test/unit/src/org/netbeans/modules/jackpot30/refactoring/noconstructor/ReplaceConstructorRefactoringPluginImplTest.java
     1.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/invertboolean/Bundle.properties	Fri Feb 17 19:23:00 2012 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,2 +0,0 @@
     1.4 -InvertBooleanRefactoringPanel.nameField.text=
     1.5 -InvertBooleanRefactoringPanel.jLabel1.text=New name:
     2.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/invertboolean/InvertBooleanAction.java	Fri Feb 17 19:23:00 2012 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,75 +0,0 @@
     2.4 -/*
     2.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     2.6 - *
     2.7 - * Copyright 2010-2011 Sun Microsystems, Inc. All rights reserved.
     2.8 - *
     2.9 - * The contents of this file are subject to the terms of either the GNU
    2.10 - * General Public License Version 2 only ("GPL") or the Common
    2.11 - * Development and Distribution License("CDDL") (collectively, the
    2.12 - * "License"). You may not use this file except in compliance with the
    2.13 - * License. You can obtain a copy of the License at
    2.14 - * http://www.netbeans.org/cddl-gplv2.html
    2.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    2.16 - * specific language governing permissions and limitations under the
    2.17 - * License.  When distributing the software, include this License Header
    2.18 - * Notice in each file and include the License file at
    2.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    2.20 - * particular file as subject to the "Classpath" exception as provided
    2.21 - * by Sun in the GPL Version 2 section of the License file that
    2.22 - * accompanied this code. If applicable, add the following below the
    2.23 - * License Header, with the fields enclosed by brackets [] replaced by
    2.24 - * your own identifying information:
    2.25 - * "Portions Copyrighted [year] [name of copyright owner]"
    2.26 - *
    2.27 - * If you wish your version of this file to be governed by only the CDDL
    2.28 - * or only the GPL Version 2, indicate your decision by adding
    2.29 - * "[Contributor] elects to include this software in this distribution
    2.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    2.31 - * single choice of license, a recipient has the option to distribute
    2.32 - * your version of this file under either the CDDL, the GPL Version 2 or
    2.33 - * to extend the choice of license to its licensees as provided above.
    2.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    2.35 - * Version 2 license, then the option applies only if the new code is
    2.36 - * made subject to such option by the copyright holder.
    2.37 - *
    2.38 - * Contributor(s):
    2.39 - *
    2.40 - * Portions Copyrighted 2010-2011 Sun Microsystems, Inc.
    2.41 - */
    2.42 -package org.netbeans.modules.jackpot30.refactoring.invertboolean;
    2.43 -
    2.44 -import javax.swing.Action;
    2.45 -import org.netbeans.modules.jackpot30.refactoring.RefactoringActionsProviderExt;
    2.46 -import org.netbeans.modules.refactoring.java.ui.JavaRefactoringGlobalAction;
    2.47 -import org.openide.util.HelpCtx;
    2.48 -import org.openide.util.Lookup;
    2.49 -import org.openide.util.NbBundle.Messages;
    2.50 -
    2.51 -public final class InvertBooleanAction extends JavaRefactoringGlobalAction {
    2.52 -
    2.53 -    @Messages("LBL_InvertBooleanAction=Invert Boolean")
    2.54 -    public InvertBooleanAction() {
    2.55 -        super(Bundle.LBL_InvertBooleanAction(), null); // NOI18N
    2.56 -        putValue("noIconInMenu", Boolean.TRUE); // NOI18N
    2.57 -    }
    2.58 -
    2.59 -    public final void performAction(Lookup context) {
    2.60 -        RefactoringActionsProviderExt.doInvertBoolean(context);
    2.61 -    }
    2.62 -
    2.63 -    public org.openide.util.HelpCtx getHelpCtx() {
    2.64 -        return HelpCtx.DEFAULT_HELP;
    2.65 -    }
    2.66 -
    2.67 -    protected boolean asynchronous() {
    2.68 -        return false;
    2.69 -    }
    2.70 -
    2.71 -    protected boolean enable(Lookup context) {
    2.72 -        return RefactoringActionsProviderExt.canInvertBoolean(context);
    2.73 -    }
    2.74 -
    2.75 -    public static Action create() {
    2.76 -        return InvertBooleanAction.findObject(InvertBooleanAction.class, true);
    2.77 -    }
    2.78 -}
     3.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/invertboolean/InvertBooleanRefactoring.java	Fri Feb 17 19:23:00 2012 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,69 +0,0 @@
     3.4 -/*
     3.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     3.6 - *
     3.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
     3.8 - *
     3.9 - * The contents of this file are subject to the terms of either the GNU
    3.10 - * General Public License Version 2 only ("GPL") or the Common
    3.11 - * Development and Distribution License("CDDL") (collectively, the
    3.12 - * "License"). You may not use this file except in compliance with the
    3.13 - * License. You can obtain a copy of the License at
    3.14 - * http://www.netbeans.org/cddl-gplv2.html
    3.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    3.16 - * specific language governing permissions and limitations under the
    3.17 - * License.  When distributing the software, include this License Header
    3.18 - * Notice in each file and include the License file at
    3.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    3.20 - * particular file as subject to the "Classpath" exception as provided
    3.21 - * by Sun in the GPL Version 2 section of the License file that
    3.22 - * accompanied this code. If applicable, add the following below the
    3.23 - * License Header, with the fields enclosed by brackets [] replaced by
    3.24 - * your own identifying information:
    3.25 - * "Portions Copyrighted [year] [name of copyright owner]"
    3.26 - *
    3.27 - * If you wish your version of this file to be governed by only the CDDL
    3.28 - * or only the GPL Version 2, indicate your decision by adding
    3.29 - * "[Contributor] elects to include this software in this distribution
    3.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    3.31 - * single choice of license, a recipient has the option to distribute
    3.32 - * your version of this file under either the CDDL, the GPL Version 2 or
    3.33 - * to extend the choice of license to its licensees as provided above.
    3.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    3.35 - * Version 2 license, then the option applies only if the new code is
    3.36 - * made subject to such option by the copyright holder.
    3.37 - *
    3.38 - * Contributor(s):
    3.39 - *
    3.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
    3.41 - */
    3.42 -
    3.43 -package org.netbeans.modules.jackpot30.refactoring.invertboolean;
    3.44 -
    3.45 -import org.netbeans.api.java.source.TreePathHandle;
    3.46 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
    3.47 -import org.openide.util.lookup.Lookups;
    3.48 -
    3.49 -/**
    3.50 - *
    3.51 - * @author lahvac
    3.52 - */
    3.53 -public class InvertBooleanRefactoring extends AbstractRefactoring {
    3.54 -    
    3.55 -    private final TreePathHandle original;
    3.56 -    private final String newName;
    3.57 -
    3.58 -    public InvertBooleanRefactoring(TreePathHandle original, String newName) {
    3.59 -        super(Lookups.singleton(original));
    3.60 -        this.original = original;
    3.61 -        this.newName = newName;
    3.62 -    }
    3.63 -
    3.64 -    public TreePathHandle getOriginal() {
    3.65 -        return original;
    3.66 -    }
    3.67 -
    3.68 -    public String getNewName() {
    3.69 -        return newName;
    3.70 -    }
    3.71 -
    3.72 -}
     4.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/invertboolean/InvertBooleanRefactoringPanel.form	Fri Feb 17 19:23:00 2012 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,58 +0,0 @@
     4.4 -<?xml version="1.1" encoding="UTF-8" ?>
     4.5 -
     4.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
     4.7 -  <AuxValues>
     4.8 -    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
     4.9 -    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
    4.10 -    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
    4.11 -    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
    4.12 -    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
    4.13 -    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
    4.14 -    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
    4.15 -    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
    4.16 -    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
    4.17 -  </AuxValues>
    4.18 -
    4.19 -  <Layout>
    4.20 -    <DimensionLayout dim="0">
    4.21 -      <Group type="103" groupAlignment="0" attributes="0">
    4.22 -          <Group type="102" alignment="0" attributes="0">
    4.23 -              <EmptySpace max="-2" attributes="0"/>
    4.24 -              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
    4.25 -              <EmptySpace max="-2" attributes="0"/>
    4.26 -              <Component id="nameField" pref="249" max="32767" attributes="0"/>
    4.27 -              <EmptySpace max="-2" attributes="0"/>
    4.28 -          </Group>
    4.29 -      </Group>
    4.30 -    </DimensionLayout>
    4.31 -    <DimensionLayout dim="1">
    4.32 -      <Group type="103" groupAlignment="0" attributes="0">
    4.33 -          <Group type="102" alignment="0" attributes="0">
    4.34 -              <EmptySpace max="-2" attributes="0"/>
    4.35 -              <Group type="103" groupAlignment="3" attributes="0">
    4.36 -                  <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
    4.37 -                  <Component id="nameField" alignment="3" min="-2" max="-2" attributes="0"/>
    4.38 -              </Group>
    4.39 -              <EmptySpace max="32767" attributes="0"/>
    4.40 -          </Group>
    4.41 -      </Group>
    4.42 -    </DimensionLayout>
    4.43 -  </Layout>
    4.44 -  <SubComponents>
    4.45 -    <Component class="javax.swing.JLabel" name="jLabel1">
    4.46 -      <Properties>
    4.47 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
    4.48 -          <ResourceString bundle="org/netbeans/modules/jackpot30/refactoring/noconstructor/Bundle.properties" key="InvertBooleanRefactoringPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
    4.49 -        </Property>
    4.50 -      </Properties>
    4.51 -    </Component>
    4.52 -    <Component class="javax.swing.JTextField" name="nameField">
    4.53 -      <Properties>
    4.54 -        <Property name="columns" type="int" value="15"/>
    4.55 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
    4.56 -          <ResourceString bundle="org/netbeans/modules/jackpot30/refactoring/noconstructor/Bundle.properties" key="InvertBooleanRefactoringPanel.nameField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
    4.57 -        </Property>
    4.58 -      </Properties>
    4.59 -    </Component>
    4.60 -  </SubComponents>
    4.61 -</Form>
     5.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/invertboolean/InvertBooleanRefactoringPanel.java	Fri Feb 17 19:23:00 2012 +0100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,124 +0,0 @@
     5.4 -/*
     5.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     5.6 - *
     5.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
     5.8 - *
     5.9 - * The contents of this file are subject to the terms of either the GNU
    5.10 - * General Public License Version 2 only ("GPL") or the Common
    5.11 - * Development and Distribution License("CDDL") (collectively, the
    5.12 - * "License"). You may not use this file except in compliance with the
    5.13 - * License. You can obtain a copy of the License at
    5.14 - * http://www.netbeans.org/cddl-gplv2.html
    5.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    5.16 - * specific language governing permissions and limitations under the
    5.17 - * License.  When distributing the software, include this License Header
    5.18 - * Notice in each file and include the License file at
    5.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    5.20 - * particular file as subject to the "Classpath" exception as provided
    5.21 - * by Sun in the GPL Version 2 section of the License file that
    5.22 - * accompanied this code. If applicable, add the following below the
    5.23 - * License Header, with the fields enclosed by brackets [] replaced by
    5.24 - * your own identifying information:
    5.25 - * "Portions Copyrighted [year] [name of copyright owner]"
    5.26 - *
    5.27 - * If you wish your version of this file to be governed by only the CDDL
    5.28 - * or only the GPL Version 2, indicate your decision by adding
    5.29 - * "[Contributor] elects to include this software in this distribution
    5.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    5.31 - * single choice of license, a recipient has the option to distribute
    5.32 - * your version of this file under either the CDDL, the GPL Version 2 or
    5.33 - * to extend the choice of license to its licensees as provided above.
    5.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    5.35 - * Version 2 license, then the option applies only if the new code is
    5.36 - * made subject to such option by the copyright holder.
    5.37 - *
    5.38 - * Contributor(s):
    5.39 - *
    5.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
    5.41 - */
    5.42 -
    5.43 -package org.netbeans.modules.jackpot30.refactoring.invertboolean;
    5.44 -
    5.45 -import javax.swing.event.ChangeEvent;
    5.46 -import javax.swing.event.ChangeListener;
    5.47 -import javax.swing.event.DocumentEvent;
    5.48 -import javax.swing.event.DocumentListener;
    5.49 -import org.netbeans.api.annotations.common.NonNull;
    5.50 -
    5.51 -/**
    5.52 - *
    5.53 - * @author lahvac
    5.54 - */
    5.55 -public class InvertBooleanRefactoringPanel extends javax.swing.JPanel {
    5.56 -
    5.57 -    public InvertBooleanRefactoringPanel(final @NonNull ChangeListener parent) {
    5.58 -        initComponents();
    5.59 -        nameField.getDocument().addDocumentListener(new DocumentListener() {
    5.60 -            @Override
    5.61 -            public void insertUpdate(DocumentEvent e) {
    5.62 -                parent.stateChanged(new ChangeEvent(InvertBooleanRefactoringPanel.this));
    5.63 -            }
    5.64 -            @Override
    5.65 -            public void removeUpdate(DocumentEvent e) {
    5.66 -                parent.stateChanged(new ChangeEvent(InvertBooleanRefactoringPanel.this));
    5.67 -            }
    5.68 -            @Override
    5.69 -            public void changedUpdate(DocumentEvent e) {}
    5.70 -        });
    5.71 -    }
    5.72 -
    5.73 -    /** This method is called from within the constructor to
    5.74 -     * initialize the form.
    5.75 -     * WARNING: Do NOT modify this code. The content of this method is
    5.76 -     * always regenerated by the Form Editor.
    5.77 -     */
    5.78 -    @SuppressWarnings("unchecked")
    5.79 -    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    5.80 -    private void initComponents() {
    5.81 -
    5.82 -        jLabel1 = new javax.swing.JLabel();
    5.83 -        nameField = new javax.swing.JTextField();
    5.84 -
    5.85 -        jLabel1.setText(org.openide.util.NbBundle.getMessage(InvertBooleanRefactoringPanel.class, "InvertBooleanRefactoringPanel.jLabel1.text")); // NOI18N
    5.86 -
    5.87 -        nameField.setColumns(15);
    5.88 -        nameField.setText(org.openide.util.NbBundle.getMessage(InvertBooleanRefactoringPanel.class, "InvertBooleanRefactoringPanel.nameField.text")); // NOI18N
    5.89 -
    5.90 -        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    5.91 -        this.setLayout(layout);
    5.92 -        layout.setHorizontalGroup(
    5.93 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    5.94 -            .addGroup(layout.createSequentialGroup()
    5.95 -                .addContainerGap()
    5.96 -                .addComponent(jLabel1)
    5.97 -                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    5.98 -                .addComponent(nameField, javax.swing.GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE)
    5.99 -                .addContainerGap())
   5.100 -        );
   5.101 -        layout.setVerticalGroup(
   5.102 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
   5.103 -            .addGroup(layout.createSequentialGroup()
   5.104 -                .addContainerGap()
   5.105 -                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
   5.106 -                    .addComponent(jLabel1)
   5.107 -                    .addComponent(nameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
   5.108 -                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
   5.109 -        );
   5.110 -    }// </editor-fold>//GEN-END:initComponents
   5.111 -
   5.112 -
   5.113 -    // Variables declaration - do not modify//GEN-BEGIN:variables
   5.114 -    private javax.swing.JLabel jLabel1;
   5.115 -    private javax.swing.JTextField nameField;
   5.116 -    // End of variables declaration//GEN-END:variables
   5.117 -
   5.118 -    public void initialize(String origName) {
   5.119 -        nameField.setText(origName);
   5.120 -        nameField.setSelectionStart(0);
   5.121 -        nameField.setSelectionStart(origName.length());
   5.122 -    }
   5.123 -
   5.124 -    public String getName() {
   5.125 -        return nameField.getText();
   5.126 -    }
   5.127 -}
     6.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/invertboolean/InvertBooleanRefactoringPluginImpl.java	Fri Feb 17 19:23:00 2012 +0100
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,250 +0,0 @@
     6.4 -/*
     6.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     6.6 - *
     6.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
     6.8 - *
     6.9 - * The contents of this file are subject to the terms of either the GNU
    6.10 - * General Public License Version 2 only ("GPL") or the Common
    6.11 - * Development and Distribution License("CDDL") (collectively, the
    6.12 - * "License"). You may not use this file except in compliance with the
    6.13 - * License. You can obtain a copy of the License at
    6.14 - * http://www.netbeans.org/cddl-gplv2.html
    6.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    6.16 - * specific language governing permissions and limitations under the
    6.17 - * License.  When distributing the software, include this License Header
    6.18 - * Notice in each file and include the License file at
    6.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    6.20 - * particular file as subject to the "Classpath" exception as provided
    6.21 - * by Sun in the GPL Version 2 section of the License file that
    6.22 - * accompanied this code. If applicable, add the following below the
    6.23 - * License Header, with the fields enclosed by brackets [] replaced by
    6.24 - * your own identifying information:
    6.25 - * "Portions Copyrighted [year] [name of copyright owner]"
    6.26 - *
    6.27 - * If you wish your version of this file to be governed by only the CDDL
    6.28 - * or only the GPL Version 2, indicate your decision by adding
    6.29 - * "[Contributor] elects to include this software in this distribution
    6.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    6.31 - * single choice of license, a recipient has the option to distribute
    6.32 - * your version of this file under either the CDDL, the GPL Version 2 or
    6.33 - * to extend the choice of license to its licensees as provided above.
    6.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    6.35 - * Version 2 license, then the option applies only if the new code is
    6.36 - * made subject to such option by the copyright holder.
    6.37 - *
    6.38 - * Contributor(s):
    6.39 - *
    6.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
    6.41 - */
    6.42 -
    6.43 -package org.netbeans.modules.jackpot30.refactoring.invertboolean;
    6.44 -
    6.45 -import com.sun.source.tree.ClassTree;
    6.46 -import com.sun.source.tree.MethodTree;
    6.47 -import com.sun.source.tree.ReturnTree;
    6.48 -import com.sun.source.tree.Tree;
    6.49 -import com.sun.source.tree.Tree.Kind;
    6.50 -import com.sun.source.tree.VariableTree;
    6.51 -import com.sun.source.util.TreePath;
    6.52 -import com.sun.source.util.TreePathScanner;
    6.53 -import java.io.IOException;
    6.54 -import java.util.HashMap;
    6.55 -import java.util.Map;
    6.56 -import javax.lang.model.element.Modifier;
    6.57 -import javax.lang.model.element.TypeElement;
    6.58 -import javax.lang.model.type.TypeMirror;
    6.59 -import org.netbeans.api.java.source.JavaSource;
    6.60 -import org.netbeans.api.java.source.JavaSource.Phase;
    6.61 -import org.netbeans.api.java.source.ModificationResult;
    6.62 -import org.netbeans.api.java.source.Task;
    6.63 -import org.netbeans.api.java.source.TreePathHandle;
    6.64 -import org.netbeans.api.java.source.WorkingCopy;
    6.65 -import org.netbeans.modules.jackpot30.spi.Hacks;
    6.66 -import org.netbeans.modules.jackpot30.spi.refactoring.JackpotBasedRefactoring;
    6.67 -import org.netbeans.modules.java.hints.jackpot.spi.PatternConvertor;
    6.68 -import org.netbeans.modules.refactoring.api.Problem;
    6.69 -import org.openide.util.Exceptions;
    6.70 -import org.openide.util.MapFormat;
    6.71 -
    6.72 -/**
    6.73 - *
    6.74 - * @author lahvac
    6.75 - */
    6.76 -public class InvertBooleanRefactoringPluginImpl extends JackpotBasedRefactoring {
    6.77 -
    6.78 -    private final InvertBooleanRefactoring invertBooleanRefactoring;
    6.79 -
    6.80 -    public InvertBooleanRefactoringPluginImpl(InvertBooleanRefactoring replaceConstructorRefactoring) {
    6.81 -        super(replaceConstructorRefactoring);
    6.82 -        this.invertBooleanRefactoring = replaceConstructorRefactoring;
    6.83 -    }
    6.84 -
    6.85 -    @Override
    6.86 -    public Problem preCheck() {
    6.87 -        return null;
    6.88 -    }
    6.89 -
    6.90 -    @Override
    6.91 -    public Problem checkParameters() {
    6.92 -        return null;
    6.93 -    }
    6.94 -
    6.95 -    @Override
    6.96 -    public Problem fastCheckParameters() {
    6.97 -        return null;
    6.98 -    }
    6.99 -
   6.100 -    private static final String INVERT_FIXES =
   6.101 -            "=> ${newName-with-enclosing}$ $left != $right; :: matchesWithBind($val, \"$left == $right\")\n" +
   6.102 -            "=> ${newName-with-enclosing}$ $left == $right; :: matchesWithBind($val, \"$left != $right\")\n" +
   6.103 -            "=> ${newName-with-enclosing}$ $op; :: matchesWithBind($val, \"!($op)\")" +
   6.104 -            "=> ${newName-with-enclosing}$ $op; :: matchesWithBind($val, \"(!$op)\")" +
   6.105 -            "=> ${newName-with-enclosing}$ $op; :: !matchesAny($val, \"!($op)\") && matchesWithBind($val, \"!$op\")\n" +
   6.106 -            "=> ${newName-with-enclosing}$ false; :: matchesAny($val, \"true\")\n" +
   6.107 -            "=> ${newName-with-enclosing}$ true; :: matchesAny($val, \"false\")\n" +
   6.108 -            "=> ${newName-with-enclosing}$ !$val; :: otherwise\n";
   6.109 -
   6.110 -    private static final String VAR_SCRIPT_TEMPLATE =
   6.111 -            "   $enclosing.${originalName}$ :: $enclosing instanceof ${enclosing}$ && !parentMatches(\"$enclosing.${originalName}$ = $newVal\") && !parentMatches(\"!$enclosing.${originalName}$\")\n" +
   6.112 -            "=> !$enclosing.${newName}$\n" +
   6.113 -            ";;\n" +
   6.114 -            "   !$enclosing.${originalName}$ :: $enclosing instanceof ${enclosing}$\n" +
   6.115 -            "=> $enclosing.${newName}$\n" +
   6.116 -            ";;\n" +
   6.117 -            "   $enclosing.${originalName}$ = $val :: $enclosing instanceof ${enclosing}$ && !matchesAny($val, \"!$enclosing.${originalName}$\")\n" +
   6.118 -            INVERT_FIXES.replace(";", "").replace("${newName-with-enclosing}$", "$enclosing.${newName}$ =") +
   6.119 -            ";;\n";
   6.120 -
   6.121 -    private static final String VAR_SCRIPT_TEMPLATE_STATIC =
   6.122 -            "   ${enclosing}$.${originalName}$ :: !parentMatches(\"$enclosing.${originalName}$ = $newVal\") && !parentMatches(\"!$enclosing.${originalName}$\")\n" +
   6.123 -            "=> !${enclosing}$.${newName}$\n" +
   6.124 -            ";;\n" +
   6.125 -            "   !${enclosing}$.${originalName}$\n" +
   6.126 -            "=> ${enclosing}$.${newName}$\n" +
   6.127 -            ";;\n" +
   6.128 -            "   ${enclosing}$.${originalName}$ = $val :: !matchesAny($val, \"!$enclosing.${originalName}$\")\n" +
   6.129 -            INVERT_FIXES.replace(";", "").replace("${newName-with-enclosing}$", "${enclosing}$.${newName}$ =") +
   6.130 -            ";;\n";
   6.131 -
   6.132 -    private static final String VAR_INIT =
   6.133 -            "   $mods$ $type ${originalName}$ = $val;" +
   6.134 -            INVERT_FIXES.replace("${newName-with-enclosing}$", "$mods$ $type ${newName}$  =") +
   6.135 -            ";;";
   6.136 -
   6.137 -    private static final String MTH_INIT =
   6.138 -            "   return $val;" +
   6.139 -            INVERT_FIXES.replace("${newName-with-enclosing}$", "return ") +
   6.140 -            ";;";
   6.141 -
   6.142 -    @Override
   6.143 -    protected void prepareAndConstructRule(final Context result) {
   6.144 -        final TreePathHandle original = invertBooleanRefactoring.getOriginal();
   6.145 -
   6.146 -        try {
   6.147 -            ModificationResult mod = JavaSource.forFileObject(original.getFileObject()).runModificationTask(new Task<WorkingCopy>() {
   6.148 -
   6.149 -                @Override
   6.150 -                public void run(final WorkingCopy parameter) throws Exception {
   6.151 -                    parameter.toPhase(Phase.RESOLVED);
   6.152 -
   6.153 -                    final TreePath path = original.resolve(parameter);
   6.154 -                    Map<String, String> arguments = new HashMap<String, String>();
   6.155 -                    String scriptTemplate;
   6.156 -                    Tree leaf = path.getLeaf();
   6.157 -                    TypeElement parent = (TypeElement) parameter.getTrees().getElement(path.getParentPath());
   6.158 -
   6.159 -                    arguments.put("newName", invertBooleanRefactoring.getNewName());
   6.160 -                    arguments.put("enclosing", parent.getQualifiedName().toString());
   6.161 -
   6.162 -                    if (leaf.getKind() == Kind.VARIABLE) {
   6.163 -                        VariableTree var = (VariableTree) leaf;
   6.164 -
   6.165 -                        scriptTemplate = var.getModifiers().getFlags().contains(Modifier.STATIC) ? VAR_SCRIPT_TEMPLATE_STATIC : VAR_SCRIPT_TEMPLATE;
   6.166 -                        arguments.put("originalName", var.getName().toString());
   6.167 -
   6.168 -                        if (var.getInitializer() != null) {
   6.169 -                            MapFormat format = new MapFormat(arguments);
   6.170 -                            format.setLeftBrace("${");
   6.171 -                            format.setRightBrace("}$");
   6.172 -                            String initFormat = format.format(VAR_INIT);
   6.173 -
   6.174 -                            Hacks.findHintsAndApplyFixes(parameter, PatternConvertor.create(initFormat), path, cancel);
   6.175 -                        }
   6.176 -                    } else if (leaf.getKind() == Kind.METHOD) {
   6.177 -                        MethodTree mt = (MethodTree) leaf;
   6.178 -
   6.179 -                        arguments.put("originalName", mt.getName().toString());
   6.180 -
   6.181 -                        MapFormat format = new MapFormat(arguments);
   6.182 -                        format.setLeftBrace("${");
   6.183 -                        format.setRightBrace("}$");
   6.184 -                        final String mthFormat = format.format(MTH_INIT);
   6.185 -
   6.186 -                        new TreePathScanner<Void, Void>() {
   6.187 -                            @Override public Void visitReturn(ReturnTree node, Void p) {
   6.188 -                                Hacks.findHintsAndApplyFixes(parameter, PatternConvertor.create(mthFormat), getCurrentPath(), cancel);
   6.189 -                                return super.visitReturn(node, p);
   6.190 -                            }
   6.191 -                            @Override public Void visitClass(ClassTree node, Void p) {
   6.192 -                                return null;
   6.193 -                            }
   6.194 -                        }.scan(path, null);
   6.195 -
   6.196 -                        parameter.rewrite(leaf, parameter.getTreeMaker().setLabel(leaf, invertBooleanRefactoring.getNewName()));
   6.197 -
   6.198 -                        StringBuilder parameters = new StringBuilder();
   6.199 -                        StringBuilder constraints = new StringBuilder();
   6.200 -                        int count = 1;
   6.201 -                        for (VariableTree vt : mt.getParameters()) {
   6.202 -                            if (count > 1) {
   6.203 -                                parameters.append(", ");
   6.204 -                                constraints.append(" && ");
   6.205 -                            }
   6.206 -                            parameters.append("$").append(count);
   6.207 -                            TypeMirror type = parameter.getTrees().getTypeMirror(new TreePath(new TreePath(path, vt), vt.getType()));
   6.208 -                            type = parameter.getTypes().erasure(type);
   6.209 -                            constraints.append("$").append(count).append(" instanceof ").append(type);
   6.210 -                            count++;
   6.211 -                        }
   6.212 -
   6.213 -                        String andConstraints = (constraints.length() > 0 ? " && " : "") + constraints;
   6.214 -
   6.215 -                        StringBuilder script = new StringBuilder();
   6.216 -
   6.217 -                        if (mt.getModifiers().getFlags().contains(Modifier.STATIC)) {
   6.218 -                            script.append("   ${enclosing}$.<$T$>${originalName}$(").append(parameters).append(") :: !parentMatches(\"!$enclosing.${originalName}$($args$)\") ").append(andConstraints);
   6.219 -                            script.append("=> !${enclosing}$.<$T$>${newName}$(").append(parameters).append(")\n");
   6.220 -                            script.append(";;\n");
   6.221 -                            script.append("   !${enclosing}$.<$T$>${originalName}$(").append(parameters).append(") :: ").append(constraints);
   6.222 -                            script.append("=> ${enclosing}$.<$T$>${newName}$(").append(parameters).append(")\n");
   6.223 -                            script.append(";;\n");
   6.224 -                        } else {
   6.225 -                            script.append("   $enclosing.<$T$>${originalName}$(").append(parameters).append(") :: $enclosing instanceof ${enclosing}$ && !parentMatches(\"!$enclosing.${originalName}$($args$)\") ").append(andConstraints);
   6.226 -                            script.append("=> !$enclosing.<$T$>${newName}$(").append(parameters).append(")\n");
   6.227 -                            script.append(";;\n");
   6.228 -                            script.append("   !$enclosing.<$T$>${originalName}$(").append(parameters).append(") :: $enclosing instanceof ${enclosing}$ ").append(andConstraints);
   6.229 -                            script.append("=> $enclosing.<$T$>${newName}$(").append(parameters).append(")\n");
   6.230 -                            script.append(";;\n");
   6.231 -                        }
   6.232 -
   6.233 -                        scriptTemplate = script.toString();
   6.234 -                    } else {
   6.235 -                        throw new UnsupportedOperationException();
   6.236 -                    }
   6.237 -
   6.238 -                    MapFormat format = new MapFormat(arguments);
   6.239 -
   6.240 -                    format.setLeftBrace("${");
   6.241 -                    format.setRightBrace("}$");
   6.242 -
   6.243 -                    result.addScript(parent.getQualifiedName().toString(), format.format(scriptTemplate), ScriptOptions.RUN/*, ScriptOptions.STORE*/);
   6.244 -                }
   6.245 -            });
   6.246 -
   6.247 -            result.addModificationResult(mod);
   6.248 -        } catch (IOException ex) {
   6.249 -            Exceptions.printStackTrace(ex);
   6.250 -        }
   6.251 -    }
   6.252 -
   6.253 -}
     7.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/invertboolean/InvertBooleanRefactoringUI.java	Fri Feb 17 19:23:00 2012 +0100
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,133 +0,0 @@
     7.4 -/*
     7.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     7.6 - *
     7.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
     7.8 - *
     7.9 - * The contents of this file are subject to the terms of either the GNU
    7.10 - * General Public License Version 2 only ("GPL") or the Common
    7.11 - * Development and Distribution License("CDDL") (collectively, the
    7.12 - * "License"). You may not use this file except in compliance with the
    7.13 - * License. You can obtain a copy of the License at
    7.14 - * http://www.netbeans.org/cddl-gplv2.html
    7.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    7.16 - * specific language governing permissions and limitations under the
    7.17 - * License.  When distributing the software, include this License Header
    7.18 - * Notice in each file and include the License file at
    7.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    7.20 - * particular file as subject to the "Classpath" exception as provided
    7.21 - * by Sun in the GPL Version 2 section of the License file that
    7.22 - * accompanied this code. If applicable, add the following below the
    7.23 - * License Header, with the fields enclosed by brackets [] replaced by
    7.24 - * your own identifying information:
    7.25 - * "Portions Copyrighted [year] [name of copyright owner]"
    7.26 - *
    7.27 - * If you wish your version of this file to be governed by only the CDDL
    7.28 - * or only the GPL Version 2, indicate your decision by adding
    7.29 - * "[Contributor] elects to include this software in this distribution
    7.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    7.31 - * single choice of license, a recipient has the option to distribute
    7.32 - * your version of this file under either the CDDL, the GPL Version 2 or
    7.33 - * to extend the choice of license to its licensees as provided above.
    7.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    7.35 - * Version 2 license, then the option applies only if the new code is
    7.36 - * made subject to such option by the copyright holder.
    7.37 - *
    7.38 - * Contributor(s):
    7.39 - *
    7.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
    7.41 - */
    7.42 -
    7.43 -package org.netbeans.modules.jackpot30.refactoring.invertboolean;
    7.44 -
    7.45 -import java.awt.Component;
    7.46 -import javax.lang.model.SourceVersion;
    7.47 -import javax.swing.event.ChangeListener;
    7.48 -import org.netbeans.api.java.source.TreePathHandle;
    7.49 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
    7.50 -import org.netbeans.modules.refactoring.api.Problem;
    7.51 -import org.netbeans.modules.refactoring.spi.ui.CustomRefactoringPanel;
    7.52 -import org.netbeans.modules.refactoring.spi.ui.RefactoringUI;
    7.53 -import org.openide.util.HelpCtx;
    7.54 -
    7.55 -/**
    7.56 - *
    7.57 - * @author lahvac
    7.58 - */
    7.59 -public class InvertBooleanRefactoringUI implements RefactoringUI {
    7.60 -
    7.61 -    private final TreePathHandle path;
    7.62 -    private String name;
    7.63 -    private InvertBooleanRefactoringPanel panel;
    7.64 -
    7.65 -    public InvertBooleanRefactoringUI(TreePathHandle path, String name) {
    7.66 -        this.path = path;
    7.67 -        this.name = name;
    7.68 -    }
    7.69 -
    7.70 -    @Override
    7.71 -    public String getName() {
    7.72 -        return "InvertBooleanRefactoringUI";
    7.73 -    }
    7.74 -
    7.75 -    @Override
    7.76 -    public String getDescription() {
    7.77 -        return "InvertBooleanRefactoringUI";
    7.78 -    }
    7.79 -
    7.80 -    @Override
    7.81 -    public boolean isQuery() {
    7.82 -        return false;
    7.83 -    }
    7.84 -
    7.85 -    @Override
    7.86 -    public CustomRefactoringPanel getPanel(final ChangeListener parent) {
    7.87 -        return new CustomRefactoringPanel() {
    7.88 -            @Override
    7.89 -            public void initialize() {
    7.90 -                panel.initialize(name);
    7.91 -            }
    7.92 -            @Override
    7.93 -            public Component getComponent() {
    7.94 -                if (panel == null) {
    7.95 -                    panel = new InvertBooleanRefactoringPanel(parent);
    7.96 -                }
    7.97 -                return panel;
    7.98 -            }
    7.99 -        };
   7.100 -    }
   7.101 -
   7.102 -    @Override
   7.103 -    public Problem setParameters() {
   7.104 -        this.name = panel.getName();
   7.105 -        return null;
   7.106 -    }
   7.107 -
   7.108 -    @Override
   7.109 -    public Problem checkParameters() {
   7.110 -        String name = this.name != null ? this.name : panel.getName();
   7.111 -        
   7.112 -        if (name == null || name.length() == 0) {
   7.113 -            return new Problem(true, "No factory method name specified.");
   7.114 -        }
   7.115 -        if (!SourceVersion.isIdentifier(name)) {
   7.116 -            return new Problem(true, name + " is not an identifier.");
   7.117 -        }
   7.118 -        return null;
   7.119 -    }
   7.120 -
   7.121 -    @Override
   7.122 -    public boolean hasParameters() {
   7.123 -        return true;
   7.124 -    }
   7.125 -
   7.126 -    @Override
   7.127 -    public AbstractRefactoring getRefactoring() {
   7.128 -        return new InvertBooleanRefactoring(path, name);
   7.129 -    }
   7.130 -
   7.131 -    @Override
   7.132 -    public HelpCtx getHelpCtx() {
   7.133 -        return null;
   7.134 -    }
   7.135 -
   7.136 -}
     8.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/noconstructor/Bundle.properties	Fri Feb 17 19:23:00 2012 +0100
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,4 +0,0 @@
     8.4 -LBL_ReplaceConstructorAction=Replace C&onstructor with Factory
     8.5 -CTL_ReplaceConstructorAction=Replace Constructor
     8.6 -ReplaceConstructorWithFactory.jLabel1.text=Factory method name:
     8.7 -ReplaceConstructorWithFactory.nameField.text=
     9.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/noconstructor/ReplaceConstructorAction.java	Fri Feb 17 19:23:00 2012 +0100
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,74 +0,0 @@
     9.4 -/*
     9.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     9.6 - *
     9.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
     9.8 - *
     9.9 - * The contents of this file are subject to the terms of either the GNU
    9.10 - * General Public License Version 2 only ("GPL") or the Common
    9.11 - * Development and Distribution License("CDDL") (collectively, the
    9.12 - * "License"). You may not use this file except in compliance with the
    9.13 - * License. You can obtain a copy of the License at
    9.14 - * http://www.netbeans.org/cddl-gplv2.html
    9.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    9.16 - * specific language governing permissions and limitations under the
    9.17 - * License.  When distributing the software, include this License Header
    9.18 - * Notice in each file and include the License file at
    9.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    9.20 - * particular file as subject to the "Classpath" exception as provided
    9.21 - * by Sun in the GPL Version 2 section of the License file that
    9.22 - * accompanied this code. If applicable, add the following below the
    9.23 - * License Header, with the fields enclosed by brackets [] replaced by
    9.24 - * your own identifying information:
    9.25 - * "Portions Copyrighted [year] [name of copyright owner]"
    9.26 - *
    9.27 - * If you wish your version of this file to be governed by only the CDDL
    9.28 - * or only the GPL Version 2, indicate your decision by adding
    9.29 - * "[Contributor] elects to include this software in this distribution
    9.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    9.31 - * single choice of license, a recipient has the option to distribute
    9.32 - * your version of this file under either the CDDL, the GPL Version 2 or
    9.33 - * to extend the choice of license to its licensees as provided above.
    9.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    9.35 - * Version 2 license, then the option applies only if the new code is
    9.36 - * made subject to such option by the copyright holder.
    9.37 - *
    9.38 - * Contributor(s):
    9.39 - *
    9.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
    9.41 - */
    9.42 -package org.netbeans.modules.jackpot30.refactoring.noconstructor;
    9.43 -
    9.44 -import javax.swing.Action;
    9.45 -import org.netbeans.modules.jackpot30.refactoring.RefactoringActionsProviderExt;
    9.46 -import org.netbeans.modules.refactoring.java.ui.JavaRefactoringGlobalAction;
    9.47 -import org.openide.util.HelpCtx;
    9.48 -import org.openide.util.Lookup;
    9.49 -import org.openide.util.NbBundle;
    9.50 -
    9.51 -public final class ReplaceConstructorAction extends JavaRefactoringGlobalAction {
    9.52 -
    9.53 -    public ReplaceConstructorAction() {
    9.54 -        super(NbBundle.getMessage(ReplaceConstructorAction.class, "LBL_ReplaceConstructorAction"), null); // NOI18N
    9.55 -        putValue("noIconInMenu", Boolean.TRUE); // NOI18N
    9.56 -    }
    9.57 -
    9.58 -    public final void performAction(Lookup context) {
    9.59 -        RefactoringActionsProviderExt.doReplaceConstructor(context);
    9.60 -    }
    9.61 -
    9.62 -    public org.openide.util.HelpCtx getHelpCtx() {
    9.63 -        return HelpCtx.DEFAULT_HELP;
    9.64 -    }
    9.65 -
    9.66 -    protected boolean asynchronous() {
    9.67 -        return false;
    9.68 -    }
    9.69 -
    9.70 -    protected boolean enable(Lookup context) {
    9.71 -        return RefactoringActionsProviderExt.canReplaceConstructor(context);
    9.72 -    }
    9.73 -
    9.74 -    public static Action create() {
    9.75 -        return ReplaceConstructorAction.findObject(ReplaceConstructorAction.class, true);
    9.76 -    }
    9.77 -}
    10.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/noconstructor/ReplaceConstructorRefactoring.java	Fri Feb 17 19:23:00 2012 +0100
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,69 +0,0 @@
    10.4 -/*
    10.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    10.6 - *
    10.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
    10.8 - *
    10.9 - * The contents of this file are subject to the terms of either the GNU
   10.10 - * General Public License Version 2 only ("GPL") or the Common
   10.11 - * Development and Distribution License("CDDL") (collectively, the
   10.12 - * "License"). You may not use this file except in compliance with the
   10.13 - * License. You can obtain a copy of the License at
   10.14 - * http://www.netbeans.org/cddl-gplv2.html
   10.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   10.16 - * specific language governing permissions and limitations under the
   10.17 - * License.  When distributing the software, include this License Header
   10.18 - * Notice in each file and include the License file at
   10.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   10.20 - * particular file as subject to the "Classpath" exception as provided
   10.21 - * by Sun in the GPL Version 2 section of the License file that
   10.22 - * accompanied this code. If applicable, add the following below the
   10.23 - * License Header, with the fields enclosed by brackets [] replaced by
   10.24 - * your own identifying information:
   10.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   10.26 - *
   10.27 - * If you wish your version of this file to be governed by only the CDDL
   10.28 - * or only the GPL Version 2, indicate your decision by adding
   10.29 - * "[Contributor] elects to include this software in this distribution
   10.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   10.31 - * single choice of license, a recipient has the option to distribute
   10.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   10.33 - * to extend the choice of license to its licensees as provided above.
   10.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   10.35 - * Version 2 license, then the option applies only if the new code is
   10.36 - * made subject to such option by the copyright holder.
   10.37 - *
   10.38 - * Contributor(s):
   10.39 - *
   10.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
   10.41 - */
   10.42 -
   10.43 -package org.netbeans.modules.jackpot30.refactoring.noconstructor;
   10.44 -
   10.45 -import org.netbeans.api.java.source.TreePathHandle;
   10.46 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
   10.47 -import org.openide.util.lookup.Lookups;
   10.48 -
   10.49 -/**
   10.50 - *
   10.51 - * @author lahvac
   10.52 - */
   10.53 -public class ReplaceConstructorRefactoring extends AbstractRefactoring {
   10.54 -    
   10.55 -    private final TreePathHandle constructor;
   10.56 -    private final String factoryName;
   10.57 -
   10.58 -    public ReplaceConstructorRefactoring(TreePathHandle constructor, String factoryName) {
   10.59 -        super(Lookups.singleton(constructor));
   10.60 -        this.constructor = constructor;
   10.61 -        this.factoryName = factoryName;
   10.62 -    }
   10.63 -
   10.64 -    public TreePathHandle getConstructor() {
   10.65 -        return constructor;
   10.66 -    }
   10.67 -
   10.68 -    public String getFactoryName() {
   10.69 -        return factoryName;
   10.70 -    }
   10.71 -
   10.72 -}
    11.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/noconstructor/ReplaceConstructorRefactoringPluginImpl.java	Fri Feb 17 19:23:00 2012 +0100
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,144 +0,0 @@
    11.4 -/*
    11.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    11.6 - *
    11.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
    11.8 - *
    11.9 - * The contents of this file are subject to the terms of either the GNU
   11.10 - * General Public License Version 2 only ("GPL") or the Common
   11.11 - * Development and Distribution License("CDDL") (collectively, the
   11.12 - * "License"). You may not use this file except in compliance with the
   11.13 - * License. You can obtain a copy of the License at
   11.14 - * http://www.netbeans.org/cddl-gplv2.html
   11.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   11.16 - * specific language governing permissions and limitations under the
   11.17 - * License.  When distributing the software, include this License Header
   11.18 - * Notice in each file and include the License file at
   11.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   11.20 - * particular file as subject to the "Classpath" exception as provided
   11.21 - * by Sun in the GPL Version 2 section of the License file that
   11.22 - * accompanied this code. If applicable, add the following below the
   11.23 - * License Header, with the fields enclosed by brackets [] replaced by
   11.24 - * your own identifying information:
   11.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   11.26 - *
   11.27 - * If you wish your version of this file to be governed by only the CDDL
   11.28 - * or only the GPL Version 2, indicate your decision by adding
   11.29 - * "[Contributor] elects to include this software in this distribution
   11.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   11.31 - * single choice of license, a recipient has the option to distribute
   11.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   11.33 - * to extend the choice of license to its licensees as provided above.
   11.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   11.35 - * Version 2 license, then the option applies only if the new code is
   11.36 - * made subject to such option by the copyright holder.
   11.37 - *
   11.38 - * Contributor(s):
   11.39 - *
   11.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
   11.41 - */
   11.42 -
   11.43 -package org.netbeans.modules.jackpot30.refactoring.noconstructor;
   11.44 -
   11.45 -import com.sun.source.tree.ClassTree;
   11.46 -import com.sun.source.tree.ExpressionTree;
   11.47 -import com.sun.source.tree.MethodTree;
   11.48 -import com.sun.source.tree.TypeParameterTree;
   11.49 -import com.sun.source.tree.VariableTree;
   11.50 -import com.sun.source.util.TreePath;
   11.51 -import java.io.IOException;
   11.52 -import java.util.Collections;
   11.53 -import java.util.EnumSet;
   11.54 -import javax.lang.model.element.Modifier;
   11.55 -import javax.lang.model.element.TypeElement;
   11.56 -import org.netbeans.api.java.source.GeneratorUtilities;
   11.57 -import org.netbeans.api.java.source.JavaSource;
   11.58 -import org.netbeans.api.java.source.JavaSource.Phase;
   11.59 -import org.netbeans.api.java.source.ModificationResult;
   11.60 -import org.netbeans.api.java.source.Task;
   11.61 -import org.netbeans.api.java.source.TreeMaker;
   11.62 -import org.netbeans.api.java.source.TreePathHandle;
   11.63 -import org.netbeans.api.java.source.WorkingCopy;
   11.64 -import org.netbeans.modules.jackpot30.spi.refactoring.JackpotBasedRefactoring;
   11.65 -import org.netbeans.modules.refactoring.api.Problem;
   11.66 -import org.openide.util.Exceptions;
   11.67 -
   11.68 -/**
   11.69 - *
   11.70 - * @author lahvac
   11.71 - */
   11.72 -public class ReplaceConstructorRefactoringPluginImpl extends JackpotBasedRefactoring {
   11.73 -
   11.74 -    private final ReplaceConstructorRefactoring replaceConstructorRefactoring;
   11.75 -
   11.76 -    public ReplaceConstructorRefactoringPluginImpl(ReplaceConstructorRefactoring replaceConstructorRefactoring) {
   11.77 -        super(replaceConstructorRefactoring);
   11.78 -        this.replaceConstructorRefactoring = replaceConstructorRefactoring;
   11.79 -    }
   11.80 -
   11.81 -    @Override
   11.82 -    public Problem preCheck() {
   11.83 -        return null;
   11.84 -    }
   11.85 -
   11.86 -    @Override
   11.87 -    public Problem checkParameters() {
   11.88 -        return null;
   11.89 -    }
   11.90 -
   11.91 -    @Override
   11.92 -    public Problem fastCheckParameters() {
   11.93 -        return null;
   11.94 -    }
   11.95 -
   11.96 -    @Override
   11.97 -    protected void prepareAndConstructRule(final Context result) {
   11.98 -        final TreePathHandle constr = replaceConstructorRefactoring.getConstructor();
   11.99 -
  11.100 -        try {
  11.101 -            ModificationResult mod = JavaSource.forFileObject(constr.getFileObject()).runModificationTask(new Task<WorkingCopy>() {
  11.102 -
  11.103 -                @Override
  11.104 -                public void run(WorkingCopy parameter) throws Exception {
  11.105 -                    parameter.toPhase(Phase.RESOLVED);
  11.106 -                    TreePath constrPath = constr.resolve(parameter);
  11.107 -                    MethodTree constructor = (MethodTree) constrPath.getLeaf();
  11.108 -                    TypeElement parent = (TypeElement) parameter.getTrees().getElement(constrPath.getParentPath());
  11.109 -                    TreeMaker make = parameter.getTreeMaker();
  11.110 -                    StringBuilder parameters = new StringBuilder();
  11.111 -                    StringBuilder constraints = new StringBuilder();
  11.112 -                    StringBuilder realParameters = new StringBuilder();
  11.113 -                    int count = 1;
  11.114 -                    for (VariableTree vt : constructor.getParameters()) {
  11.115 -                        if (count > 1) {
  11.116 -                            parameters.append(", ");
  11.117 -                            constraints.append(" && ");
  11.118 -                            realParameters.append(", ");
  11.119 -                        }
  11.120 -                        realParameters.append(vt.getName());
  11.121 -                        parameters.append("$").append(count);
  11.122 -                        constraints.append("$").append(count).append(" instanceof ").append(parameter.getTrees().getTypeMirror(new TreePath(new TreePath(constrPath, vt), vt.getType())));
  11.123 -                        count++;
  11.124 -                    }
  11.125 -                    EnumSet<Modifier> factoryMods = EnumSet.of(Modifier.STATIC);
  11.126 -                    factoryMods.addAll(constructor.getModifiers().getFlags());
  11.127 -                    MethodTree factory = make.Method(make.Modifiers(factoryMods), replaceConstructorRefactoring.getFactoryName(), make.QualIdent(parent), Collections.<TypeParameterTree>emptyList(), constructor.getParameters(), Collections.<ExpressionTree>emptyList(), "{ return new " + parent.getSimpleName() + "(" + realParameters + "); }", null);
  11.128 -                    parameter.rewrite(constrPath.getParentPath().getLeaf(), GeneratorUtilities.get(parameter).insertClassMember((ClassTree) constrPath.getParentPath().getLeaf(), factory));
  11.129 -                    EnumSet<Modifier> constructorMods = EnumSet.of(Modifier.PRIVATE);
  11.130 -                    parameter.rewrite(constructor.getModifiers(), make.Modifiers(constructorMods));
  11.131 -                    StringBuilder rule = new StringBuilder();
  11.132 -                    rule.append("new ").append(parent.getQualifiedName()).append("(").append(parameters).append(")");
  11.133 -                    if (constraints.length() > 0) {
  11.134 -                        rule.append(" :: ").append(constraints);
  11.135 -                    }
  11.136 -                    rule.append(" => ").append(parent.getQualifiedName()).append(".").append(replaceConstructorRefactoring.getFactoryName()).append("(").append(parameters).append(");;");
  11.137 -                    result.addScript(parent.getQualifiedName().toString(), rule.toString(), ScriptOptions.RUN, ScriptOptions.STORE);
  11.138 -                }
  11.139 -            });
  11.140 -
  11.141 -            result.addModificationResult(mod);
  11.142 -        } catch (IOException ex) {
  11.143 -            Exceptions.printStackTrace(ex);
  11.144 -        }
  11.145 -    }
  11.146 -
  11.147 -}
    12.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/noconstructor/ReplaceConstructorRefactoringUI.java	Fri Feb 17 19:23:00 2012 +0100
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,132 +0,0 @@
    12.4 -/*
    12.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    12.6 - *
    12.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
    12.8 - *
    12.9 - * The contents of this file are subject to the terms of either the GNU
   12.10 - * General Public License Version 2 only ("GPL") or the Common
   12.11 - * Development and Distribution License("CDDL") (collectively, the
   12.12 - * "License"). You may not use this file except in compliance with the
   12.13 - * License. You can obtain a copy of the License at
   12.14 - * http://www.netbeans.org/cddl-gplv2.html
   12.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   12.16 - * specific language governing permissions and limitations under the
   12.17 - * License.  When distributing the software, include this License Header
   12.18 - * Notice in each file and include the License file at
   12.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   12.20 - * particular file as subject to the "Classpath" exception as provided
   12.21 - * by Sun in the GPL Version 2 section of the License file that
   12.22 - * accompanied this code. If applicable, add the following below the
   12.23 - * License Header, with the fields enclosed by brackets [] replaced by
   12.24 - * your own identifying information:
   12.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   12.26 - *
   12.27 - * If you wish your version of this file to be governed by only the CDDL
   12.28 - * or only the GPL Version 2, indicate your decision by adding
   12.29 - * "[Contributor] elects to include this software in this distribution
   12.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   12.31 - * single choice of license, a recipient has the option to distribute
   12.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   12.33 - * to extend the choice of license to its licensees as provided above.
   12.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   12.35 - * Version 2 license, then the option applies only if the new code is
   12.36 - * made subject to such option by the copyright holder.
   12.37 - *
   12.38 - * Contributor(s):
   12.39 - *
   12.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
   12.41 - */
   12.42 -
   12.43 -package org.netbeans.modules.jackpot30.refactoring.noconstructor;
   12.44 -
   12.45 -import java.awt.Component;
   12.46 -import javax.lang.model.SourceVersion;
   12.47 -import javax.swing.event.ChangeListener;
   12.48 -import org.netbeans.api.java.source.TreePathHandle;
   12.49 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
   12.50 -import org.netbeans.modules.refactoring.api.Problem;
   12.51 -import org.netbeans.modules.refactoring.spi.ui.CustomRefactoringPanel;
   12.52 -import org.netbeans.modules.refactoring.spi.ui.RefactoringUI;
   12.53 -import org.openide.util.HelpCtx;
   12.54 -
   12.55 -/**
   12.56 - *
   12.57 - * @author lahvac
   12.58 - */
   12.59 -public class ReplaceConstructorRefactoringUI implements RefactoringUI {
   12.60 -
   12.61 -    private final TreePathHandle constructor;
   12.62 -    private String factoryName;
   12.63 -    private ReplaceConstructorWithFactory panel;
   12.64 -
   12.65 -    public ReplaceConstructorRefactoringUI(TreePathHandle constructor) {
   12.66 -        this.constructor = constructor;
   12.67 -    }
   12.68 -
   12.69 -    @Override
   12.70 -    public String getName() {
   12.71 -        return "ReplaceConstructorRefactoringUI";
   12.72 -    }
   12.73 -
   12.74 -    @Override
   12.75 -    public String getDescription() {
   12.76 -        return "ReplaceConstructorRefactoringUI";
   12.77 -    }
   12.78 -
   12.79 -    @Override
   12.80 -    public boolean isQuery() {
   12.81 -        return false;
   12.82 -    }
   12.83 -
   12.84 -    @Override
   12.85 -    public CustomRefactoringPanel getPanel(final ChangeListener parent) {
   12.86 -        return new CustomRefactoringPanel() {
   12.87 -            @Override
   12.88 -            public void initialize() {
   12.89 -                panel.initialize();
   12.90 -            }
   12.91 -            @Override
   12.92 -            public Component getComponent() {
   12.93 -                if (panel == null) {
   12.94 -                    panel = new ReplaceConstructorWithFactory(parent);
   12.95 -                }
   12.96 -                return panel;
   12.97 -            }
   12.98 -        };
   12.99 -    }
  12.100 -
  12.101 -    @Override
  12.102 -    public Problem setParameters() {
  12.103 -        this.factoryName = panel.getFactoryName();
  12.104 -        return null;
  12.105 -    }
  12.106 -
  12.107 -    @Override
  12.108 -    public Problem checkParameters() {
  12.109 -        String factoryName = this.factoryName != null ? this.factoryName : panel.getFactoryName();
  12.110 -        
  12.111 -        if (factoryName == null || factoryName.length() == 0) {
  12.112 -            return new Problem(true, "No factory method name specified.");
  12.113 -        }
  12.114 -        if (!SourceVersion.isIdentifier(factoryName)) {
  12.115 -            return new Problem(true, factoryName + " is not an identifier.");
  12.116 -        }
  12.117 -        return null;
  12.118 -    }
  12.119 -
  12.120 -    @Override
  12.121 -    public boolean hasParameters() {
  12.122 -        return true;
  12.123 -    }
  12.124 -
  12.125 -    @Override
  12.126 -    public AbstractRefactoring getRefactoring() {
  12.127 -        return new ReplaceConstructorRefactoring(constructor, factoryName);
  12.128 -    }
  12.129 -
  12.130 -    @Override
  12.131 -    public HelpCtx getHelpCtx() {
  12.132 -        return null;
  12.133 -    }
  12.134 -
  12.135 -}
    13.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/noconstructor/ReplaceConstructorWithFactory.form	Fri Feb 17 19:23:00 2012 +0100
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,58 +0,0 @@
    13.4 -<?xml version="1.1" encoding="UTF-8" ?>
    13.5 -
    13.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    13.7 -  <AuxValues>
    13.8 -    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
    13.9 -    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
   13.10 -    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
   13.11 -    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
   13.12 -    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
   13.13 -    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
   13.14 -    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   13.15 -    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   13.16 -    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   13.17 -  </AuxValues>
   13.18 -
   13.19 -  <Layout>
   13.20 -    <DimensionLayout dim="0">
   13.21 -      <Group type="103" groupAlignment="0" attributes="0">
   13.22 -          <Group type="102" alignment="0" attributes="0">
   13.23 -              <EmptySpace max="-2" attributes="0"/>
   13.24 -              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
   13.25 -              <EmptySpace max="-2" attributes="0"/>
   13.26 -              <Component id="nameField" min="-2" max="-2" attributes="0"/>
   13.27 -              <EmptySpace max="32767" attributes="0"/>
   13.28 -          </Group>
   13.29 -      </Group>
   13.30 -    </DimensionLayout>
   13.31 -    <DimensionLayout dim="1">
   13.32 -      <Group type="103" groupAlignment="0" attributes="0">
   13.33 -          <Group type="102" alignment="0" attributes="0">
   13.34 -              <EmptySpace max="-2" attributes="0"/>
   13.35 -              <Group type="103" groupAlignment="3" attributes="0">
   13.36 -                  <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
   13.37 -                  <Component id="nameField" alignment="3" min="-2" max="-2" attributes="0"/>
   13.38 -              </Group>
   13.39 -              <EmptySpace max="32767" attributes="0"/>
   13.40 -          </Group>
   13.41 -      </Group>
   13.42 -    </DimensionLayout>
   13.43 -  </Layout>
   13.44 -  <SubComponents>
   13.45 -    <Component class="javax.swing.JLabel" name="jLabel1">
   13.46 -      <Properties>
   13.47 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   13.48 -          <ResourceString bundle="org/netbeans/modules/jackpot30/refactoring/noconstructor/Bundle.properties" key="ReplaceConstructorWithFactory.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   13.49 -        </Property>
   13.50 -      </Properties>
   13.51 -    </Component>
   13.52 -    <Component class="javax.swing.JTextField" name="nameField">
   13.53 -      <Properties>
   13.54 -        <Property name="columns" type="int" value="15"/>
   13.55 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   13.56 -          <ResourceString bundle="org/netbeans/modules/jackpot30/refactoring/noconstructor/Bundle.properties" key="ReplaceConstructorWithFactory.nameField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   13.57 -        </Property>
   13.58 -      </Properties>
   13.59 -    </Component>
   13.60 -  </SubComponents>
   13.61 -</Form>
    14.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/noconstructor/ReplaceConstructorWithFactory.java	Fri Feb 17 19:23:00 2012 +0100
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,123 +0,0 @@
    14.4 -/*
    14.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    14.6 - *
    14.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
    14.8 - *
    14.9 - * The contents of this file are subject to the terms of either the GNU
   14.10 - * General Public License Version 2 only ("GPL") or the Common
   14.11 - * Development and Distribution License("CDDL") (collectively, the
   14.12 - * "License"). You may not use this file except in compliance with the
   14.13 - * License. You can obtain a copy of the License at
   14.14 - * http://www.netbeans.org/cddl-gplv2.html
   14.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   14.16 - * specific language governing permissions and limitations under the
   14.17 - * License.  When distributing the software, include this License Header
   14.18 - * Notice in each file and include the License file at
   14.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   14.20 - * particular file as subject to the "Classpath" exception as provided
   14.21 - * by Sun in the GPL Version 2 section of the License file that
   14.22 - * accompanied this code. If applicable, add the following below the
   14.23 - * License Header, with the fields enclosed by brackets [] replaced by
   14.24 - * your own identifying information:
   14.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   14.26 - *
   14.27 - * If you wish your version of this file to be governed by only the CDDL
   14.28 - * or only the GPL Version 2, indicate your decision by adding
   14.29 - * "[Contributor] elects to include this software in this distribution
   14.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   14.31 - * single choice of license, a recipient has the option to distribute
   14.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   14.33 - * to extend the choice of license to its licensees as provided above.
   14.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   14.35 - * Version 2 license, then the option applies only if the new code is
   14.36 - * made subject to such option by the copyright holder.
   14.37 - *
   14.38 - * Contributor(s):
   14.39 - *
   14.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
   14.41 - */
   14.42 -
   14.43 -package org.netbeans.modules.jackpot30.refactoring.noconstructor;
   14.44 -
   14.45 -import javax.swing.event.ChangeEvent;
   14.46 -import javax.swing.event.ChangeListener;
   14.47 -import javax.swing.event.DocumentEvent;
   14.48 -import javax.swing.event.DocumentListener;
   14.49 -import org.netbeans.api.annotations.common.NonNull;
   14.50 -
   14.51 -/**
   14.52 - *
   14.53 - * @author lahvac
   14.54 - */
   14.55 -public class ReplaceConstructorWithFactory extends javax.swing.JPanel {
   14.56 -
   14.57 -    public ReplaceConstructorWithFactory(final @NonNull ChangeListener parent) {
   14.58 -        initComponents();
   14.59 -        nameField.getDocument().addDocumentListener(new DocumentListener() {
   14.60 -            @Override
   14.61 -            public void insertUpdate(DocumentEvent e) {
   14.62 -                parent.stateChanged(new ChangeEvent(ReplaceConstructorWithFactory.this));
   14.63 -            }
   14.64 -            @Override
   14.65 -            public void removeUpdate(DocumentEvent e) {
   14.66 -                parent.stateChanged(new ChangeEvent(ReplaceConstructorWithFactory.this));
   14.67 -            }
   14.68 -            @Override
   14.69 -            public void changedUpdate(DocumentEvent e) {}
   14.70 -        });
   14.71 -    }
   14.72 -
   14.73 -    /** This method is called from within the constructor to
   14.74 -     * initialize the form.
   14.75 -     * WARNING: Do NOT modify this code. The content of this method is
   14.76 -     * always regenerated by the Form Editor.
   14.77 -     */
   14.78 -    @SuppressWarnings("unchecked")
   14.79 -    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
   14.80 -    private void initComponents() {
   14.81 -
   14.82 -        jLabel1 = new javax.swing.JLabel();
   14.83 -        nameField = new javax.swing.JTextField();
   14.84 -
   14.85 -        jLabel1.setText(org.openide.util.NbBundle.getMessage(ReplaceConstructorWithFactory.class, "ReplaceConstructorWithFactory.jLabel1.text")); // NOI18N
   14.86 -
   14.87 -        nameField.setColumns(15);
   14.88 -        nameField.setText(org.openide.util.NbBundle.getMessage(ReplaceConstructorWithFactory.class, "ReplaceConstructorWithFactory.nameField.text")); // NOI18N
   14.89 -
   14.90 -        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
   14.91 -        this.setLayout(layout);
   14.92 -        layout.setHorizontalGroup(
   14.93 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
   14.94 -            .addGroup(layout.createSequentialGroup()
   14.95 -                .addContainerGap()
   14.96 -                .addComponent(jLabel1)
   14.97 -                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
   14.98 -                .addComponent(nameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
   14.99 -                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  14.100 -        );
  14.101 -        layout.setVerticalGroup(
  14.102 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  14.103 -            .addGroup(layout.createSequentialGroup()
  14.104 -                .addContainerGap()
  14.105 -                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  14.106 -                    .addComponent(jLabel1)
  14.107 -                    .addComponent(nameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  14.108 -                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  14.109 -        );
  14.110 -    }// </editor-fold>//GEN-END:initComponents
  14.111 -
  14.112 -
  14.113 -    // Variables declaration - do not modify//GEN-BEGIN:variables
  14.114 -    private javax.swing.JLabel jLabel1;
  14.115 -    private javax.swing.JTextField nameField;
  14.116 -    // End of variables declaration//GEN-END:variables
  14.117 -
  14.118 -    public void initialize() {
  14.119 -        //TODO: more meaningful name(s)?
  14.120 -        nameField.setText("create");
  14.121 -    }
  14.122 -
  14.123 -    public String getFactoryName() {
  14.124 -        return nameField.getText();
  14.125 -    }
  14.126 -}
    15.1 --- a/bridges/refactoring/test/unit/src/org/netbeans/modules/jackpot30/refactoring/invertboolean/InvertBooleanRefactoringPluginImplTest.java	Fri Feb 17 19:23:00 2012 +0100
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,192 +0,0 @@
    15.4 -/*
    15.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    15.6 - *
    15.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    15.8 - *
    15.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   15.10 - * Other names may be trademarks of their respective owners.
   15.11 - *
   15.12 - * The contents of this file are subject to the terms of either the GNU
   15.13 - * General Public License Version 2 only ("GPL") or the Common
   15.14 - * Development and Distribution License("CDDL") (collectively, the
   15.15 - * "License"). You may not use this file except in compliance with the
   15.16 - * License. You can obtain a copy of the License at
   15.17 - * http://www.netbeans.org/cddl-gplv2.html
   15.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   15.19 - * specific language governing permissions and limitations under the
   15.20 - * License.  When distributing the software, include this License Header
   15.21 - * Notice in each file and include the License file at
   15.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   15.23 - * particular file as subject to the "Classpath" exception as provided
   15.24 - * by Oracle in the GPL Version 2 section of the License file that
   15.25 - * accompanied this code. If applicable, add the following below the
   15.26 - * License Header, with the fields enclosed by brackets [] replaced by
   15.27 - * your own identifying information:
   15.28 - * "Portions Copyrighted [year] [name of copyright owner]"
   15.29 - *
   15.30 - * If you wish your version of this file to be governed by only the CDDL
   15.31 - * or only the GPL Version 2, indicate your decision by adding
   15.32 - * "[Contributor] elects to include this software in this distribution
   15.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   15.34 - * single choice of license, a recipient has the option to distribute
   15.35 - * your version of this file under either the CDDL, the GPL Version 2 or
   15.36 - * to extend the choice of license to its licensees as provided above.
   15.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   15.38 - * Version 2 license, then the option applies only if the new code is
   15.39 - * made subject to such option by the copyright holder.
   15.40 - *
   15.41 - * Contributor(s):
   15.42 - *
   15.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
   15.44 - */
   15.45 -
   15.46 -package org.netbeans.modules.jackpot30.refactoring.invertboolean;
   15.47 -
   15.48 -import com.sun.source.tree.ClassTree;
   15.49 -import com.sun.source.tree.CompilationUnitTree;
   15.50 -import com.sun.source.tree.MethodTree;
   15.51 -import com.sun.source.tree.VariableTree;
   15.52 -import com.sun.source.util.TreePath;
   15.53 -import org.netbeans.api.java.source.CompilationController;
   15.54 -import org.netbeans.api.java.source.JavaSource;
   15.55 -import org.netbeans.api.java.source.SourceUtils;
   15.56 -import org.netbeans.api.java.source.Task;
   15.57 -import org.netbeans.api.java.source.TreePathHandle;
   15.58 -import org.netbeans.modules.jackpot30.spi.refactoring.JackpotBasedRefactoringTestBase;
   15.59 -import org.netbeans.modules.parsing.api.indexing.IndexingManager;
   15.60 -import org.netbeans.modules.parsing.impl.indexing.errors.TaskCache;
   15.61 -import org.netbeans.modules.refactoring.api.RefactoringSession;
   15.62 -import org.openide.filesystems.FileObject;
   15.63 -
   15.64 -/**
   15.65 - *
   15.66 - * @author lahvac
   15.67 - */
   15.68 -public class InvertBooleanRefactoringPluginImplTest extends JackpotBasedRefactoringTestBase {
   15.69 -
   15.70 -    public InvertBooleanRefactoringPluginImplTest(String name) {
   15.71 -        super(name);
   15.72 -    }
   15.73 -
   15.74 -    public void testInvertField1() throws Exception {
   15.75 -        writeFilesAndWaitForScan(src,
   15.76 -                                 new File("test/Test.java", "package test;\n public class Test {\n public boolean b = Boolean.getBoolean(\"\"); { b = Boolean.getBoolean(\"\"); if (b) System.err.println(1);\n } }\n"),
   15.77 -                                 new File("test/Use.java", "package test; public class Use { { new Test().b = Boolean.getBoolean(\"\"); if (new Test().b) System.err.println(1);\n } }")
   15.78 -                                 );
   15.79 -
   15.80 -        performFieldTest();
   15.81 -
   15.82 -        assertContent(src,
   15.83 -                      new File("test/Test.java", "package test;\n public class Test {\n public boolean c = !Boolean.getBoolean(\"\"); { c = !Boolean.getBoolean(\"\"); if (!c) System.err.println(1);\n } }\n"),
   15.84 -                      new File("test/Use.java", "package test; public class Use { { new Test().c = !Boolean.getBoolean(\"\"); if (!new Test().c) System.err.println(1);\n } }")/*,
   15.85 -                      new File("META-INF/upgrade/test.Test.hint", "new test.Test($1, $2) :: $1 instanceof int && $2 instanceof java.util.List<java.lang.String> => test.Test.create($1, $2);;")*/
   15.86 -                     );
   15.87 -    }
   15.88 -
   15.89 -    public void testInvertField2() throws Exception {
   15.90 -        writeFilesAndWaitForScan(src,
   15.91 -                                 new File("test/Test.java", "package test;\n public class Test {\n public boolean b = Integer.getInteger(\"\") == 0; { b = Integer.getInteger(\"\") != 0; b = !b; boolean n1 = false; b = !n1; b = !(n1); b = (!n1); b = true; b = false; System.err.println(!b);\n } }\n")
   15.92 -                                 );
   15.93 -
   15.94 -        performFieldTest();
   15.95 -
   15.96 -        assertContent(src,
   15.97 -                      new File("test/Test.java", "package test;\n public class Test {\n public boolean c = Integer.getInteger(\"\") != 0; { c = Integer.getInteger(\"\") == 0; c = !c; boolean n1 = false; c = n1; c = n1; c = n1; c = false; c = true; System.err.println(c);\n } }\n")/*,
   15.98 -                      new File("META-INF/upgrade/test.Test.hint", "new test.Test($1, $2) :: $1 instanceof int && $2 instanceof java.util.List<java.lang.String> => test.Test.create($1, $2);;")*/
   15.99 -                     );
  15.100 -    }
  15.101 -
  15.102 -    public void testInvertFieldStatic() throws Exception {
  15.103 -        writeFilesAndWaitForScan(src,
  15.104 -                                 new File("test/Test.java", "package test;\n public class Test {\n public static boolean b = true; static { b = Integer.getInteger(\"\") != 0; \n } }\n")
  15.105 -                                 );
  15.106 -
  15.107 -        performFieldTest();
  15.108 -
  15.109 -        assertContent(src,
  15.110 -                      new File("test/Test.java", "package test;\n public class Test {\n public static boolean c = false; static { " + /*XXX:*/ "Test." + "c = Integer.getInteger(\"\") == 0; \n } }\n")/*,
  15.111 -                      new File("META-INF/upgrade/test.Test.hint", "new test.Test($1, $2) :: $1 instanceof int && $2 instanceof java.util.List<java.lang.String> => test.Test.create($1, $2);;")*/
  15.112 -                     );
  15.113 -    }
  15.114 -
  15.115 -    public void testInvertMethod() throws Exception {
  15.116 -        writeFilesAndWaitForScan(src,
  15.117 -                                 new File("test/Test.java", "package test;\n public class Test {\n public boolean b() { if (true) return Boolean.getBoolean(\"\"); else return false; } { if (b()) System.err.println(1); \n } }\n"),
  15.118 -                                 new File("test/Use.java", "package test; public class Use { { if (!new Test().b()) System.err.println(1);\n } }")
  15.119 -                                 );
  15.120 -
  15.121 -        performMethodTest();
  15.122 -
  15.123 -        assertContent(src,
  15.124 -                      new File("test/Test.java", "package test;\n public class Test {\n public boolean c() { if (true) return !Boolean.getBoolean(\"\"); else return true; } { if (!c()) System.err.println(1); \n } }\n"),
  15.125 -                      new File("test/Use.java", "package test; public class Use { { if (new Test().c()) System.err.println(1);\n } }")/*,
  15.126 -                      new File("META-INF/upgrade/test.Test.hint", "new test.Test($1, $2) :: $1 instanceof int && $2 instanceof java.util.List<java.lang.String> => test.Test.create($1, $2);;")*/
  15.127 -                     );
  15.128 -    }
  15.129 -
  15.130 -    public void testInvertMethodStaticTypeParam() throws Exception {
  15.131 -        writeFilesAndWaitForScan(src,
  15.132 -                                 new File("test/Test.java", "package test;\n public class Test {\n public static <T> boolean b(T t) { return true; } { if (Test.<String>b(null)) System.err.println(1); \n } }\n")
  15.133 -                                 );
  15.134 -
  15.135 -        performMethodTest();
  15.136 -
  15.137 -        assertContent(src,
  15.138 -                      new File("test/Test.java", "package test;\n public class Test {\n public static <T> boolean c(T t) { return false; } { if (!Test.<String>c(null)) System.err.println(1); \n } }\n")/*,
  15.139 -                      new File("META-INF/upgrade/test.Test.hint", "new test.Test($1, $2) :: $1 instanceof int && $2 instanceof java.util.List<java.lang.String> => test.Test.create($1, $2);;")*/
  15.140 -                     );
  15.141 -    }
  15.142 -
  15.143 -    private void performFieldTest() throws Exception {
  15.144 -        final InvertBooleanRefactoring[] r = new InvertBooleanRefactoring[1];
  15.145 -        FileObject testFile = src.getFileObject("test/Test.java");
  15.146 -
  15.147 -        JavaSource.forFileObject(testFile).runUserActionTask(new Task<CompilationController>() {
  15.148 -
  15.149 -            public void run(CompilationController parameter) throws Exception {
  15.150 -                parameter.toPhase(JavaSource.Phase.RESOLVED);
  15.151 -                CompilationUnitTree cut = parameter.getCompilationUnit();
  15.152 -
  15.153 -                VariableTree var = (VariableTree) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(1);
  15.154 -
  15.155 -                TreePath tp = TreePath.getPath(cut, var);
  15.156 -                r[0] = new InvertBooleanRefactoring(TreePathHandle.create(tp, parameter), "c");
  15.157 -            }
  15.158 -        }, true);
  15.159 -
  15.160 -        RefactoringSession rs = RefactoringSession.create("Session");
  15.161 -        r[0].prepare(rs);
  15.162 -        rs.doRefactoring(true);
  15.163 -
  15.164 -        IndexingManager.getDefault().refreshIndex(src.getURL(), null);
  15.165 -        SourceUtils.waitScanFinished();
  15.166 -        assertEquals(false, TaskCache.getDefault().isInError(src, true));
  15.167 -    }
  15.168 -
  15.169 -    private void performMethodTest() throws Exception {
  15.170 -        final InvertBooleanRefactoring[] r = new InvertBooleanRefactoring[1];
  15.171 -        FileObject testFile = src.getFileObject("test/Test.java");
  15.172 -
  15.173 -        JavaSource.forFileObject(testFile).runUserActionTask(new Task<CompilationController>() {
  15.174 -
  15.175 -            public void run(CompilationController parameter) throws Exception {
  15.176 -                parameter.toPhase(JavaSource.Phase.RESOLVED);
  15.177 -                CompilationUnitTree cut = parameter.getCompilationUnit();
  15.178 -
  15.179 -                MethodTree var = (MethodTree) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(1);
  15.180 -
  15.181 -                TreePath tp = TreePath.getPath(cut, var);
  15.182 -                r[0] = new InvertBooleanRefactoring(TreePathHandle.create(tp, parameter), "c");
  15.183 -            }
  15.184 -        }, true);
  15.185 -
  15.186 -        RefactoringSession rs = RefactoringSession.create("Session");
  15.187 -        r[0].prepare(rs);
  15.188 -        rs.doRefactoring(true);
  15.189 -
  15.190 -        IndexingManager.getDefault().refreshIndex(src.getURL(), null);
  15.191 -        SourceUtils.waitScanFinished();
  15.192 -        assertEquals(false, TaskCache.getDefault().isInError(src, true));
  15.193 -    }
  15.194 -
  15.195 -}
    16.1 --- a/bridges/refactoring/test/unit/src/org/netbeans/modules/jackpot30/refactoring/noconstructor/ReplaceConstructorRefactoringPluginImplTest.java	Fri Feb 17 19:23:00 2012 +0100
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,121 +0,0 @@
    16.4 -/*
    16.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    16.6 - *
    16.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
    16.8 - *
    16.9 - * The contents of this file are subject to the terms of either the GNU
   16.10 - * General Public License Version 2 only ("GPL") or the Common
   16.11 - * Development and Distribution License("CDDL") (collectively, the
   16.12 - * "License"). You may not use this file except in compliance with the
   16.13 - * License. You can obtain a copy of the License at
   16.14 - * http://www.netbeans.org/cddl-gplv2.html
   16.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   16.16 - * specific language governing permissions and limitations under the
   16.17 - * License.  When distributing the software, include this License Header
   16.18 - * Notice in each file and include the License file at
   16.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   16.20 - * particular file as subject to the "Classpath" exception as provided
   16.21 - * by Sun in the GPL Version 2 section of the License file that
   16.22 - * accompanied this code. If applicable, add the following below the
   16.23 - * License Header, with the fields enclosed by brackets [] replaced by
   16.24 - * your own identifying information:
   16.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   16.26 - *
   16.27 - * If you wish your version of this file to be governed by only the CDDL
   16.28 - * or only the GPL Version 2, indicate your decision by adding
   16.29 - * "[Contributor] elects to include this software in this distribution
   16.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   16.31 - * single choice of license, a recipient has the option to distribute
   16.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   16.33 - * to extend the choice of license to its licensees as provided above.
   16.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   16.35 - * Version 2 license, then the option applies only if the new code is
   16.36 - * made subject to such option by the copyright holder.
   16.37 - *
   16.38 - * Contributor(s):
   16.39 - *
   16.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
   16.41 - */
   16.42 -
   16.43 -package org.netbeans.modules.jackpot30.refactoring.noconstructor;
   16.44 -
   16.45 -import com.sun.source.tree.ClassTree;
   16.46 -import com.sun.source.tree.CompilationUnitTree;
   16.47 -import com.sun.source.tree.MethodTree;
   16.48 -import com.sun.source.util.TreePath;
   16.49 -import javax.swing.text.Document;
   16.50 -import org.junit.After;
   16.51 -import org.junit.AfterClass;
   16.52 -import org.junit.Before;
   16.53 -import org.junit.BeforeClass;
   16.54 -import org.junit.Test;
   16.55 -import static org.junit.Assert.*;
   16.56 -import org.netbeans.api.java.source.CompilationController;
   16.57 -import org.netbeans.api.java.source.JavaSource;
   16.58 -import org.netbeans.api.java.source.SourceUtils;
   16.59 -import org.netbeans.api.java.source.Task;
   16.60 -import org.netbeans.api.java.source.TreePathHandle;
   16.61 -import org.netbeans.modules.editor.NbEditorDocument;
   16.62 -import org.netbeans.modules.jackpot30.spi.refactoring.JackpotBasedRefactoring.Context;
   16.63 -import org.netbeans.modules.jackpot30.spi.refactoring.JackpotBasedRefactoringTestBase;
   16.64 -import org.netbeans.modules.parsing.api.Source;
   16.65 -import org.netbeans.modules.parsing.api.indexing.IndexingManager;
   16.66 -import org.netbeans.modules.parsing.impl.indexing.errors.TaskCache;
   16.67 -import org.netbeans.modules.refactoring.api.Problem;
   16.68 -import org.netbeans.modules.refactoring.api.RefactoringSession;
   16.69 -import org.openide.filesystems.FileObject;
   16.70 -import org.openide.text.FilterDocument;
   16.71 -
   16.72 -/**
   16.73 - *
   16.74 - * @author lahvac
   16.75 - */
   16.76 -public class ReplaceConstructorRefactoringPluginImplTest extends JackpotBasedRefactoringTestBase {
   16.77 -
   16.78 -    public ReplaceConstructorRefactoringPluginImplTest(String name) {
   16.79 -        super(name);
   16.80 -    }
   16.81 -
   16.82 -    public void testReplaceWithFactory() throws Exception {
   16.83 -        writeFilesAndWaitForScan(src,
   16.84 -                                 new File("test/Test.java", "package test;\n public class Test {\n public Test(int i, java.util.List<String> aa) {}\n private void t() {\n Test t = new Test(1, null);\n }\n }\n"),
   16.85 -                                 new File("test/Use.java", "package test; public class Use { private void t(java.util.List<String> ll) { Test t = new Test(-1, ll); } }")
   16.86 -                                 );
   16.87 -
   16.88 -        performTest("create");
   16.89 -
   16.90 -        assertContent(src,
   16.91 -                      new File("test/Test.java", "package test; public class Test { public static Test create(int i, java.util.List<String> aa) { return new Test(i, aa); } private Test(int i, java.util.List<String> aa) {} private void t() { Test t = Test.create(1, null); } } "),
   16.92 -                      new File("test/Use.java", "package test; public class Use { private void t(java.util.List<String> ll) { Test t = Test.create(-1, ll); } }"),
   16.93 -                      new File("META-INF/upgrade/test.Test.hint", "new test.Test($1, $2) :: $1 instanceof int && $2 instanceof java.util.List<java.lang.String> => test.Test.create($1, $2);;")
   16.94 -                     );
   16.95 -    }
   16.96 -
   16.97 -
   16.98 -    private void performTest(final String factoryName) throws Exception {
   16.99 -        final ReplaceConstructorRefactoring[] r = new ReplaceConstructorRefactoring[1];
  16.100 -        FileObject testFile = src.getFileObject("test/Test.java");
  16.101 -        
  16.102 -        JavaSource.forFileObject(testFile).runUserActionTask(new Task<CompilationController>() {
  16.103 -
  16.104 -            public void run(CompilationController parameter) throws Exception {
  16.105 -                parameter.toPhase(JavaSource.Phase.RESOLVED);
  16.106 -                CompilationUnitTree cut = parameter.getCompilationUnit();
  16.107 -
  16.108 -                MethodTree var = (MethodTree) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0);
  16.109 -
  16.110 -                TreePath tp = TreePath.getPath(cut, var);
  16.111 -                r[0] = new ReplaceConstructorRefactoring(TreePathHandle.create(tp, parameter), factoryName);
  16.112 -            }
  16.113 -        }, true);
  16.114 -
  16.115 -        RefactoringSession rs = RefactoringSession.create("Session");
  16.116 -        r[0].prepare(rs);
  16.117 -        rs.doRefactoring(true);
  16.118 -
  16.119 -        IndexingManager.getDefault().refreshIndex(src.getURL(), null);
  16.120 -        SourceUtils.waitScanFinished();
  16.121 -        assertEquals(false, TaskCache.getDefault().isInError(src, true));
  16.122 -    }
  16.123 -
  16.124 -}
  16.125 \ No newline at end of file