1 /*2 * The contents of this file are subject to the terms of the Common Development3 * and Distribution License (the License). You may not use this file except in4 * compliance with the License.5 *6 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html7 * or http://www.netbeans.org/cddl.txt.8 * 9 * When distributing Covered Code, include this CDDL Header Notice in each file10 * and include the License file at http://www.netbeans.org/cddl.txt.11 * If applicable, add the following below the CDDL Header, with the fields12 * enclosed by brackets [] replaced by your own identifying information:13 * "Portions Copyrighted [year] [name of copyright owner]"14 *15 * The Original Software is NetBeans. The Initial Developer of the Original16 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun17 * Microsystems, Inc. All Rights Reserved.18 */19 20 package org.netbeans.modules.websvc.wsitconf.refactoring;21 22 //import javax.jmi.reflect.RefObject;23 //import org.netbeans.modules.refactoring.api.AbstractRefactoring;24 //import org.netbeans.modules.refactoring.api.Problem;25 //import org.netbeans.modules.refactoring.spi.RefactoringElementsBag;26 //import org.netbeans.modules.refactoring.api.RenameRefactoring;27 //import org.netbeans.modules.refactoring.spi.RefactoringPlugin;28 import org.netbeans.modules.websvc.wsitconf.refactoring.WSITXmlRenameRefactoring;29 import org.netbeans.modules.websvc.wsitconf.util.Util;30 import org.openide.ErrorManager;31 32 /**33 *34 * @author Martin Grebac35 */36 public class WSITRenameRefactoringPlugin /*implements RefactoringPlugin*/ {37 38 /** This one is important creature - makes sure that cycles between plugins won't appear */39 private static ThreadLocal semafor = new ThreadLocal ();40 41 private WSITXmlRenameRefactoring wsitXmlRenameRefactor = new WSITXmlRenameRefactoring();42 43 // private final RenameRefactoring renameRefactoring;44 45 private static ErrorManager err = ErrorManager.getDefault().getInstance("org.netbeans.modules.websvc.wsitconf.refactoring.rename"); // NOI18N46 47 /**48 * Creates a new instance of WSITRenameRefactoringPlugin49 */50 // public WSITRenameRefactoringPlugin(AbstractRefactoring refactoring) {51 // this.renameRefactoring = (RenameRefactoring) refactoring;52 // }53 // 54 // /** Checks pre-conditions of the renameRefactoring and returns problems.55 // * @return Problems found or null (if no problems were identified)56 // */57 // public Problem preCheck() {58 // Problem problem = null;59 // if (semafor.get() == null) {60 // semafor.set(new Object());61 // 62 // RefObject refO = (RefObject) renameRefactoring.getRefactoredObject();63 // err.log("refO: " + refO);64 // 65 // Problem wsitXmlProblem = wsitXmlRenameRefactor.preCheck(refO);66 // problem = Util.addProblemsToEnd(problem, wsitXmlProblem);67 //68 // semafor.set(null);69 // }70 // return problem;71 // }72 // 73 // 74 // public Problem fastCheckParameters() {75 // Problem problem = null;76 // if (semafor.get() == null) {77 // semafor.set(new Object());78 // 79 // RefObject refO = (RefObject) renameRefactoring.getRefactoredObject();80 // err.log("refO: " + refO);81 // 82 // String newName = renameRefactoring.getNewName();83 // err.log("newname: " + newName);84 // 85 //// if (!Utility.isEjb30(refO)){86 //// Problem ejbJarProblem = getEjbJarRenameRefactor().fastCheckParameters(refO, newName);87 //// problem = Utility.addProblemsToEnd(problem, ejbJarProblem);88 //// }89 //// 90 //// Problem wsvcProblem = getWebservicesXmlRenameRefactor().fastCheckParameters(refO, newName);91 //// problem = Utility.addProblemsToEnd(problem, wsvcProblem);92 // 93 // semafor.set(null);94 // }95 // return problem;96 // }97 // 98 // /** Checks parameters of the renameRefactoring.99 // * @return Problems found or null (if no problems were identified)100 // */101 // public Problem checkParameters() {102 // Problem problem = null;103 // if (semafor.get() == null) {104 // semafor.set(new Object());105 // 106 // RefObject refO = (RefObject) renameRefactoring.getRefactoredObject();107 // err.log("refO: " + refO);108 // 109 // String newName = renameRefactoring.getNewName();110 // err.log("newname: " + newName);111 // 112 //// if (!Utility.isEjb30(refO)){113 //// Problem ejbJarProblem = getEjbJarRenameRefactor().checkParameters(refO, newName);114 //// problem = Utility.addProblemsToEnd(problem, ejbJarProblem);115 //// }116 //// 117 //// Problem wsvcProblem = getWebservicesXmlRenameRefactor().checkParameters(refO, newName);118 //// problem = Utility.addProblemsToEnd(problem, wsvcProblem);119 //// 120 // semafor.set(null);121 // }122 // return problem;123 // }124 // 125 // /** Collects renameRefactoring elements for a given renameRefactoring.126 // * @param refactoringElements Collection of renameRefactoring elements - the implementation of this method127 // * should add renameRefactoring elements to this collections. It should make no assumptions about the collection128 // * content.129 // * @return Problems found or null (if no problems were identified)130 // */131 // public Problem prepare(RefactoringElementsBag refactoringElements) {132 // Problem problem = null;133 // 134 // if (semafor.get() == null) {135 // semafor.set(new Object());136 // 137 // RefObject refO = (RefObject) renameRefactoring.getRefactoredObject();138 // err.log("refO: " + refO);139 // 140 // String newName = renameRefactoring.getNewName();141 // err.log("newname: " + newName);142 // 143 // Problem wsitXmlProblem = wsitXmlRenameRefactor.prepare(renameRefactoring, refO, newName, refactoringElements);144 // problem = Util.addProblemsToEnd(problem, wsitXmlProblem);145 // 146 // semafor.set(null);147 // }148 // 149 // err.log("Gonna return problem: " + problem);150 // return problem;151 // }152 // 153 // public void cancelRequest() { }154 // 155 }156