Cleanup, removing obsolete classes. "upgrade" is now part of the standard Inspect&Refactor dialog and global find usages is now part of "remoting".
1.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/RefactoringPluginFactoryImpl.java Wed Jan 04 15:14:57 2012 +0100
1.2 +++ b/api/src/org/netbeans/modules/jackpot30/impl/refactoring/RefactoringPluginFactoryImpl.java Tue Jan 10 17:51:52 2012 +0100
1.3 @@ -39,10 +39,6 @@
1.4
1.5 package org.netbeans.modules.jackpot30.impl.refactoring;
1.6
1.7 -import org.netbeans.modules.jackpot30.impl.refactoring.findusages.GlobalFindUsagesRefactoring;
1.8 -import org.netbeans.modules.jackpot30.impl.refactoring.findusages.GlobalFindUsagesRefactoringPlugin;
1.9 -import org.netbeans.modules.jackpot30.impl.refactoring.upgrade.UpgradeRefactoring;
1.10 -import org.netbeans.modules.jackpot30.impl.refactoring.upgrade.UpgradeRefactoringPlugin;
1.11 import org.netbeans.modules.refactoring.api.AbstractRefactoring;
1.12 import org.netbeans.modules.refactoring.spi.RefactoringPlugin;
1.13 import org.netbeans.modules.refactoring.spi.RefactoringPluginFactory;
1.14 @@ -54,10 +50,6 @@
1.15 public RefactoringPlugin createInstance(AbstractRefactoring refactoring) {
1.16 if (refactoring instanceof FindDuplicatesRefactoring) {
1.17 return new FindDuplicatesRefactoringPlugin((FindDuplicatesRefactoring) refactoring);
1.18 - } else if (refactoring instanceof UpgradeRefactoring) {
1.19 - return new UpgradeRefactoringPlugin((UpgradeRefactoring) refactoring);
1.20 - } else if (refactoring instanceof GlobalFindUsagesRefactoring) {
1.21 - return new GlobalFindUsagesRefactoringPlugin((GlobalFindUsagesRefactoring) refactoring);
1.22 }
1.23
1.24 return null;
2.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/findusages/GlobalFindUsagesAction.java Wed Jan 04 15:14:57 2012 +0100
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,118 +0,0 @@
2.4 -/*
2.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2.6 - *
2.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
2.8 - *
2.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
2.10 - * Other names may be trademarks of their respective owners.
2.11 - *
2.12 - * The contents of this file are subject to the terms of either the GNU
2.13 - * General Public License Version 2 only ("GPL") or the Common
2.14 - * Development and Distribution License("CDDL") (collectively, the
2.15 - * "License"). You may not use this file except in compliance with the
2.16 - * License. You can obtain a copy of the License at
2.17 - * http://www.netbeans.org/cddl-gplv2.html
2.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
2.19 - * specific language governing permissions and limitations under the
2.20 - * License. When distributing the software, include this License Header
2.21 - * Notice in each file and include the License file at
2.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
2.23 - * particular file as subject to the "Classpath" exception as provided
2.24 - * by Oracle in the GPL Version 2 section of the License file that
2.25 - * accompanied this code. If applicable, add the following below the
2.26 - * License Header, with the fields enclosed by brackets [] replaced by
2.27 - * your own identifying information:
2.28 - * "Portions Copyrighted [year] [name of copyright owner]"
2.29 - *
2.30 - * If you wish your version of this file to be governed by only the CDDL
2.31 - * or only the GPL Version 2, indicate your decision by adding
2.32 - * "[Contributor] elects to include this software in this distribution
2.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
2.34 - * single choice of license, a recipient has the option to distribute
2.35 - * your version of this file under either the CDDL, the GPL Version 2 or
2.36 - * to extend the choice of license to its licensees as provided above.
2.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
2.38 - * Version 2 license, then the option applies only if the new code is
2.39 - * made subject to such option by the copyright holder.
2.40 - *
2.41 - * Contributor(s):
2.42 - *
2.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
2.44 - */
2.45 -package org.netbeans.modules.jackpot30.impl.refactoring.findusages;
2.46 -
2.47 -import com.sun.source.util.TreePath;
2.48 -import java.awt.event.ActionEvent;
2.49 -import java.awt.event.ActionListener;
2.50 -import java.io.IOException;
2.51 -import javax.lang.model.element.Element;
2.52 -import javax.lang.model.element.ElementKind;
2.53 -import javax.swing.text.JTextComponent;
2.54 -import org.netbeans.api.editor.EditorRegistry;
2.55 -import org.netbeans.api.java.source.CompilationController;
2.56 -import org.netbeans.api.java.source.JavaSource;
2.57 -import org.netbeans.api.java.source.Task;
2.58 -import org.netbeans.modules.editor.NbEditorUtilities;
2.59 -import org.netbeans.modules.refactoring.spi.ui.UI;
2.60 -import org.openide.DialogDescriptor;
2.61 -import org.openide.DialogDisplayer;
2.62 -import org.openide.NotifyDescriptor.Message;
2.63 -import org.openide.awt.ActionRegistration;
2.64 -import org.openide.awt.ActionReference;
2.65 -import org.openide.awt.ActionReferences;
2.66 -import org.openide.awt.ActionID;
2.67 -import org.openide.filesystems.FileObject;
2.68 -import org.openide.util.Exceptions;
2.69 -import org.openide.util.NbBundle.Messages;
2.70 -
2.71 -@ActionID(category = "Refactoring",
2.72 -id = "org.netbeans.modules.jackpot30.impl.refactoring.findusages.GlobalFindUsagesAction")
2.73 -@ActionRegistration(displayName = "#CTL_GlobalFindUsagesAction")
2.74 -@ActionReferences({
2.75 - @ActionReference(path = "Menu/Edit", position = 2225)
2.76 -})
2.77 -@Messages("CTL_GlobalFindUsagesAction=Global Find Usages")
2.78 -public final class GlobalFindUsagesAction implements ActionListener {
2.79 -
2.80 - public void actionPerformed(ActionEvent e) {
2.81 - JTextComponent focusedComponent = EditorRegistry.lastFocusedComponent();
2.82 -
2.83 - if (focusedComponent == null) {
2.84 - return;
2.85 - }
2.86 -
2.87 - final int pos = focusedComponent.getCaretPosition();
2.88 - JavaSource js = JavaSource.forDocument(focusedComponent.getDocument());
2.89 -
2.90 - if (js == null) {
2.91 - return ;
2.92 - }
2.93 -
2.94 - final String[] script = new String[1];
2.95 -
2.96 - try {
2.97 - js.runUserActionTask(new Task<CompilationController>() {
2.98 - public void run(CompilationController parameter) throws Exception {
2.99 - parameter.toPhase(JavaSource.Phase.RESOLVED);
2.100 -
2.101 - TreePath sel = parameter.getTreeUtilities().pathFor(pos);
2.102 - Element el = parameter.getTrees().getElement(sel);
2.103 -
2.104 - if (el != null) {
2.105 - script[0] = PatternGenerator.generateFindUsagesScript(parameter, el);
2.106 - }
2.107 - }
2.108 - }, true);
2.109 - } catch (IOException ex) {
2.110 - Exceptions.printStackTrace(ex);
2.111 - }
2.112 -
2.113 - if (script[0] != null) {
2.114 - UI.openRefactoringUI(new GlobalFindUsagesRefactoringUI(new GlobalFindUsagesRefactoring(script[0])));
2.115 - } else {
2.116 - Message dd = new Message("Cannot perform Global Find Usages here", DialogDescriptor.INFORMATION_MESSAGE);
2.117 -
2.118 - DialogDisplayer.getDefault().notifyLater(dd);
2.119 - }
2.120 - }
2.121 -}
3.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/findusages/GlobalFindUsagesRefactoring.java Wed Jan 04 15:14:57 2012 +0100
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,61 +0,0 @@
3.4 -/*
3.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3.6 - *
3.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
3.8 - *
3.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
3.10 - * Other names may be trademarks of their respective owners.
3.11 - *
3.12 - * The contents of this file are subject to the terms of either the GNU
3.13 - * General Public License Version 2 only ("GPL") or the Common
3.14 - * Development and Distribution License("CDDL") (collectively, the
3.15 - * "License"). You may not use this file except in compliance with the
3.16 - * License. You can obtain a copy of the License at
3.17 - * http://www.netbeans.org/cddl-gplv2.html
3.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
3.19 - * specific language governing permissions and limitations under the
3.20 - * License. When distributing the software, include this License Header
3.21 - * Notice in each file and include the License file at
3.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
3.23 - * particular file as subject to the "Classpath" exception as provided
3.24 - * by Oracle in the GPL Version 2 section of the License file that
3.25 - * accompanied this code. If applicable, add the following below the
3.26 - * License Header, with the fields enclosed by brackets [] replaced by
3.27 - * your own identifying information:
3.28 - * "Portions Copyrighted [year] [name of copyright owner]"
3.29 - *
3.30 - * If you wish your version of this file to be governed by only the CDDL
3.31 - * or only the GPL Version 2, indicate your decision by adding
3.32 - * "[Contributor] elects to include this software in this distribution
3.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
3.34 - * single choice of license, a recipient has the option to distribute
3.35 - * your version of this file under either the CDDL, the GPL Version 2 or
3.36 - * to extend the choice of license to its licensees as provided above.
3.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
3.38 - * Version 2 license, then the option applies only if the new code is
3.39 - * made subject to such option by the copyright holder.
3.40 - *
3.41 - * Contributor(s):
3.42 - *
3.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
3.44 - */
3.45 -
3.46 -package org.netbeans.modules.jackpot30.impl.refactoring.findusages;
3.47 -
3.48 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
3.49 -import org.openide.util.lookup.Lookups;
3.50 -
3.51 -/**
3.52 - *
3.53 - * @author lahvac
3.54 - */
3.55 -public class GlobalFindUsagesRefactoring extends AbstractRefactoring {
3.56 -
3.57 - public final String script;
3.58 -
3.59 - public GlobalFindUsagesRefactoring(String script) {
3.60 - super(Lookups.singleton(script));
3.61 - this.script = script;
3.62 - }
3.63 -
3.64 -}
4.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/findusages/GlobalFindUsagesRefactoringPlugin.java Wed Jan 04 15:14:57 2012 +0100
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,109 +0,0 @@
4.4 -/*
4.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4.6 - *
4.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
4.8 - *
4.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
4.10 - * Other names may be trademarks of their respective owners.
4.11 - *
4.12 - * The contents of this file are subject to the terms of either the GNU
4.13 - * General Public License Version 2 only ("GPL") or the Common
4.14 - * Development and Distribution License("CDDL") (collectively, the
4.15 - * "License"). You may not use this file except in compliance with the
4.16 - * License. You can obtain a copy of the License at
4.17 - * http://www.netbeans.org/cddl-gplv2.html
4.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
4.19 - * specific language governing permissions and limitations under the
4.20 - * License. When distributing the software, include this License Header
4.21 - * Notice in each file and include the License file at
4.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
4.23 - * particular file as subject to the "Classpath" exception as provided
4.24 - * by Oracle in the GPL Version 2 section of the License file that
4.25 - * accompanied this code. If applicable, add the following below the
4.26 - * License Header, with the fields enclosed by brackets [] replaced by
4.27 - * your own identifying information:
4.28 - * "Portions Copyrighted [year] [name of copyright owner]"
4.29 - *
4.30 - * If you wish your version of this file to be governed by only the CDDL
4.31 - * or only the GPL Version 2, indicate your decision by adding
4.32 - * "[Contributor] elects to include this software in this distribution
4.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
4.34 - * single choice of license, a recipient has the option to distribute
4.35 - * your version of this file under either the CDDL, the GPL Version 2 or
4.36 - * to extend the choice of license to its licensees as provided above.
4.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
4.38 - * Version 2 license, then the option applies only if the new code is
4.39 - * made subject to such option by the copyright holder.
4.40 - *
4.41 - * Contributor(s):
4.42 - *
4.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
4.44 - */
4.45 -
4.46 -package org.netbeans.modules.jackpot30.impl.refactoring.findusages;
4.47 -
4.48 -import java.util.Collection;
4.49 -import java.util.LinkedList;
4.50 -import java.util.List;
4.51 -import org.netbeans.modules.jackpot30.impl.batch.EnhancedScopes;
4.52 -import org.netbeans.modules.jackpot30.remoting.api.RemoteIndex;
4.53 -import org.netbeans.modules.jackpot30.impl.refactoring.AbstractApplyHintsRefactoringPlugin;
4.54 -import org.netbeans.modules.java.hints.jackpot.impl.MessageImpl;
4.55 -import org.netbeans.modules.java.hints.jackpot.impl.batch.BatchSearch;
4.56 -import org.netbeans.modules.java.hints.jackpot.impl.batch.BatchSearch.BatchResult;
4.57 -import org.netbeans.modules.java.hints.jackpot.impl.batch.ProgressHandleWrapper;
4.58 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription;
4.59 -import org.netbeans.modules.java.hints.jackpot.spi.PatternConvertor;
4.60 -import org.netbeans.modules.refactoring.api.Problem;
4.61 -import org.netbeans.modules.refactoring.spi.RefactoringElementsBag;
4.62 -
4.63 -/**
4.64 - *
4.65 - * @author lahvac
4.66 - */
4.67 -public class GlobalFindUsagesRefactoringPlugin extends AbstractApplyHintsRefactoringPlugin {
4.68 -
4.69 - private final GlobalFindUsagesRefactoring refactoring;
4.70 -
4.71 - public GlobalFindUsagesRefactoringPlugin(GlobalFindUsagesRefactoring refactoring) {
4.72 - super(refactoring);
4.73 - this.refactoring = refactoring;
4.74 - }
4.75 -
4.76 - public Problem preCheck() {
4.77 - if (!RemoteIndex.loadIndices().iterator().hasNext()) {
4.78 - return new Problem(true, "No remote indices set-up, nothing to work on.");
4.79 - }
4.80 - return null;
4.81 - }
4.82 -
4.83 - public Problem checkParameters() {
4.84 - return null;
4.85 - }
4.86 -
4.87 - public Problem fastCheckParameters() {
4.88 - return null;
4.89 - }
4.90 -
4.91 - public Problem prepare(RefactoringElementsBag refactoringElements) {
4.92 - cancel.set(false);
4.93 -
4.94 - Collection<MessageImpl> problems = performSearchForPattern(refactoringElements);
4.95 -
4.96 - return messagesToProblem(problems);
4.97 - }
4.98 -
4.99 - private List<MessageImpl> performSearchForPattern(final RefactoringElementsBag refactoringElements) {
4.100 - ProgressHandleWrapper w = new ProgressHandleWrapper(this, 50, 50);
4.101 - Iterable<? extends HintDescription> hints = PatternConvertor.create(refactoring.script);
4.102 - BatchResult candidates = BatchSearch.findOccurrences(hints, EnhancedScopes.allRemote(), w);
4.103 - List<MessageImpl> problems = new LinkedList<MessageImpl>(candidates.problems);
4.104 -
4.105 - prepareElements(candidates, w, refactoringElements, true, problems);
4.106 -
4.107 - w.finish();
4.108 -
4.109 - return problems;
4.110 - }
4.111 -
4.112 -}
5.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/findusages/GlobalFindUsagesRefactoringUI.java Wed Jan 04 15:14:57 2012 +0100
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,108 +0,0 @@
5.4 -/*
5.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5.6 - *
5.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5.8 - *
5.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
5.10 - * Other names may be trademarks of their respective owners.
5.11 - *
5.12 - * The contents of this file are subject to the terms of either the GNU
5.13 - * General Public License Version 2 only ("GPL") or the Common
5.14 - * Development and Distribution License("CDDL") (collectively, the
5.15 - * "License"). You may not use this file except in compliance with the
5.16 - * License. You can obtain a copy of the License at
5.17 - * http://www.netbeans.org/cddl-gplv2.html
5.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
5.19 - * specific language governing permissions and limitations under the
5.20 - * License. When distributing the software, include this License Header
5.21 - * Notice in each file and include the License file at
5.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
5.23 - * particular file as subject to the "Classpath" exception as provided
5.24 - * by Oracle in the GPL Version 2 section of the License file that
5.25 - * accompanied this code. If applicable, add the following below the
5.26 - * License Header, with the fields enclosed by brackets [] replaced by
5.27 - * your own identifying information:
5.28 - * "Portions Copyrighted [year] [name of copyright owner]"
5.29 - *
5.30 - * If you wish your version of this file to be governed by only the CDDL
5.31 - * or only the GPL Version 2, indicate your decision by adding
5.32 - * "[Contributor] elects to include this software in this distribution
5.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
5.34 - * single choice of license, a recipient has the option to distribute
5.35 - * your version of this file under either the CDDL, the GPL Version 2 or
5.36 - * to extend the choice of license to its licensees as provided above.
5.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
5.38 - * Version 2 license, then the option applies only if the new code is
5.39 - * made subject to such option by the copyright holder.
5.40 - *
5.41 - * Contributor(s):
5.42 - *
5.43 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
5.44 - */
5.45 -
5.46 -package org.netbeans.modules.jackpot30.impl.refactoring.findusages;
5.47 -
5.48 -import java.awt.Component;
5.49 -import javax.swing.JPanel;
5.50 -import javax.swing.event.ChangeListener;
5.51 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
5.52 -import org.netbeans.modules.refactoring.api.Problem;
5.53 -import org.netbeans.modules.refactoring.spi.ui.CustomRefactoringPanel;
5.54 -import org.netbeans.modules.refactoring.spi.ui.RefactoringUI;
5.55 -import org.openide.util.HelpCtx;
5.56 -
5.57 -/**
5.58 - *
5.59 - * @author lahvac
5.60 - */
5.61 -public class GlobalFindUsagesRefactoringUI implements RefactoringUI {
5.62 -
5.63 - private final GlobalFindUsagesRefactoring globalFindUsagesRefactoring;
5.64 -
5.65 - GlobalFindUsagesRefactoringUI(GlobalFindUsagesRefactoring globalFindUsagesRefactoring) {
5.66 - this.globalFindUsagesRefactoring = globalFindUsagesRefactoring;
5.67 - }
5.68 -
5.69 - public String getName() {
5.70 - return "Global Find Usages";
5.71 - }
5.72 -
5.73 - public String getDescription() {
5.74 - return "Global Find Usages";
5.75 - }
5.76 -
5.77 - public boolean isQuery() {
5.78 - return true;
5.79 - }
5.80 -
5.81 - public CustomRefactoringPanel getPanel(ChangeListener parent) {
5.82 - return new CustomRefactoringPanel() {
5.83 - public void initialize() {
5.84 - }
5.85 - public Component getComponent() {
5.86 - return new JPanel();
5.87 - }
5.88 - };
5.89 - }
5.90 -
5.91 - public Problem setParameters() {
5.92 - return null;
5.93 - }
5.94 -
5.95 - public Problem checkParameters() {
5.96 - return null;
5.97 - }
5.98 -
5.99 - public boolean hasParameters() {
5.100 - return false;
5.101 - }
5.102 -
5.103 - public AbstractRefactoring getRefactoring() {
5.104 - return globalFindUsagesRefactoring;
5.105 - }
5.106 -
5.107 - public HelpCtx getHelpCtx() {
5.108 - return null;
5.109 - }
5.110 -
5.111 -}
6.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/upgrade/Bundle.properties Wed Jan 04 15:14:57 2012 +0100
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,4 +0,0 @@
6.4 -CTL_UpgradeAction=Upgrade...
6.5 -UpgradeRefactoringPanel.jLabel1.text=&Upgrade:
6.6 -ConfigureUpgrade.description.contentType=text/html
6.7 -UpgradeRefactoringPanel.configureButton.text=&Configure...
7.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/upgrade/CheckBoxRenderrer.java Wed Jan 04 15:14:57 2012 +0100
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,229 +0,0 @@
7.4 -/*
7.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
7.6 - *
7.7 - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
7.8 - *
7.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7.10 - * Other names may be trademarks of their respective owners.
7.11 - *
7.12 - * The contents of this file are subject to the terms of either the GNU
7.13 - * General Public License Version 2 only ("GPL") or the Common
7.14 - * Development and Distribution License("CDDL") (collectively, the
7.15 - * "License"). You may not use this file except in compliance with the
7.16 - * License. You can obtain a copy of the License at
7.17 - * http://www.netbeans.org/cddl-gplv2.html
7.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
7.19 - * specific language governing permissions and limitations under the
7.20 - * License. When distributing the software, include this License Header
7.21 - * Notice in each file and include the License file at
7.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
7.23 - * particular file as subject to the "Classpath" exception as provided
7.24 - * by Oracle in the GPL Version 2 section of the License file that
7.25 - * accompanied this code. If applicable, add the following below the
7.26 - * License Header, with the fields enclosed by brackets [] replaced by
7.27 - * your own identifying information:
7.28 - * "Portions Copyrighted [year] [name of copyright owner]"
7.29 - *
7.30 - * Contributor(s):
7.31 - *
7.32 - * The Original Software is NetBeans. The Initial Developer of the Original
7.33 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2010 Sun
7.34 - * Microsystems, Inc. All Rights Reserved.
7.35 - *
7.36 - * If you wish your version of this file to be governed by only the CDDL
7.37 - * or only the GPL Version 2, indicate your decision by adding
7.38 - * "[Contributor] elects to include this software in this distribution
7.39 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
7.40 - * single choice of license, a recipient has the option to distribute
7.41 - * your version of this file under either the CDDL, the GPL Version 2 or
7.42 - * to extend the choice of license to its licensees as provided above.
7.43 - * However, if you add GPL Version 2 code and therefore, elected the GPL
7.44 - * Version 2 license, then the option applies only if the new code is
7.45 - * made subject to such option by the copyright holder.
7.46 - */
7.47 -package org.netbeans.modules.jackpot30.impl.refactoring.upgrade;
7.48 -
7.49 -import java.awt.Component;
7.50 -import java.awt.Color;
7.51 -import java.awt.Rectangle;
7.52 -
7.53 -import java.io.Serializable;
7.54 -import java.util.Map;
7.55 -import javax.swing.JCheckBox;
7.56 -import javax.swing.JList;
7.57 -import javax.swing.ListCellRenderer;
7.58 -import javax.swing.UIManager;
7.59 -import javax.swing.border.Border;
7.60 -import javax.swing.border.EmptyBorder;
7.61 -import org.netbeans.modules.java.hints.jackpot.spi.HintMetadata;
7.62 -
7.63 -
7.64 -/*
7.65 - * XXX: copied from NetBeans' spellchecker module
7.66 - */
7.67 -public class CheckBoxRenderrer extends JCheckBox implements ListCellRenderer, Serializable {
7.68 -
7.69 - private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder (1, 1, 1, 1);
7.70 - private static final Border DEFAULT_NO_FOCUS_BORDER = new EmptyBorder (1, 1, 1, 1);
7.71 -
7.72 - protected static Border noFocusBorder = DEFAULT_NO_FOCUS_BORDER;
7.73 - private final Map<? extends HintMetadata,Boolean> enabled;
7.74 -
7.75 - public CheckBoxRenderrer (Map<? extends HintMetadata,Boolean> enabled) {
7.76 - super ();
7.77 - setOpaque (true);
7.78 - setBorder (getNoFocusBorder ());
7.79 - setName ("List.cellRenderer");
7.80 - this.enabled = enabled;
7.81 - }
7.82 -
7.83 - private Border getNoFocusBorder () {
7.84 - Border border = UIManager.getBorder("List.cellNoFocusBorder");
7.85 - if (System.getSecurityManager () != null) {
7.86 - if (border != null) {
7.87 - return border;
7.88 - }
7.89 - return SAFE_NO_FOCUS_BORDER;
7.90 - } else {
7.91 - if (border != null &&
7.92 - (noFocusBorder == null ||
7.93 - noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) {
7.94 - return border;
7.95 - }
7.96 - return noFocusBorder;
7.97 - }
7.98 - }
7.99 -
7.100 - public Component getListCellRendererComponent (
7.101 - JList list,
7.102 - Object value,
7.103 - int index,
7.104 - boolean isSelected,
7.105 - boolean cellHasFocus
7.106 - ) {
7.107 - setComponentOrientation (list.getComponentOrientation ());
7.108 -
7.109 - Color bg = null;
7.110 - Color fg = null;
7.111 -
7.112 - JList.DropLocation dropLocation = list.getDropLocation ();
7.113 - if (dropLocation != null && !dropLocation.isInsert () && dropLocation.getIndex () == index) {
7.114 -
7.115 - bg = UIManager.getColor("List.dropCellBackground");
7.116 - fg = UIManager.getColor("List.dropCellForeground");
7.117 -
7.118 - isSelected = true;
7.119 - }
7.120 -
7.121 - if (isSelected) {
7.122 - setBackground (bg == null ? list.getSelectionBackground () : bg);
7.123 - setForeground (fg == null ? list.getSelectionForeground () : fg);
7.124 - } else {
7.125 - setBackground (list.getBackground ());
7.126 - setForeground (list.getForeground ());
7.127 - }
7.128 -
7.129 - HintMetadata hm = (HintMetadata) value;
7.130 - setText (hm.displayName);
7.131 - setSelected (enabled.get(hm));
7.132 -
7.133 - setEnabled (list.isEnabled ());
7.134 - setFont (list.getFont ());
7.135 -
7.136 - Border border = null;
7.137 - if (cellHasFocus) {
7.138 - if (isSelected) {
7.139 - border = UIManager.getBorder("List.focusSelectedCellHighlightBorder");
7.140 - }
7.141 - if (border == null) {
7.142 - border = UIManager.getBorder("List.focusCellHighlightBorder");
7.143 - }
7.144 - } else {
7.145 - border = getNoFocusBorder ();
7.146 - }
7.147 - setBorder (border);
7.148 -
7.149 - return this;
7.150 - }
7.151 -
7.152 - @Override
7.153 - public boolean isOpaque () {
7.154 - Color back = getBackground ();
7.155 - Component p = getParent ();
7.156 - if (p != null) {
7.157 - p = p.getParent ();
7.158 - }
7.159 - // p should now be the JList.
7.160 - boolean colorMatch = (back != null) && (p != null) &&
7.161 - back.equals (p.getBackground ()) &&
7.162 - p.isOpaque ();
7.163 - return !colorMatch && super.isOpaque ();
7.164 - }
7.165 -
7.166 - @Override
7.167 - public void validate () {
7.168 - }
7.169 -
7.170 - @Override
7.171 - public void invalidate () {
7.172 - }
7.173 -
7.174 - @Override
7.175 - public void repaint () {
7.176 - }
7.177 -
7.178 - @Override
7.179 - public void revalidate () {
7.180 - }
7.181 -
7.182 - @Override
7.183 - public void repaint (long tm, int x, int y, int width, int height) {
7.184 - }
7.185 -
7.186 - @Override
7.187 - public void repaint (Rectangle r) {
7.188 - }
7.189 -
7.190 - @Override
7.191 - protected void firePropertyChange (String propertyName, Object oldValue, Object newValue) {
7.192 - // Strings get interned...
7.193 - if (propertyName == "text" || ((propertyName == "font" || propertyName == "foreground") &&
7.194 - oldValue != newValue &&
7.195 - getClientProperty (javax.swing.plaf.basic.BasicHTML.propertyKey) != null)
7.196 - ) {
7.197 - super.firePropertyChange (propertyName, oldValue, newValue);
7.198 - }
7.199 - }
7.200 -
7.201 - @Override
7.202 - public void firePropertyChange (String propertyName, byte oldValue, byte newValue) {
7.203 - }
7.204 -
7.205 - @Override
7.206 - public void firePropertyChange (String propertyName, char oldValue, char newValue) {
7.207 - }
7.208 -
7.209 - @Override
7.210 - public void firePropertyChange (String propertyName, short oldValue, short newValue) {
7.211 - }
7.212 -
7.213 - @Override
7.214 - public void firePropertyChange (String propertyName, int oldValue, int newValue) {
7.215 - }
7.216 -
7.217 - @Override
7.218 - public void firePropertyChange (String propertyName, long oldValue, long newValue) {
7.219 - }
7.220 -
7.221 - @Override
7.222 - public void firePropertyChange (String propertyName, float oldValue, float newValue) {
7.223 - }
7.224 -
7.225 - @Override
7.226 - public void firePropertyChange (String propertyName, double oldValue, double newValue) {
7.227 - }
7.228 -
7.229 - @Override
7.230 - public void firePropertyChange (String propertyName, boolean oldValue, boolean newValue) {
7.231 - }
7.232 -}
8.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/upgrade/ConfigureUpgrade.form Wed Jan 04 15:14:57 2012 +0100
8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
8.3 @@ -1,75 +0,0 @@
8.4 -<?xml version="1.1" encoding="UTF-8" ?>
8.5 -
8.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
8.7 - <AuxValues>
8.8 - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
8.9 - <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
8.10 - <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
8.11 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
8.12 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
8.13 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
8.14 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
8.15 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
8.16 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
8.17 - </AuxValues>
8.18 -
8.19 - <Layout>
8.20 - <DimensionLayout dim="0">
8.21 - <Group type="103" groupAlignment="0" attributes="0">
8.22 - <Group type="102" alignment="1" attributes="0">
8.23 - <EmptySpace max="-2" attributes="0"/>
8.24 - <Group type="103" groupAlignment="1" attributes="0">
8.25 - <Component id="jScrollPane2" alignment="0" pref="376" max="32767" attributes="0"/>
8.26 - <Component id="jScrollPane1" alignment="0" pref="376" max="32767" attributes="0"/>
8.27 - </Group>
8.28 - <EmptySpace max="-2" attributes="0"/>
8.29 - </Group>
8.30 - </Group>
8.31 - </DimensionLayout>
8.32 - <DimensionLayout dim="1">
8.33 - <Group type="103" groupAlignment="0" attributes="0">
8.34 - <Group type="102" alignment="0" attributes="0">
8.35 - <EmptySpace max="-2" attributes="0"/>
8.36 - <Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
8.37 - <EmptySpace type="unrelated" max="-2" attributes="0"/>
8.38 - <Component id="jScrollPane2" pref="133" max="32767" attributes="0"/>
8.39 - <EmptySpace max="-2" attributes="0"/>
8.40 - </Group>
8.41 - </Group>
8.42 - </DimensionLayout>
8.43 - </Layout>
8.44 - <SubComponents>
8.45 - <Container class="javax.swing.JScrollPane" name="jScrollPane1">
8.46 - <AuxValues>
8.47 - <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
8.48 - </AuxValues>
8.49 -
8.50 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
8.51 - <SubComponents>
8.52 - <Component class="javax.swing.JList" name="hintsList">
8.53 - <Properties>
8.54 - <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
8.55 - <Connection code="new DefaultListModel()" type="code"/>
8.56 - </Property>
8.57 - </Properties>
8.58 - </Component>
8.59 - </SubComponents>
8.60 - </Container>
8.61 - <Container class="javax.swing.JScrollPane" name="jScrollPane2">
8.62 - <AuxValues>
8.63 - <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
8.64 - </AuxValues>
8.65 -
8.66 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
8.67 - <SubComponents>
8.68 - <Component class="javax.swing.JEditorPane" name="description">
8.69 - <Properties>
8.70 - <Property name="contentType" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
8.71 - <ResourceString bundle="org/netbeans/modules/jackpot30/impl/refactoring/upgrade/Bundle.properties" key="ConfigureUpgrade.description.contentType" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
8.72 - </Property>
8.73 - </Properties>
8.74 - </Component>
8.75 - </SubComponents>
8.76 - </Container>
8.77 - </SubComponents>
8.78 -</Form>
9.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/upgrade/ConfigureUpgrade.java Wed Jan 04 15:14:57 2012 +0100
9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
9.3 @@ -1,179 +0,0 @@
9.4 -/*
9.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
9.6 - *
9.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
9.8 - *
9.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
9.10 - * Other names may be trademarks of their respective owners.
9.11 - *
9.12 - * The contents of this file are subject to the terms of either the GNU
9.13 - * General Public License Version 2 only ("GPL") or the Common
9.14 - * Development and Distribution License("CDDL") (collectively, the
9.15 - * "License"). You may not use this file except in compliance with the
9.16 - * License. You can obtain a copy of the License at
9.17 - * http://www.netbeans.org/cddl-gplv2.html
9.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
9.19 - * specific language governing permissions and limitations under the
9.20 - * License. When distributing the software, include this License Header
9.21 - * Notice in each file and include the License file at
9.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
9.23 - * particular file as subject to the "Classpath" exception as provided
9.24 - * by Oracle in the GPL Version 2 section of the License file that
9.25 - * accompanied this code. If applicable, add the following below the
9.26 - * License Header, with the fields enclosed by brackets [] replaced by
9.27 - * your own identifying information:
9.28 - * "Portions Copyrighted [year] [name of copyright owner]"
9.29 - *
9.30 - * If you wish your version of this file to be governed by only the CDDL
9.31 - * or only the GPL Version 2, indicate your decision by adding
9.32 - * "[Contributor] elects to include this software in this distribution
9.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
9.34 - * single choice of license, a recipient has the option to distribute
9.35 - * your version of this file under either the CDDL, the GPL Version 2 or
9.36 - * to extend the choice of license to its licensees as provided above.
9.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
9.38 - * Version 2 license, then the option applies only if the new code is
9.39 - * made subject to such option by the copyright holder.
9.40 - *
9.41 - * Contributor(s):
9.42 - *
9.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
9.44 - */
9.45 -
9.46 -package org.netbeans.modules.jackpot30.impl.refactoring.upgrade;
9.47 -
9.48 -import java.awt.Point;
9.49 -import java.awt.Rectangle;
9.50 -import java.awt.event.MouseAdapter;
9.51 -import java.awt.event.MouseEvent;
9.52 -import java.util.ArrayList;
9.53 -import java.util.Collections;
9.54 -import java.util.Comparator;
9.55 -import java.util.List;
9.56 -import java.util.Map;
9.57 -import javax.swing.DefaultListModel;
9.58 -import javax.swing.event.ListSelectionEvent;
9.59 -import javax.swing.event.ListSelectionListener;
9.60 -import org.netbeans.modules.java.hints.jackpot.spi.HintMetadata;
9.61 -
9.62 -/**
9.63 - *
9.64 - * @author lahvac
9.65 - */
9.66 -public class ConfigureUpgrade extends javax.swing.JPanel {
9.67 -
9.68 - private final UpgradeDescription upgrade;
9.69 - private final Map<HintMetadata,Boolean> enabled;
9.70 -
9.71 - public ConfigureUpgrade(UpgradeDescription upgrade) {
9.72 - this.upgrade = upgrade;
9.73 -
9.74 - initComponents();
9.75 -
9.76 - final DefaultListModel model = new DefaultListModel();
9.77 -
9.78 - enabled = upgrade.getAllHints();
9.79 -
9.80 - List<HintMetadata> sorted = new ArrayList<HintMetadata>(enabled.keySet());
9.81 -
9.82 - Collections.sort(sorted, new Comparator<HintMetadata>() {
9.83 -
9.84 - public int compare(HintMetadata m1, HintMetadata m2) {
9.85 - return m1.displayName.compareToIgnoreCase(m2.displayName);
9.86 - }
9.87 - });
9.88 -
9.89 - for (HintMetadata hm : sorted) {
9.90 - model.addElement(hm);
9.91 - }
9.92 -
9.93 - hintsList.setModel(model);
9.94 - hintsList.setCellRenderer(new CheckBoxRenderrer(enabled));
9.95 - hintsList.addMouseListener(new MouseAdapter() {
9.96 - @Override
9.97 - public void mouseClicked(MouseEvent e) {
9.98 - Point p = e.getPoint();
9.99 - int index = hintsList.locationToIndex(p);
9.100 -
9.101 - if (index == (-1)) return;
9.102 -
9.103 - Rectangle r = hintsList.getCellBounds(index, index);
9.104 -
9.105 - if (r != null) {
9.106 - r.width = r.height;
9.107 -
9.108 - if (r.contains(p)) {
9.109 - HintMetadata hm = (HintMetadata) model.get(index);
9.110 -
9.111 - enabled.put(hm, !enabled.get(hm));
9.112 - hintsList.repaint();
9.113 - }
9.114 - }
9.115 - }
9.116 - });
9.117 - hintsList.addListSelectionListener(new ListSelectionListener() {
9.118 - public void valueChanged(ListSelectionEvent e) {
9.119 - HintMetadata selected = (HintMetadata) hintsList.getSelectedValue();
9.120 -
9.121 - if (selected != null) {
9.122 - description.setText(selected.description);
9.123 - }
9.124 - }
9.125 - });
9.126 - }
9.127 -
9.128 - void store() {
9.129 - upgrade.putHintStates(enabled);
9.130 - }
9.131 -
9.132 - /** This method is called from within the constructor to
9.133 - * initialize the form.
9.134 - * WARNING: Do NOT modify this code. The content of this method is
9.135 - * always regenerated by the Form Editor.
9.136 - */
9.137 - @SuppressWarnings("unchecked")
9.138 - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
9.139 - private void initComponents() {
9.140 -
9.141 - jScrollPane1 = new javax.swing.JScrollPane();
9.142 - hintsList = new javax.swing.JList();
9.143 - jScrollPane2 = new javax.swing.JScrollPane();
9.144 - description = new javax.swing.JEditorPane();
9.145 -
9.146 - hintsList.setModel(new DefaultListModel());
9.147 - jScrollPane1.setViewportView(hintsList);
9.148 -
9.149 - description.setContentType(org.openide.util.NbBundle.getMessage(ConfigureUpgrade.class, "ConfigureUpgrade.description.contentType")); // NOI18N
9.150 - jScrollPane2.setViewportView(description);
9.151 -
9.152 - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
9.153 - this.setLayout(layout);
9.154 - layout.setHorizontalGroup(
9.155 - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
9.156 - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
9.157 - .addContainerGap()
9.158 - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
9.159 - .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
9.160 - .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE))
9.161 - .addContainerGap())
9.162 - );
9.163 - layout.setVerticalGroup(
9.164 - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
9.165 - .addGroup(layout.createSequentialGroup()
9.166 - .addContainerGap()
9.167 - .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
9.168 - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
9.169 - .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
9.170 - .addContainerGap())
9.171 - );
9.172 - }// </editor-fold>//GEN-END:initComponents
9.173 -
9.174 -
9.175 - // Variables declaration - do not modify//GEN-BEGIN:variables
9.176 - private javax.swing.JEditorPane description;
9.177 - private javax.swing.JList hintsList;
9.178 - private javax.swing.JScrollPane jScrollPane1;
9.179 - private javax.swing.JScrollPane jScrollPane2;
9.180 - // End of variables declaration//GEN-END:variables
9.181 -
9.182 -}
10.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/upgrade/UpgradeAction.java Wed Jan 04 15:14:57 2012 +0100
10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
10.3 @@ -1,53 +0,0 @@
10.4 -/*
10.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
10.6 - *
10.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
10.8 - *
10.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
10.10 - * Other names may be trademarks of their respective owners.
10.11 - *
10.12 - * The contents of this file are subject to the terms of either the GNU
10.13 - * General Public License Version 2 only ("GPL") or the Common
10.14 - * Development and Distribution License("CDDL") (collectively, the
10.15 - * "License"). You may not use this file except in compliance with the
10.16 - * License. You can obtain a copy of the License at
10.17 - * http://www.netbeans.org/cddl-gplv2.html
10.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
10.19 - * specific language governing permissions and limitations under the
10.20 - * License. When distributing the software, include this License Header
10.21 - * Notice in each file and include the License file at
10.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
10.23 - * particular file as subject to the "Classpath" exception as provided
10.24 - * by Oracle in the GPL Version 2 section of the License file that
10.25 - * accompanied this code. If applicable, add the following below the
10.26 - * License Header, with the fields enclosed by brackets [] replaced by
10.27 - * your own identifying information:
10.28 - * "Portions Copyrighted [year] [name of copyright owner]"
10.29 - *
10.30 - * If you wish your version of this file to be governed by only the CDDL
10.31 - * or only the GPL Version 2, indicate your decision by adding
10.32 - * "[Contributor] elects to include this software in this distribution
10.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
10.34 - * single choice of license, a recipient has the option to distribute
10.35 - * your version of this file under either the CDDL, the GPL Version 2 or
10.36 - * to extend the choice of license to its licensees as provided above.
10.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
10.38 - * Version 2 license, then the option applies only if the new code is
10.39 - * made subject to such option by the copyright holder.
10.40 - *
10.41 - * Contributor(s):
10.42 - *
10.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
10.44 - */
10.45 -package org.netbeans.modules.jackpot30.impl.refactoring.upgrade;
10.46 -
10.47 -import java.awt.event.ActionEvent;
10.48 -import java.awt.event.ActionListener;
10.49 -import org.netbeans.modules.refactoring.spi.ui.UI;
10.50 -
10.51 -public final class UpgradeAction implements ActionListener {
10.52 -
10.53 - public void actionPerformed(ActionEvent e) {
10.54 - UI.openRefactoringUI(new UpgradeRefactoringUI());
10.55 - }
10.56 -}
11.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/upgrade/UpgradeDescription.java Wed Jan 04 15:14:57 2012 +0100
11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
11.3 @@ -1,202 +0,0 @@
11.4 -/*
11.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
11.6 - *
11.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
11.8 - *
11.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
11.10 - * Other names may be trademarks of their respective owners.
11.11 - *
11.12 - * The contents of this file are subject to the terms of either the GNU
11.13 - * General Public License Version 2 only ("GPL") or the Common
11.14 - * Development and Distribution License("CDDL") (collectively, the
11.15 - * "License"). You may not use this file except in compliance with the
11.16 - * License. You can obtain a copy of the License at
11.17 - * http://www.netbeans.org/cddl-gplv2.html
11.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
11.19 - * specific language governing permissions and limitations under the
11.20 - * License. When distributing the software, include this License Header
11.21 - * Notice in each file and include the License file at
11.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
11.23 - * particular file as subject to the "Classpath" exception as provided
11.24 - * by Oracle in the GPL Version 2 section of the License file that
11.25 - * accompanied this code. If applicable, add the following below the
11.26 - * License Header, with the fields enclosed by brackets [] replaced by
11.27 - * your own identifying information:
11.28 - * "Portions Copyrighted [year] [name of copyright owner]"
11.29 - *
11.30 - * If you wish your version of this file to be governed by only the CDDL
11.31 - * or only the GPL Version 2, indicate your decision by adding
11.32 - * "[Contributor] elects to include this software in this distribution
11.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
11.34 - * single choice of license, a recipient has the option to distribute
11.35 - * your version of this file under either the CDDL, the GPL Version 2 or
11.36 - * to extend the choice of license to its licensees as provided above.
11.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
11.38 - * Version 2 license, then the option applies only if the new code is
11.39 - * made subject to such option by the copyright holder.
11.40 - *
11.41 - * Contributor(s):
11.42 - *
11.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
11.44 - */
11.45 -
11.46 -package org.netbeans.modules.jackpot30.impl.refactoring.upgrade;
11.47 -
11.48 -import java.io.IOException;
11.49 -import java.io.InputStream;
11.50 -import java.io.OutputStream;
11.51 -import java.util.ArrayList;
11.52 -import java.util.Collection;
11.53 -import java.util.Collections;
11.54 -import java.util.HashSet;
11.55 -import java.util.LinkedHashMap;
11.56 -import java.util.LinkedList;
11.57 -import java.util.List;
11.58 -import java.util.Map;
11.59 -import java.util.Map.Entry;
11.60 -import java.util.ResourceBundle;
11.61 -import java.util.Set;
11.62 -import java.util.logging.Level;
11.63 -import java.util.logging.Logger;
11.64 -import org.codeviation.pojson.Pojson;
11.65 -import org.codeviation.pojson.Pojson.SuppressStoring;
11.66 -import org.netbeans.modules.java.hints.jackpot.impl.RulesManager;
11.67 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription;
11.68 -import org.netbeans.modules.java.hints.jackpot.spi.HintMetadata;
11.69 -import org.openide.filesystems.FileObject;
11.70 -import org.openide.filesystems.FileUtil;
11.71 -import org.openide.util.NbBundle;
11.72 -
11.73 -/**
11.74 - *
11.75 - * @author lahvac
11.76 - */
11.77 -public class UpgradeDescription {
11.78 -
11.79 - @SuppressStoring
11.80 - private final FileObject sourceFile;
11.81 - private final String upgradeName;
11.82 - private final String bundle;
11.83 - private final Collection<String> hints;
11.84 - private final Collection<String> disabledHints;
11.85 -
11.86 - private UpgradeDescription(FileObject sourceFile) {
11.87 - this.sourceFile = sourceFile;
11.88 - this.hints = new ArrayList<String>();
11.89 - this.disabledHints = new ArrayList<String>();
11.90 - this.upgradeName = null;
11.91 - this.bundle = null;
11.92 - }
11.93 -
11.94 - String getBundle() {
11.95 - return bundle;
11.96 - }
11.97 -
11.98 - String getUpgradeName() {
11.99 - return upgradeName;
11.100 - }
11.101 -
11.102 - Collection< String> getHintIds() {
11.103 - return hints;
11.104 - }
11.105 -
11.106 - public String getDisplayName() {
11.107 - ResourceBundle b = NbBundle.getBundle(bundle);
11.108 -
11.109 - return b.getString("DN_" + upgradeName);
11.110 - }
11.111 -
11.112 - public Iterable<? extends HintDescription> getEnabledHints() {
11.113 - List<HintDescription> result = new LinkedList<HintDescription>();
11.114 - Set<String> hints = new HashSet<String>(this.hints);
11.115 -
11.116 - for (Entry<HintMetadata, Collection<? extends HintDescription>> e : RulesManager.getInstance().allHints.entrySet()) {
11.117 - if (hints.contains(e.getKey().id)) {
11.118 - result.addAll(e.getValue());
11.119 - }
11.120 - }
11.121 -
11.122 - return result;
11.123 - }
11.124 -
11.125 - Map<HintMetadata, Boolean> getAllHints() {
11.126 - Map<HintMetadata, Boolean> result = new LinkedHashMap<HintMetadata, Boolean>();
11.127 - Set<String> hints = new HashSet<String>(this.hints);
11.128 - Set<String> disabledHints = new HashSet<String>(this.disabledHints);
11.129 -
11.130 - for (Entry<HintMetadata, Collection<? extends HintDescription>> e : RulesManager.getInstance().allHints.entrySet()) {
11.131 - if (hints.contains(e.getKey().id)) {
11.132 - result.put(e.getKey(), true);
11.133 - }
11.134 - if (disabledHints.contains(e.getKey().id)) {
11.135 - result.put(e.getKey(), false);
11.136 - }
11.137 - }
11.138 -
11.139 - return result;
11.140 - }
11.141 -
11.142 - void putHintStates(Map<HintMetadata, Boolean> enabled) {
11.143 - this.hints.clear();
11.144 - this.disabledHints.clear();
11.145 -
11.146 - for (Entry<HintMetadata, Boolean> e : enabled.entrySet()) {
11.147 - if (e.getValue()) {
11.148 - this.hints.add(e.getKey().id);
11.149 - } else {
11.150 - this.disabledHints.add(e.getKey().id);
11.151 - }
11.152 - }
11.153 - }
11.154 -
11.155 - void store() {
11.156 - OutputStream outs = null;
11.157 -
11.158 - try {
11.159 - outs = sourceFile.getOutputStream();
11.160 - Pojson.save(this, outs);
11.161 - } catch (IOException ex) {
11.162 - Logger.getLogger(UpgradeDescription.class.getName()).log(Level.FINE, null, ex);
11.163 - } finally {
11.164 - try {
11.165 - outs.close();
11.166 - } catch (IOException ex) {
11.167 - Logger.getLogger(UpgradeDescription.class.getName()).log(Level.FINE, null, ex);
11.168 - }
11.169 - }
11.170 - }
11.171 -
11.172 - public static UpgradeDescription create(FileObject file) {
11.173 - InputStream ins = null;
11.174 -
11.175 - try {
11.176 - ins = file.getInputStream();
11.177 - return Pojson.update(new UpgradeDescription(file), ins);
11.178 - } catch (IOException ex) {
11.179 - Logger.getLogger(UpgradeDescription.class.getName()).log(Level.FINE, null, ex);
11.180 - return null;
11.181 - } finally {
11.182 - try {
11.183 - ins.close();
11.184 - } catch (IOException ex) {
11.185 - Logger.getLogger(UpgradeDescription.class.getName()).log(Level.FINE, null, ex);
11.186 - }
11.187 - }
11.188 - }
11.189 -
11.190 - public static Iterable<? extends UpgradeDescription> create() {
11.191 - FileObject upgradeDir = FileUtil.getConfigFile("org-netbeans-modules-java-hints/upgrades");
11.192 -
11.193 - if (upgradeDir == null) return Collections.<UpgradeDescription>emptyList();
11.194 -
11.195 - List<UpgradeDescription> result = new LinkedList<UpgradeDescription>();
11.196 -
11.197 - for (FileObject file : upgradeDir.getChildren()) {
11.198 - if ("upgrade".equals(file.getExt())) {
11.199 - result.add(create(file));
11.200 - }
11.201 - }
11.202 -
11.203 - return result;
11.204 - }
11.205 -}
12.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/upgrade/UpgradeRefactoring.java Wed Jan 04 15:14:57 2012 +0100
12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
12.3 @@ -1,78 +0,0 @@
12.4 -/*
12.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
12.6 - *
12.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
12.8 - *
12.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
12.10 - * Other names may be trademarks of their respective owners.
12.11 - *
12.12 - * The contents of this file are subject to the terms of either the GNU
12.13 - * General Public License Version 2 only ("GPL") or the Common
12.14 - * Development and Distribution License("CDDL") (collectively, the
12.15 - * "License"). You may not use this file except in compliance with the
12.16 - * License. You can obtain a copy of the License at
12.17 - * http://www.netbeans.org/cddl-gplv2.html
12.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
12.19 - * specific language governing permissions and limitations under the
12.20 - * License. When distributing the software, include this License Header
12.21 - * Notice in each file and include the License file at
12.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
12.23 - * particular file as subject to the "Classpath" exception as provided
12.24 - * by Oracle in the GPL Version 2 section of the License file that
12.25 - * accompanied this code. If applicable, add the following below the
12.26 - * License Header, with the fields enclosed by brackets [] replaced by
12.27 - * your own identifying information:
12.28 - * "Portions Copyrighted [year] [name of copyright owner]"
12.29 - *
12.30 - * If you wish your version of this file to be governed by only the CDDL
12.31 - * or only the GPL Version 2, indicate your decision by adding
12.32 - * "[Contributor] elects to include this software in this distribution
12.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
12.34 - * single choice of license, a recipient has the option to distribute
12.35 - * your version of this file under either the CDDL, the GPL Version 2 or
12.36 - * to extend the choice of license to its licensees as provided above.
12.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
12.38 - * Version 2 license, then the option applies only if the new code is
12.39 - * made subject to such option by the copyright holder.
12.40 - *
12.41 - * Contributor(s):
12.42 - *
12.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
12.44 - */
12.45 -
12.46 -package org.netbeans.modules.jackpot30.impl.refactoring.upgrade;
12.47 -
12.48 -import org.netbeans.modules.java.hints.jackpot.impl.batch.BatchSearch.Scope;
12.49 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
12.50 -import org.openide.util.Lookup;
12.51 -
12.52 -/**
12.53 - *
12.54 - * @author lahvac
12.55 - */
12.56 -public class UpgradeRefactoring extends AbstractRefactoring {
12.57 -
12.58 - private UpgradeDescription upgrade;
12.59 - private Scope scope;
12.60 -
12.61 - public UpgradeRefactoring(Lookup source) {
12.62 - super(source);
12.63 - }
12.64 -
12.65 - public synchronized UpgradeDescription getUpgrade() {
12.66 - return upgrade;
12.67 - }
12.68 -
12.69 - public synchronized void setUpgrade(UpgradeDescription upgrade) {
12.70 - this.upgrade = upgrade;
12.71 - }
12.72 -
12.73 - public synchronized Scope getScope() {
12.74 - return scope;
12.75 - }
12.76 -
12.77 - public synchronized void setScope(Scope scope) {
12.78 - this.scope = scope;
12.79 - }
12.80 -
12.81 -}
13.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/upgrade/UpgradeRefactoringPanel.form Wed Jan 04 15:14:57 2012 +0100
13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
13.3 @@ -1,81 +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="true"/>
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" attributes="0">
13.23 - <EmptySpace max="-2" attributes="0"/>
13.24 - <Group type="103" groupAlignment="0" attributes="0">
13.25 - <Group type="102" alignment="0" attributes="0">
13.26 - <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
13.27 - <EmptySpace max="-2" attributes="0"/>
13.28 - <Component id="upgradeCombo" pref="507" max="32767" attributes="0"/>
13.29 - <EmptySpace max="-2" attributes="0"/>
13.30 - <Component id="configureButton" min="-2" max="-2" attributes="0"/>
13.31 - </Group>
13.32 - <Component id="scopesPanel" alignment="1" pref="709" max="32767" attributes="0"/>
13.33 - </Group>
13.34 - <EmptySpace max="-2" attributes="0"/>
13.35 - </Group>
13.36 - </Group>
13.37 - </DimensionLayout>
13.38 - <DimensionLayout dim="1">
13.39 - <Group type="103" groupAlignment="0" attributes="0">
13.40 - <Group type="102" alignment="0" attributes="0">
13.41 - <EmptySpace max="32767" attributes="0"/>
13.42 - <Group type="103" groupAlignment="3" attributes="0">
13.43 - <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
13.44 - <Component id="configureButton" alignment="3" min="-2" max="-2" attributes="0"/>
13.45 - <Component id="upgradeCombo" alignment="3" min="-2" max="-2" attributes="0"/>
13.46 - </Group>
13.47 - <EmptySpace type="unrelated" max="-2" attributes="0"/>
13.48 - <Component id="scopesPanel" min="-2" max="-2" attributes="0"/>
13.49 - </Group>
13.50 - </Group>
13.51 - </DimensionLayout>
13.52 - </Layout>
13.53 - <SubComponents>
13.54 - <Component class="javax.swing.JLabel" name="jLabel1">
13.55 - <Properties>
13.56 - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
13.57 - <ComponentRef name="upgradeCombo"/>
13.58 - </Property>
13.59 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
13.60 - <ResourceString bundle="org/netbeans/modules/jackpot30/impl/refactoring/upgrade/Bundle.properties" key="UpgradeRefactoringPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
13.61 - </Property>
13.62 - </Properties>
13.63 - </Component>
13.64 - <Component class="javax.swing.JComboBox" name="upgradeCombo">
13.65 - <Properties>
13.66 - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
13.67 - <StringArray count="0"/>
13.68 - </Property>
13.69 - </Properties>
13.70 - </Component>
13.71 - <Component class="org.netbeans.modules.jackpot30.impl.refactoring.ScopesPanel" name="scopesPanel">
13.72 - </Component>
13.73 - <Component class="javax.swing.JButton" name="configureButton">
13.74 - <Properties>
13.75 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
13.76 - <ResourceString bundle="org/netbeans/modules/jackpot30/impl/refactoring/upgrade/Bundle.properties" key="UpgradeRefactoringPanel.configureButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
13.77 - </Property>
13.78 - </Properties>
13.79 - <Events>
13.80 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="configureButtonActionPerformed"/>
13.81 - </Events>
13.82 - </Component>
13.83 - </SubComponents>
13.84 -</Form>
14.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/upgrade/UpgradeRefactoringPanel.java Wed Jan 04 15:14:57 2012 +0100
14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
14.3 @@ -1,180 +0,0 @@
14.4 -/*
14.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
14.6 - *
14.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
14.8 - *
14.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
14.10 - * Other names may be trademarks of their respective owners.
14.11 - *
14.12 - * The contents of this file are subject to the terms of either the GNU
14.13 - * General Public License Version 2 only ("GPL") or the Common
14.14 - * Development and Distribution License("CDDL") (collectively, the
14.15 - * "License"). You may not use this file except in compliance with the
14.16 - * License. You can obtain a copy of the License at
14.17 - * http://www.netbeans.org/cddl-gplv2.html
14.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
14.19 - * specific language governing permissions and limitations under the
14.20 - * License. When distributing the software, include this License Header
14.21 - * Notice in each file and include the License file at
14.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
14.23 - * particular file as subject to the "Classpath" exception as provided
14.24 - * by Oracle in the GPL Version 2 section of the License file that
14.25 - * accompanied this code. If applicable, add the following below the
14.26 - * License Header, with the fields enclosed by brackets [] replaced by
14.27 - * your own identifying information:
14.28 - * "Portions Copyrighted [year] [name of copyright owner]"
14.29 - *
14.30 - * If you wish your version of this file to be governed by only the CDDL
14.31 - * or only the GPL Version 2, indicate your decision by adding
14.32 - * "[Contributor] elects to include this software in this distribution
14.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
14.34 - * single choice of license, a recipient has the option to distribute
14.35 - * your version of this file under either the CDDL, the GPL Version 2 or
14.36 - * to extend the choice of license to its licensees as provided above.
14.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
14.38 - * Version 2 license, then the option applies only if the new code is
14.39 - * made subject to such option by the copyright holder.
14.40 - *
14.41 - * Contributor(s):
14.42 - *
14.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
14.44 - */
14.45 -
14.46 -package org.netbeans.modules.jackpot30.impl.refactoring.upgrade;
14.47 -
14.48 -import java.awt.Component;
14.49 -import javax.swing.DefaultComboBoxModel;
14.50 -import javax.swing.DefaultListCellRenderer;
14.51 -import javax.swing.JList;
14.52 -import javax.swing.event.ChangeListener;
14.53 -import org.netbeans.modules.java.hints.jackpot.impl.batch.BatchSearch.Scope;
14.54 -import org.openide.DialogDescriptor;
14.55 -import org.openide.DialogDisplayer;
14.56 -
14.57 -/**
14.58 - *
14.59 - * @author lahvac
14.60 - */
14.61 -public class UpgradeRefactoringPanel extends javax.swing.JPanel {
14.62 -
14.63 - private final ChangeListener changeListener;
14.64 -
14.65 - public UpgradeRefactoringPanel(ChangeListener changeListener) {
14.66 - this.changeListener = changeListener;
14.67 -
14.68 - initComponents();
14.69 -
14.70 - DefaultComboBoxModel m = new DefaultComboBoxModel();
14.71 -
14.72 - for (UpgradeDescription ud : UpgradeDescription.create()) {
14.73 - m.addElement(ud);
14.74 - }
14.75 -
14.76 - upgradeCombo.setModel(m);
14.77 - upgradeCombo.setRenderer(new RendererImpl());
14.78 -
14.79 - scopesPanel.setChangeListener(changeListener);
14.80 - }
14.81 -
14.82 - /** This method is called from within the constructor to
14.83 - * initialize the form.
14.84 - * WARNING: Do NOT modify this code. The content of this method is
14.85 - * always regenerated by the Form Editor.
14.86 - */
14.87 - @SuppressWarnings("unchecked")
14.88 - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
14.89 - private void initComponents() {
14.90 -
14.91 - jLabel1 = new javax.swing.JLabel();
14.92 - upgradeCombo = new javax.swing.JComboBox();
14.93 - scopesPanel = new org.netbeans.modules.jackpot30.impl.refactoring.ScopesPanel();
14.94 - configureButton = new javax.swing.JButton();
14.95 -
14.96 - jLabel1.setLabelFor(upgradeCombo);
14.97 - org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(UpgradeRefactoringPanel.class, "UpgradeRefactoringPanel.jLabel1.text")); // NOI18N
14.98 -
14.99 - org.openide.awt.Mnemonics.setLocalizedText(configureButton, org.openide.util.NbBundle.getMessage(UpgradeRefactoringPanel.class, "UpgradeRefactoringPanel.configureButton.text")); // NOI18N
14.100 - configureButton.addActionListener(new java.awt.event.ActionListener() {
14.101 - public void actionPerformed(java.awt.event.ActionEvent evt) {
14.102 - configureButtonActionPerformed(evt);
14.103 - }
14.104 - });
14.105 -
14.106 - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
14.107 - this.setLayout(layout);
14.108 - layout.setHorizontalGroup(
14.109 - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
14.110 - .addGroup(layout.createSequentialGroup()
14.111 - .addContainerGap()
14.112 - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
14.113 - .addGroup(layout.createSequentialGroup()
14.114 - .addComponent(jLabel1)
14.115 - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
14.116 - .addComponent(upgradeCombo, 0, 507, Short.MAX_VALUE)
14.117 - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
14.118 - .addComponent(configureButton))
14.119 - .addComponent(scopesPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 709, Short.MAX_VALUE))
14.120 - .addContainerGap())
14.121 - );
14.122 - layout.setVerticalGroup(
14.123 - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
14.124 - .addGroup(layout.createSequentialGroup()
14.125 - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
14.126 - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
14.127 - .addComponent(jLabel1)
14.128 - .addComponent(configureButton)
14.129 - .addComponent(upgradeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
14.130 - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
14.131 - .addComponent(scopesPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
14.132 - );
14.133 - }// </editor-fold>//GEN-END:initComponents
14.134 -
14.135 - private void configureButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_configureButtonActionPerformed
14.136 - UpgradeDescription upgrade = getUpgrade();
14.137 - ConfigureUpgrade configurePanel = new ConfigureUpgrade(upgrade);
14.138 - DialogDescriptor dd = new DialogDescriptor(configurePanel, "Configure Upgrade");
14.139 -
14.140 - if (DialogDisplayer.getDefault().notify(dd) == DialogDescriptor.OK_OPTION) {
14.141 - configurePanel.store();
14.142 - }
14.143 - }//GEN-LAST:event_configureButtonActionPerformed
14.144 -
14.145 -
14.146 - // Variables declaration - do not modify//GEN-BEGIN:variables
14.147 - private javax.swing.JButton configureButton;
14.148 - private javax.swing.JLabel jLabel1;
14.149 - private org.netbeans.modules.jackpot30.impl.refactoring.ScopesPanel scopesPanel;
14.150 - private javax.swing.JComboBox upgradeCombo;
14.151 - // End of variables declaration//GEN-END:variables
14.152 -
14.153 - UpgradeDescription getUpgrade() {
14.154 - return (UpgradeDescription) upgradeCombo.getSelectedItem();
14.155 - }
14.156 -
14.157 - public void setScope(Scope scope) {
14.158 - scopesPanel.setScope(scope);
14.159 - }
14.160 -
14.161 - public Scope getScope() {
14.162 - return scopesPanel.getScope();
14.163 - }
14.164 -
14.165 - void fillInFromSettings() {
14.166 - scopesPanel.fillInFromSettings();
14.167 - }
14.168 -
14.169 - void saveScopesCombo() {
14.170 - scopesPanel.saveScopesCombo();
14.171 - getUpgrade().store();
14.172 - }
14.173 -
14.174 - private static final class RendererImpl extends DefaultListCellRenderer {
14.175 - @Override
14.176 - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
14.177 - if (value instanceof UpgradeDescription) {
14.178 - value = ((UpgradeDescription) value).getDisplayName();
14.179 - }
14.180 - return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
14.181 - }
14.182 - }
14.183 -}
15.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/upgrade/UpgradeRefactoringPlugin.java Wed Jan 04 15:14:57 2012 +0100
15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
15.3 @@ -1,79 +0,0 @@
15.4 -/*
15.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
15.6 - *
15.7 - * Copyright 2010 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 2010 Sun Microsystems, Inc.
15.44 - */
15.45 -
15.46 -package org.netbeans.modules.jackpot30.impl.refactoring.upgrade;
15.47 -
15.48 -import org.netbeans.modules.jackpot30.impl.refactoring.AbstractApplyHintsRefactoringPlugin;
15.49 -import org.netbeans.modules.refactoring.api.Problem;
15.50 -import org.netbeans.modules.refactoring.spi.RefactoringElementsBag;
15.51 -
15.52 -/**
15.53 - *
15.54 - * @author lahvac
15.55 - */
15.56 -public class UpgradeRefactoringPlugin extends AbstractApplyHintsRefactoringPlugin {
15.57 -
15.58 - private final UpgradeRefactoring upgradeRefactoring;
15.59 -
15.60 - public UpgradeRefactoringPlugin(UpgradeRefactoring upgradeRefactoring) {
15.61 - super(upgradeRefactoring);
15.62 - this.upgradeRefactoring = upgradeRefactoring;
15.63 - }
15.64 -
15.65 - public Problem preCheck() {
15.66 - return null;
15.67 - }
15.68 -
15.69 - public Problem checkParameters() {
15.70 - return null;
15.71 - }
15.72 -
15.73 - public Problem fastCheckParameters() {
15.74 - return null;
15.75 - }
15.76 -
15.77 - public Problem prepare(RefactoringElementsBag refactoringElements) {
15.78 - cancel.set(false);
15.79 - return messagesToProblem(performApplyPattern(upgradeRefactoring.getUpgrade().getEnabledHints(), upgradeRefactoring.getScope(), refactoringElements));
15.80 - }
15.81 -
15.82 -}
16.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/refactoring/upgrade/UpgradeRefactoringUI.java Wed Jan 04 15:14:57 2012 +0100
16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
16.3 @@ -1,126 +0,0 @@
16.4 -/*
16.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
16.6 - *
16.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
16.8 - *
16.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
16.10 - * Other names may be trademarks of their respective owners.
16.11 - *
16.12 - * The contents of this file are subject to the terms of either the GNU
16.13 - * General Public License Version 2 only ("GPL") or the Common
16.14 - * Development and Distribution License("CDDL") (collectively, the
16.15 - * "License"). You may not use this file except in compliance with the
16.16 - * License. You can obtain a copy of the License at
16.17 - * http://www.netbeans.org/cddl-gplv2.html
16.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16.19 - * specific language governing permissions and limitations under the
16.20 - * License. When distributing the software, include this License Header
16.21 - * Notice in each file and include the License file at
16.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
16.23 - * particular file as subject to the "Classpath" exception as provided
16.24 - * by Oracle in the GPL Version 2 section of the License file that
16.25 - * accompanied this code. If applicable, add the following below the
16.26 - * License Header, with the fields enclosed by brackets [] replaced by
16.27 - * your own identifying information:
16.28 - * "Portions Copyrighted [year] [name of copyright owner]"
16.29 - *
16.30 - * If you wish your version of this file to be governed by only the CDDL
16.31 - * or only the GPL Version 2, indicate your decision by adding
16.32 - * "[Contributor] elects to include this software in this distribution
16.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
16.34 - * single choice of license, a recipient has the option to distribute
16.35 - * your version of this file under either the CDDL, the GPL Version 2 or
16.36 - * to extend the choice of license to its licensees as provided above.
16.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
16.38 - * Version 2 license, then the option applies only if the new code is
16.39 - * made subject to such option by the copyright holder.
16.40 - *
16.41 - * Contributor(s):
16.42 - *
16.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
16.44 - */
16.45 -
16.46 -package org.netbeans.modules.jackpot30.impl.refactoring.upgrade;
16.47 -
16.48 -import java.awt.Component;
16.49 -import javax.swing.event.ChangeListener;
16.50 -import org.netbeans.modules.java.hints.jackpot.impl.batch.BatchSearch.Scope;
16.51 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
16.52 -import org.netbeans.modules.refactoring.api.Problem;
16.53 -import org.netbeans.modules.refactoring.spi.ui.CustomRefactoringPanel;
16.54 -import org.netbeans.modules.refactoring.spi.ui.RefactoringUI;
16.55 -import org.openide.util.HelpCtx;
16.56 -import org.openide.util.Lookup;
16.57 -
16.58 -/**
16.59 - *
16.60 - * @author lahvac
16.61 - */
16.62 -public class UpgradeRefactoringUI implements RefactoringUI {
16.63 -
16.64 - private volatile UpgradeDescription upgrade;
16.65 - private volatile Scope scope;
16.66 - private final UpgradeRefactoring refactoring;
16.67 -
16.68 - public UpgradeRefactoringUI() {
16.69 - refactoring = new UpgradeRefactoring(Lookup.EMPTY);
16.70 - }
16.71 -
16.72 - public String getName() {
16.73 - return "Upgrade";
16.74 - }
16.75 -
16.76 - public String getDescription() {
16.77 - return "Upgrade";
16.78 - }
16.79 -
16.80 - public boolean isQuery() {
16.81 - return false;
16.82 - }
16.83 -
16.84 - private UpgradeRefactoringPanel panel;
16.85 -
16.86 - public CustomRefactoringPanel getPanel(final ChangeListener parent) {
16.87 - return new CustomRefactoringPanel() {
16.88 - public void initialize() {
16.89 - panel.fillInFromSettings();
16.90 -// panel.setPattern(FindDuplicatesRefactoringUI.this.pattern);
16.91 -// panel.setScope(scope);
16.92 -// panel.setVerify(verify);
16.93 - }
16.94 - public Component getComponent() {
16.95 - if (panel == null) {
16.96 - panel = new UpgradeRefactoringPanel(parent);
16.97 - }
16.98 -
16.99 - return panel;
16.100 - }
16.101 - };
16.102 - }
16.103 -
16.104 - public Problem setParameters() {
16.105 - this.upgrade = panel.getUpgrade();
16.106 - this.scope = panel.getScope();
16.107 - panel.saveScopesCombo();
16.108 - return null;
16.109 - }
16.110 -
16.111 - public Problem checkParameters() {
16.112 - return null;
16.113 - }
16.114 -
16.115 - public boolean hasParameters() {
16.116 - return true;
16.117 - }
16.118 -
16.119 - public AbstractRefactoring getRefactoring() {
16.120 - refactoring.setUpgrade(upgrade);
16.121 - refactoring.setScope(scope);
16.122 - return refactoring;
16.123 - }
16.124 -
16.125 - public HelpCtx getHelpCtx() {
16.126 - return null;
16.127 - }
16.128 -
16.129 -}
17.1 --- a/api/test/unit/src/org/netbeans/modules/jackpot30/impl/refactoring/upgrade/UpgradeDescriptionTest.java Wed Jan 04 15:14:57 2012 +0100
17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
17.3 @@ -1,80 +0,0 @@
17.4 -/*
17.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
17.6 - *
17.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
17.8 - *
17.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
17.10 - * Other names may be trademarks of their respective owners.
17.11 - *
17.12 - * The contents of this file are subject to the terms of either the GNU
17.13 - * General Public License Version 2 only ("GPL") or the Common
17.14 - * Development and Distribution License("CDDL") (collectively, the
17.15 - * "License"). You may not use this file except in compliance with the
17.16 - * License. You can obtain a copy of the License at
17.17 - * http://www.netbeans.org/cddl-gplv2.html
17.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
17.19 - * specific language governing permissions and limitations under the
17.20 - * License. When distributing the software, include this License Header
17.21 - * Notice in each file and include the License file at
17.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
17.23 - * particular file as subject to the "Classpath" exception as provided
17.24 - * by Oracle in the GPL Version 2 section of the License file that
17.25 - * accompanied this code. If applicable, add the following below the
17.26 - * License Header, with the fields enclosed by brackets [] replaced by
17.27 - * your own identifying information:
17.28 - * "Portions Copyrighted [year] [name of copyright owner]"
17.29 - *
17.30 - * If you wish your version of this file to be governed by only the CDDL
17.31 - * or only the GPL Version 2, indicate your decision by adding
17.32 - * "[Contributor] elects to include this software in this distribution
17.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
17.34 - * single choice of license, a recipient has the option to distribute
17.35 - * your version of this file under either the CDDL, the GPL Version 2 or
17.36 - * to extend the choice of license to its licensees as provided above.
17.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
17.38 - * Version 2 license, then the option applies only if the new code is
17.39 - * made subject to such option by the copyright holder.
17.40 - *
17.41 - * Contributor(s):
17.42 - *
17.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
17.44 - */
17.45 -
17.46 -package org.netbeans.modules.jackpot30.impl.refactoring.upgrade;
17.47 -
17.48 -import java.io.IOException;
17.49 -import java.io.OutputStream;
17.50 -import java.util.Arrays;
17.51 -import org.junit.Test;
17.52 -import static org.junit.Assert.*;
17.53 -import org.openide.filesystems.FileObject;
17.54 -import org.openide.filesystems.FileSystem;
17.55 -import org.openide.filesystems.FileUtil;
17.56 -
17.57 -/**
17.58 - *
17.59 - * @author lahvac
17.60 - */
17.61 -public class UpgradeDescriptionTest {
17.62 -
17.63 - public UpgradeDescriptionTest() {
17.64 - }
17.65 -
17.66 - @Test
17.67 - public void testCreate() throws IOException {
17.68 - String json = "{ \"upgradeName\" : \"foo\", \"bundle\" : \"bar/Bundle\", \"hints\" : [ \"1\", \"2\" ] }";
17.69 - FileSystem fs = FileUtil.createMemoryFileSystem();
17.70 - FileObject f = fs.getRoot().createData("test");
17.71 - OutputStream out = f.getOutputStream();
17.72 -
17.73 - out.write(json.getBytes("UTF-8"));
17.74 - out.close();
17.75 -
17.76 - UpgradeDescription ud = UpgradeDescription.create(f);
17.77 -
17.78 - assertEquals("bar/Bundle", ud.getBundle());
17.79 - assertEquals("foo", ud.getUpgradeName());
17.80 - assertEquals(Arrays.asList("1", "2"), ud.getHintIds());
17.81 - }
17.82 -
17.83 -}
17.84 \ No newline at end of file