Making more modern. Removing layers, using annotations. Replacing usage of SystemOption with Option category
1.1 --- a/accelerators.terminal/manifest.mf Mon Mar 05 08:56:11 2012 +0100
1.2 +++ b/accelerators.terminal/manifest.mf Mon Mar 05 09:32:36 2012 +0100
1.3 @@ -1,8 +1,4 @@
1.4 Manifest-Version: 1.0
1.5 OpenIDE-Module: org.netbeans.modules.accelerators.terminal
1.6 -OpenIDE-Module-Layer: org/netbeans/modules/accelerators/terminal/resources/layer.xml
1.7 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/accelerators/terminal/resources/Bundle.properties
1.8 -OpenIDE-Module-Specification-Version: 1.4
1.9 -
1.10 -Name: org/netbeans/modules/accelerators/terminal/RunTerminalAction.class
1.11 -OpenIDE-Module-Class: Action
1.12 +OpenIDE-Module-Specification-Version: 1.5
2.1 --- a/accelerators.terminal/nbproject/project.properties Mon Mar 05 08:56:11 2012 +0100
2.2 +++ b/accelerators.terminal/nbproject/project.properties Mon Mar 05 09:32:36 2012 +0100
2.3 @@ -40,4 +40,6 @@
2.4 #
2.5 # Contributor(s): Andrei Badea
2.6
2.7 +javac.compilerargs=-Xlint -Xlint:-serial
2.8 +javac.source=1.6
2.9 makenbm.override.license=LICENSE
3.1 --- a/accelerators.terminal/nbproject/project.xml Mon Mar 05 08:56:11 2012 +0100
3.2 +++ b/accelerators.terminal/nbproject/project.xml Mon Mar 05 09:32:36 2012 +0100
3.3 @@ -50,6 +50,15 @@
3.4 <code-name-base>org.netbeans.modules.accelerators.terminal</code-name-base>
3.5 <module-dependencies>
3.6 <dependency>
3.7 + <code-name-base>org.netbeans.modules.options.api</code-name-base>
3.8 + <build-prerequisite/>
3.9 + <compile-dependency/>
3.10 + <run-dependency>
3.11 + <release-version>1</release-version>
3.12 + <specification-version>1.25</specification-version>
3.13 + </run-dependency>
3.14 + </dependency>
3.15 + <dependency>
3.16 <code-name-base>org.netbeans.modules.projectapi</code-name-base>
3.17 <build-prerequisite/>
3.18 <compile-dependency/>
3.19 @@ -59,6 +68,14 @@
3.20 </run-dependency>
3.21 </dependency>
3.22 <dependency>
3.23 + <code-name-base>org.openide.awt</code-name-base>
3.24 + <build-prerequisite/>
3.25 + <compile-dependency/>
3.26 + <run-dependency>
3.27 + <specification-version>7.42</specification-version>
3.28 + </run-dependency>
3.29 + </dependency>
3.30 + <dependency>
3.31 <code-name-base>org.openide.dialogs</code-name-base>
3.32 <build-prerequisite/>
3.33 <compile-dependency/>
3.34 @@ -91,14 +108,6 @@
3.35 </run-dependency>
3.36 </dependency>
3.37 <dependency>
3.38 - <code-name-base>org.openide.options</code-name-base>
3.39 - <build-prerequisite/>
3.40 - <compile-dependency/>
3.41 - <run-dependency>
3.42 - <specification-version>6.2</specification-version>
3.43 - </run-dependency>
3.44 - </dependency>
3.45 - <dependency>
3.46 <code-name-base>org.openide.util</code-name-base>
3.47 <build-prerequisite/>
3.48 <compile-dependency/>
4.1 --- a/accelerators.terminal/src/org/netbeans/modules/accelerators/terminal/Bundle.properties Mon Mar 05 08:56:11 2012 +0100
4.2 +++ b/accelerators.terminal/src/org/netbeans/modules/accelerators/terminal/Bundle.properties Mon Mar 05 09:32:36 2012 +0100
4.3 @@ -44,12 +44,12 @@
4.4 LBL_TerminalOptions=Terminal
4.5
4.6 # TerminalOptionsBeanInfo
4.7 -LBL_TerminalCommand=Terminal Command
4.8 -HINT_TerminalCommand=What command to run to open a new terminal emulator (shell, command prompt).\
4.9 -Use a simple executable name or a full path. You can specify additional parameters.\
4.10 -Use %d as a placeholder that will be replaced by the proper working directory.
4.11 +LBL_TerminalCommand=Terminal &Command:
4.12 +HINT_TerminalCommand=Specify what command to run to open a new terminal emulator (shell, command prompt). Use a simple executable name or a full path. You can specify additional parameters. Use %d as a placeholder that will be replaced by the proper working directory.
4.13
4.14 # RunTerminalAction
4.15 LBL_RunTerminal=&Run Terminal
4.16 MSG_NoCommand=No terminal command specified. Use Tools -> Options -> Editing - Terminal Options to set a command.
4.17 MSG_Error=An error occured while running the terminal: {0}.
4.18 +TerminalPanelPanel.commandField.text=
4.19 +TerminalPanelPanel.rememberBox.text=&Remember the command?
5.1 --- a/accelerators.terminal/src/org/netbeans/modules/accelerators/terminal/RunTerminalAction.java Mon Mar 05 08:56:11 2012 +0100
5.2 +++ b/accelerators.terminal/src/org/netbeans/modules/accelerators/terminal/RunTerminalAction.java Mon Mar 05 09:32:36 2012 +0100
5.3 @@ -50,6 +50,10 @@
5.4 import java.util.logging.Logger;
5.5 import org.openide.DialogDisplayer;
5.6 import org.openide.NotifyDescriptor;
5.7 +import org.openide.awt.ActionID;
5.8 +import org.openide.awt.ActionReference;
5.9 +import org.openide.awt.ActionReferences;
5.10 +import org.openide.awt.ActionRegistration;
5.11 import org.openide.filesystems.FileObject;
5.12 import org.openide.filesystems.FileUtil;
5.13 import org.openide.nodes.Node;
5.14 @@ -61,6 +65,12 @@
5.15 *
5.16 * @author Andrei Badea
5.17 */
5.18 +@ActionID(id = "org.netbeans.modules.accelerators.terminal.RunTerminalAction", category = "Tools")
5.19 +@ActionRegistration(lazy = false, displayName = "#LBL_RunTerminal")
5.20 +@ActionReferences({
5.21 + @ActionReference(path = "Shortcuts", name = "DSO-Enter"),
5.22 + @ActionReference(path = "UI/ToolActions")
5.23 +})
5.24 public class RunTerminalAction extends NodeAction {
5.25
5.26 private static final Logger LOGGER = Logger.getLogger("org.netbeans.modules.accelerators.terminal"); // NOI18N
5.27 @@ -91,10 +101,18 @@
5.28 }
5.29
5.30 private void runTerminal(FileObject fo) {
5.31 - String command = TerminalOptions.getInstance().getTerminalCommand();
5.32 + String command = Util.prefs().get("command", null); // NOI18N
5.33 if (command == null || command.trim().length() <= 0) {
5.34 - LOGGER.info(NbBundle.getMessage(RunTerminalAction.class, "MSG_NoCommand"));
5.35 - return;
5.36 + TerminalPanelPanel p = new TerminalPanelPanel(null);
5.37 + p.load();
5.38 + NotifyDescriptor nd = new NotifyDescriptor.Message(p);
5.39 + nd.setOptions(new Object[] { NotifyDescriptor.OK_OPTION, NotifyDescriptor.CANCEL_OPTION });
5.40 + nd.setMessageType(NotifyDescriptor.QUESTION_MESSAGE);
5.41 + if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) {
5.42 + command = p.store();
5.43 + } else {
5.44 + return;
5.45 + }
5.46 }
5.47
5.48 LOGGER.log(Level.FINE, "Active file is {0}", fo); // NOI18N
6.1 --- a/accelerators.terminal/src/org/netbeans/modules/accelerators/terminal/TerminalOptions.java Mon Mar 05 08:56:11 2012 +0100
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,106 +0,0 @@
6.4 -/*
6.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
6.6 - *
6.7 - * Copyright 1997-2008 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 - * Contributor(s):
6.28 - *
6.29 - * The Original Software is the Accelerators module.
6.30 - * The Initial Developer of the Original Software is Andrei Badea.
6.31 - * Portions Copyright 2005-2006 Andrei Badea.
6.32 - * All Rights Reserved.
6.33 - *
6.34 - * If you wish your version of this file to be governed by only the CDDL
6.35 - * or only the GPL Version 2, indicate your decision by adding
6.36 - * "[Contributor] elects to include this software in this distribution
6.37 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
6.38 - * single choice of license, a recipient has the option to distribute
6.39 - * your version of this file under either the CDDL, the GPL Version 2 or
6.40 - * to extend the choice of license to its licensees as provided above.
6.41 - * However, if you add GPL Version 2 code and therefore, elected the GPL
6.42 - * Version 2 license, then the option applies only if the new code is
6.43 - * made subject to such option by the copyright holder.
6.44 - *
6.45 - * Contributor(s): Andrei Badea
6.46 - */
6.47 -
6.48 -package org.netbeans.modules.accelerators.terminal;
6.49 -
6.50 -import org.openide.options.SystemOption;
6.51 -import org.openide.util.NbBundle;
6.52 -import org.openide.util.SharedClassObject;
6.53 -import org.openide.util.Utilities;
6.54 -
6.55 -/**
6.56 - *
6.57 - * @author Andrei Badea
6.58 - */
6.59 -public class TerminalOptions extends SystemOption {
6.60 -
6.61 - private static final long serialVersionUID = -3596174768571288758L;
6.62 -
6.63 - public static final String PROP_TERMINAL_COMMAND = "terminalCommand"; // NOI18N
6.64 -
6.65 - private static final String SYSTEM_TERMINAL_COMMAND = "accelerators.terminal.terminalCommand"; // NOI18N
6.66 -
6.67 - public static TerminalOptions getInstance() {
6.68 - return (TerminalOptions) SharedClassObject.findObject(TerminalOptions.class, true);
6.69 - }
6.70 -
6.71 - public String displayName() {
6.72 - return NbBundle.getMessage(TerminalOptions.class, "LBL_TerminalOptions");
6.73 - }
6.74 -
6.75 - public String getTerminalCommand() {
6.76 - String result = getUserDefined();
6.77 - if (result != null) {
6.78 - return result;
6.79 - }
6.80 - result = (String) getProperty(PROP_TERMINAL_COMMAND);
6.81 - if (result != null) {
6.82 - return result;
6.83 - } else if (Utilities.isWindows()) {
6.84 - // use command.com on win9x, cmd.exe on other
6.85 - if ((Utilities.getOperatingSystem() & (Utilities.OS_WIN95 | Utilities.OS_WIN98)) != 0) {
6.86 - return "command.com /c start command.com"; // NOI18N
6.87 - } else {
6.88 - return "cmd.exe /c start cmd.exe"; // NOI18N
6.89 - }
6.90 - } else if (Utilities.isMac()) {
6.91 - return "/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal"; // NOI18N
6.92 - } else if (System.getProperty("Env-GNOME_DESKTOP_SESSION_ID") != null) { // NOI18N
6.93 - return "gnome-terminal"; // NOI18N
6.94 - } else if (Utilities.isUnix()) {
6.95 - return "xterm"; // NOI18N
6.96 - } else {
6.97 - // ???
6.98 - return null;
6.99 - }
6.100 - }
6.101 -
6.102 - public void setTerminalCommand(String command) {
6.103 - putProperty(PROP_TERMINAL_COMMAND, command, true);
6.104 - }
6.105 -
6.106 - private String getUserDefined() {
6.107 - return System.getProperty(SYSTEM_TERMINAL_COMMAND);
6.108 - }
6.109 -}
7.1 --- a/accelerators.terminal/src/org/netbeans/modules/accelerators/terminal/TerminalOptionsBeanInfo.java Mon Mar 05 08:56:11 2012 +0100
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,81 +0,0 @@
7.4 -/*
7.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
7.6 - *
7.7 - * Copyright 1997-2007 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 - * Contributor(s):
7.28 - *
7.29 - * The Original Software is the Accelerators module.
7.30 - * The Initial Developer of the Original Software is Andrei Badea.
7.31 - * Portions Copyright 2005-2006 Andrei Badea.
7.32 - * All Rights Reserved.
7.33 - *
7.34 - * If you wish your version of this file to be governed by only the CDDL
7.35 - * or only the GPL Version 2, indicate your decision by adding
7.36 - * "[Contributor] elects to include this software in this distribution
7.37 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
7.38 - * single choice of license, a recipient has the option to distribute
7.39 - * your version of this file under either the CDDL, the GPL Version 2 or
7.40 - * to extend the choice of license to its licensees as provided above.
7.41 - * However, if you add GPL Version 2 code and therefore, elected the GPL
7.42 - * Version 2 license, then the option applies only if the new code is
7.43 - * made subject to such option by the copyright holder.
7.44 - *
7.45 - * Contributor(s): Andrei Badea
7.46 - */
7.47 -
7.48 -package org.netbeans.modules.accelerators.terminal;
7.49 -
7.50 -import java.awt.Image;
7.51 -import java.beans.IntrospectionException;
7.52 -import java.beans.PropertyDescriptor;
7.53 -import java.beans.SimpleBeanInfo;
7.54 -import org.openide.util.NbBundle;
7.55 -import org.openide.util.Utilities;
7.56 -
7.57 -/**
7.58 - *
7.59 - * @author Andrei Badea
7.60 - */
7.61 -public class TerminalOptionsBeanInfo extends SimpleBeanInfo {
7.62 -
7.63 - // XXX not a very nice icon
7.64 - private static final String ACCELERATORS_ICON = "org/netbeans/modules/accelerators/terminal/resources/terminal.gif";// NOI18N
7.65 -
7.66 - public Image getIcon(int iconKind) {
7.67 - if (iconKind == ICON_COLOR_16x16) {
7.68 - return Utilities.loadImage(ACCELERATORS_ICON);
7.69 - }
7.70 - return null;
7.71 - }
7.72 -
7.73 - public PropertyDescriptor[] getPropertyDescriptors() {
7.74 - try {
7.75 - PropertyDescriptor[] props = new PropertyDescriptor[1];
7.76 - props[0] = new PropertyDescriptor(TerminalOptions.PROP_TERMINAL_COMMAND, TerminalOptions.class); // NOI18N
7.77 - props[0].setDisplayName(NbBundle.getMessage(TerminalOptionsBeanInfo.class, "LBL_TerminalCommand"));
7.78 - props[0].setShortDescription(NbBundle.getMessage(TerminalOptionsBeanInfo.class, "HINT_TerminalCommand"));
7.79 - return props;
7.80 - } catch (IntrospectionException e) {
7.81 - throw new AssertionError(e);
7.82 - }
7.83 - }
7.84 -}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/accelerators.terminal/src/org/netbeans/modules/accelerators/terminal/TerminalPanelOptionsPanelController.java Mon Mar 05 09:32:36 2012 +0100
8.3 @@ -0,0 +1,114 @@
8.4 +/*
8.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8.6 + *
8.7 + * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
8.8 + *
8.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
8.10 + * Other names may be trademarks of their respective owners.
8.11 + *
8.12 + * The contents of this file are subject to the terms of either the GNU
8.13 + * General Public License Version 2 only ("GPL") or the Common
8.14 + * Development and Distribution License("CDDL") (collectively, the
8.15 + * "License"). You may not use this file except in compliance with the
8.16 + * License. You can obtain a copy of the License at
8.17 + * http://www.netbeans.org/cddl-gplv2.html
8.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
8.19 + * specific language governing permissions and limitations under the
8.20 + * License. When distributing the software, include this License Header
8.21 + * Notice in each file and include the License file at
8.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
8.23 + * particular file as subject to the "Classpath" exception as provided
8.24 + * by Oracle in the GPL Version 2 section of the License file that
8.25 + * accompanied this code. If applicable, add the following below the
8.26 + * License Header, with the fields enclosed by brackets [] replaced by
8.27 + * your own identifying information:
8.28 + * "Portions Copyrighted [year] [name of copyright owner]"
8.29 + *
8.30 + * If you wish your version of this file to be governed by only the CDDL
8.31 + * or only the GPL Version 2, indicate your decision by adding
8.32 + * "[Contributor] elects to include this software in this distribution
8.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
8.34 + * single choice of license, a recipient has the option to distribute
8.35 + * your version of this file under either the CDDL, the GPL Version 2 or
8.36 + * to extend the choice of license to its licensees as provided above.
8.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
8.38 + * Version 2 license, then the option applies only if the new code is
8.39 + * made subject to such option by the copyright holder.
8.40 + *
8.41 + * Contributor(s):
8.42 + *
8.43 + * Portions Copyrighted 2012 Sun Microsystems, Inc.
8.44 + */
8.45 +package org.netbeans.modules.accelerators.terminal;
8.46 +
8.47 +import java.beans.PropertyChangeListener;
8.48 +import java.beans.PropertyChangeSupport;
8.49 +import javax.swing.JComponent;
8.50 +import org.netbeans.spi.options.OptionsPanelController;
8.51 +import org.openide.util.HelpCtx;
8.52 +import org.openide.util.Lookup;
8.53 +
8.54 +@OptionsPanelController.SubRegistration(location = "Advanced",
8.55 +displayName = "#AdvancedOption_DisplayName_TerminalPanel",
8.56 +keywords = "#AdvancedOption_Keywords_TerminalPanel",
8.57 +keywordsCategory = "Advanced/TerminalPanel")
8.58 +@org.openide.util.NbBundle.Messages({"AdvancedOption_DisplayName_TerminalPanel=External Terminal", "AdvancedOption_Keywords_TerminalPanel=terminal execution"})
8.59 +public final class TerminalPanelOptionsPanelController extends OptionsPanelController {
8.60 +
8.61 + private TerminalPanelPanel panel;
8.62 + private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
8.63 + private boolean changed;
8.64 +
8.65 + public void update() {
8.66 + getPanel().load();
8.67 + changed = false;
8.68 + }
8.69 +
8.70 + public void applyChanges() {
8.71 + getPanel().store();
8.72 + changed = false;
8.73 + }
8.74 +
8.75 + public void cancel() {
8.76 + // need not do anything special, if no changes have been persisted yet
8.77 + }
8.78 +
8.79 + public boolean isValid() {
8.80 + return getPanel().valid();
8.81 + }
8.82 +
8.83 + public boolean isChanged() {
8.84 + return changed;
8.85 + }
8.86 +
8.87 + public HelpCtx getHelpCtx() {
8.88 + return null; // new HelpCtx("...ID") if you have a help set
8.89 + }
8.90 +
8.91 + public JComponent getComponent(Lookup masterLookup) {
8.92 + return getPanel();
8.93 + }
8.94 +
8.95 + public void addPropertyChangeListener(PropertyChangeListener l) {
8.96 + pcs.addPropertyChangeListener(l);
8.97 + }
8.98 +
8.99 + public void removePropertyChangeListener(PropertyChangeListener l) {
8.100 + pcs.removePropertyChangeListener(l);
8.101 + }
8.102 +
8.103 + private TerminalPanelPanel getPanel() {
8.104 + if (panel == null) {
8.105 + panel = new TerminalPanelPanel(this);
8.106 + }
8.107 + return panel;
8.108 + }
8.109 +
8.110 + void changed() {
8.111 + if (!changed) {
8.112 + changed = true;
8.113 + pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
8.114 + }
8.115 + pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
8.116 + }
8.117 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/accelerators.terminal/src/org/netbeans/modules/accelerators/terminal/TerminalPanelPanel.form Mon Mar 05 09:32:36 2012 +0100
9.3 @@ -0,0 +1,112 @@
9.4 +<?xml version="1.0" encoding="UTF-8" ?>
9.5 +
9.6 +<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
9.7 + <AuxValues>
9.8 + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
9.9 + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
9.10 + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
9.11 + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
9.12 + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
9.13 + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
9.14 + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
9.15 + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
9.16 + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
9.17 + </AuxValues>
9.18 +
9.19 + <Layout>
9.20 + <DimensionLayout dim="0">
9.21 + <Group type="103" groupAlignment="0" attributes="0">
9.22 + <Group type="102" attributes="0">
9.23 + <EmptySpace max="-2" attributes="0"/>
9.24 + <Group type="103" groupAlignment="0" attributes="0">
9.25 + <Component id="jScrollPane1" alignment="1" pref="381" max="32767" attributes="0"/>
9.26 + <Component id="commandField" alignment="0" max="32767" attributes="0"/>
9.27 + <Group type="102" attributes="0">
9.28 + <Group type="103" groupAlignment="0" attributes="0">
9.29 + <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
9.30 + <Component id="rememberBox" alignment="0" min="-2" max="-2" attributes="0"/>
9.31 + </Group>
9.32 + <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
9.33 + </Group>
9.34 + </Group>
9.35 + <EmptySpace max="-2" attributes="0"/>
9.36 + </Group>
9.37 + </Group>
9.38 + </DimensionLayout>
9.39 + <DimensionLayout dim="1">
9.40 + <Group type="103" groupAlignment="0" attributes="0">
9.41 + <Group type="102" alignment="0" attributes="0">
9.42 + <EmptySpace max="-2" attributes="0"/>
9.43 + <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
9.44 + <EmptySpace max="-2" attributes="0"/>
9.45 + <Component id="commandField" min="-2" max="-2" attributes="0"/>
9.46 + <EmptySpace max="-2" attributes="0"/>
9.47 + <Component id="jScrollPane1" pref="110" max="32767" attributes="0"/>
9.48 + <EmptySpace max="-2" attributes="0"/>
9.49 + <Component id="rememberBox" min="-2" max="-2" attributes="0"/>
9.50 + <EmptySpace max="-2" attributes="0"/>
9.51 + </Group>
9.52 + </Group>
9.53 + </DimensionLayout>
9.54 + </Layout>
9.55 + <SubComponents>
9.56 + <Component class="javax.swing.JLabel" name="jLabel1">
9.57 + <Properties>
9.58 + <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
9.59 + <ComponentRef name="commandField"/>
9.60 + </Property>
9.61 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
9.62 + <ResourceString bundle="org/netbeans/modules/accelerators/terminal/Bundle.properties" key="LBL_TerminalCommand" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}", {arguments})"/>
9.63 + </Property>
9.64 + </Properties>
9.65 + </Component>
9.66 + <Component class="javax.swing.JTextField" name="commandField">
9.67 + <Properties>
9.68 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
9.69 + <ResourceString bundle="org/netbeans/modules/accelerators/terminal/Bundle.properties" key="TerminalPanelPanel.commandField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}", {arguments})"/>
9.70 + </Property>
9.71 + </Properties>
9.72 + </Component>
9.73 + <Container class="javax.swing.JScrollPane" name="jScrollPane1">
9.74 + <AuxValues>
9.75 + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
9.76 + </AuxValues>
9.77 +
9.78 + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
9.79 + <SubComponents>
9.80 + <Component class="javax.swing.JTextArea" name="description">
9.81 + <Properties>
9.82 + <Property name="background" type="java.awt.Color" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
9.83 + <Connection component="Form" name="background" type="property"/>
9.84 + </Property>
9.85 + <Property name="columns" type="int" value="20"/>
9.86 + <Property name="editable" type="boolean" value="false"/>
9.87 + <Property name="lineWrap" type="boolean" value="true"/>
9.88 + <Property name="rows" type="int" value="5"/>
9.89 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
9.90 + <ResourceString bundle="org/netbeans/modules/accelerators/terminal/Bundle.properties" key="HINT_TerminalCommand" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}", {arguments})"/>
9.91 + </Property>
9.92 + <Property name="wrapStyleWord" type="boolean" value="true"/>
9.93 + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
9.94 + <Border info="null"/>
9.95 + </Property>
9.96 + <Property name="disabledTextColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
9.97 + <Color blue="0" green="0" id="black" palette="1" red="0" type="palette"/>
9.98 + </Property>
9.99 + <Property name="focusable" type="boolean" value="false"/>
9.100 + </Properties>
9.101 + </Component>
9.102 + </SubComponents>
9.103 + </Container>
9.104 + <Component class="javax.swing.JCheckBox" name="rememberBox">
9.105 + <Properties>
9.106 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
9.107 + <ResourceString bundle="org/netbeans/modules/accelerators/terminal/Bundle.properties" key="TerminalPanelPanel.rememberBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}", {arguments})"/>
9.108 + </Property>
9.109 + </Properties>
9.110 + <Events>
9.111 + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rememberBoxActionPerformed"/>
9.112 + </Events>
9.113 + </Component>
9.114 + </SubComponents>
9.115 +</Form>
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/accelerators.terminal/src/org/netbeans/modules/accelerators/terminal/TerminalPanelPanel.java Mon Mar 05 09:32:36 2012 +0100
10.3 @@ -0,0 +1,173 @@
10.4 +/*
10.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
10.6 + *
10.7 + * Copyright 2012 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 2012 Sun Microsystems, Inc.
10.44 + */
10.45 +package org.netbeans.modules.accelerators.terminal;
10.46 +
10.47 +import javax.swing.event.DocumentEvent;
10.48 +import javax.swing.event.DocumentListener;
10.49 +
10.50 +final class TerminalPanelPanel extends javax.swing.JPanel
10.51 +implements DocumentListener {
10.52 +
10.53 + private final TerminalPanelOptionsPanelController controller;
10.54 +
10.55 + TerminalPanelPanel(TerminalPanelOptionsPanelController controller) {
10.56 + this.controller = controller;
10.57 + initComponents();
10.58 + commandField.getDocument().addDocumentListener(this);
10.59 + if (controller != null) {
10.60 + rememberBox.setVisible(false);
10.61 + rememberBox.setSelected(true);
10.62 + }
10.63 + }
10.64 +
10.65 + /**
10.66 + * This method is called from within the constructor to initialize the form.
10.67 + * WARNING: Do NOT modify this code. The content of this method is always
10.68 + * regenerated by the Form Editor.
10.69 + */
10.70 + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
10.71 + private void initComponents() {
10.72 +
10.73 + jLabel1 = new javax.swing.JLabel();
10.74 + commandField = new javax.swing.JTextField();
10.75 + jScrollPane1 = new javax.swing.JScrollPane();
10.76 + description = new javax.swing.JTextArea();
10.77 + rememberBox = new javax.swing.JCheckBox();
10.78 +
10.79 + jLabel1.setLabelFor(commandField);
10.80 + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(TerminalPanelPanel.class, "LBL_TerminalCommand", new Object[] {})); // NOI18N
10.81 +
10.82 + commandField.setText(org.openide.util.NbBundle.getMessage(TerminalPanelPanel.class, "TerminalPanelPanel.commandField.text", new Object[] {})); // NOI18N
10.83 +
10.84 + description.setBackground(getBackground());
10.85 + description.setColumns(20);
10.86 + description.setEditable(false);
10.87 + description.setLineWrap(true);
10.88 + description.setRows(5);
10.89 + description.setText(org.openide.util.NbBundle.getMessage(TerminalPanelPanel.class, "HINT_TerminalCommand", new Object[] {})); // NOI18N
10.90 + description.setWrapStyleWord(true);
10.91 + description.setBorder(null);
10.92 + description.setDisabledTextColor(java.awt.Color.black);
10.93 + description.setFocusable(false);
10.94 + jScrollPane1.setViewportView(description);
10.95 +
10.96 + org.openide.awt.Mnemonics.setLocalizedText(rememberBox, org.openide.util.NbBundle.getMessage(TerminalPanelPanel.class, "TerminalPanelPanel.rememberBox.text", new Object[] {})); // NOI18N
10.97 + rememberBox.addActionListener(new java.awt.event.ActionListener() {
10.98 + public void actionPerformed(java.awt.event.ActionEvent evt) {
10.99 + rememberBoxActionPerformed(evt);
10.100 + }
10.101 + });
10.102 +
10.103 + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
10.104 + this.setLayout(layout);
10.105 + layout.setHorizontalGroup(
10.106 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
10.107 + .addGroup(layout.createSequentialGroup()
10.108 + .addContainerGap()
10.109 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
10.110 + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 381, Short.MAX_VALUE)
10.111 + .addComponent(commandField)
10.112 + .addGroup(layout.createSequentialGroup()
10.113 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
10.114 + .addComponent(jLabel1)
10.115 + .addComponent(rememberBox))
10.116 + .addGap(0, 0, Short.MAX_VALUE)))
10.117 + .addContainerGap())
10.118 + );
10.119 + layout.setVerticalGroup(
10.120 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
10.121 + .addGroup(layout.createSequentialGroup()
10.122 + .addContainerGap()
10.123 + .addComponent(jLabel1)
10.124 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
10.125 + .addComponent(commandField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
10.126 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
10.127 + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 110, Short.MAX_VALUE)
10.128 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
10.129 + .addComponent(rememberBox)
10.130 + .addContainerGap())
10.131 + );
10.132 + }// </editor-fold>//GEN-END:initComponents
10.133 +
10.134 + private void rememberBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rememberBoxActionPerformed
10.135 + // TODO add your handling code here:
10.136 + }//GEN-LAST:event_rememberBoxActionPerformed
10.137 +
10.138 + void load() {
10.139 + commandField.setText(Util.prefs().get("command", "xterm")); // NOI18N
10.140 + }
10.141 +
10.142 + String store() {
10.143 + if (rememberBox.isSelected()) {
10.144 + Util.prefs().put("command", commandField.getText()); // NOI18N
10.145 + }
10.146 + return commandField.getText();
10.147 + }
10.148 +
10.149 + boolean valid() {
10.150 + return true;
10.151 + }
10.152 + // Variables declaration - do not modify//GEN-BEGIN:variables
10.153 + private javax.swing.JTextField commandField;
10.154 + private javax.swing.JTextArea description;
10.155 + private javax.swing.JLabel jLabel1;
10.156 + private javax.swing.JScrollPane jScrollPane1;
10.157 + private javax.swing.JCheckBox rememberBox;
10.158 + // End of variables declaration//GEN-END:variables
10.159 +
10.160 + @Override
10.161 + public void insertUpdate(DocumentEvent e) {
10.162 + changedUpdate(e);
10.163 + }
10.164 +
10.165 + @Override
10.166 + public void removeUpdate(DocumentEvent e) {
10.167 + changedUpdate(e);
10.168 + }
10.169 +
10.170 + @Override
10.171 + public void changedUpdate(DocumentEvent e) {
10.172 + if (controller != null) {
10.173 + controller.changed();
10.174 + }
10.175 + }
10.176 +}
11.1 --- a/accelerators.terminal/src/org/netbeans/modules/accelerators/terminal/Util.java Mon Mar 05 08:56:11 2012 +0100
11.2 +++ b/accelerators.terminal/src/org/netbeans/modules/accelerators/terminal/Util.java Mon Mar 05 09:32:36 2012 +0100
11.3 @@ -44,20 +44,26 @@
11.4
11.5 package org.netbeans.modules.accelerators.terminal;
11.6
11.7 +import java.util.prefs.Preferences;
11.8 import org.netbeans.api.project.Project;
11.9 import org.openide.filesystems.FileObject;
11.10 import org.openide.loaders.DataObject;
11.11 import org.openide.loaders.DataShadow;
11.12 import org.openide.nodes.Node;
11.13 +import org.openide.util.NbPreferences;
11.14
11.15 /**
11.16 *
11.17 * @author Andrei Badea
11.18 */
11.19 -public class Util {
11.20 +final class Util {
11.21
11.22 private Util() {
11.23 }
11.24 +
11.25 + public static Preferences prefs() {
11.26 + return NbPreferences.forModule(Util.class);
11.27 + }
11.28
11.29 public static FileObject findFileObject(Node[] activatedNodes) {
11.30 // XXX should look in all nodes
12.1 --- a/accelerators.terminal/src/org/netbeans/modules/accelerators/terminal/resources/TerminalOptions.xml Mon Mar 05 08:56:11 2012 +0100
12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
12.3 @@ -1,52 +0,0 @@
12.4 -<?xml version="1.0" encoding="UTF-8"?>
12.5 -<!--
12.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
12.7 -
12.8 -Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
12.9 -
12.10 -
12.11 -The contents of this file are subject to the terms of either the GNU
12.12 -General Public License Version 2 only ("GPL") or the Common
12.13 -Development and Distribution License("CDDL") (collectively, the
12.14 -"License"). You may not use this file except in compliance with the
12.15 -License. You can obtain a copy of the License at
12.16 -http://www.netbeans.org/cddl-gplv2.html
12.17 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
12.18 -specific language governing permissions and limitations under the
12.19 -License. When distributing the software, include this License Header
12.20 -Notice in each file and include the License file at
12.21 -nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
12.22 -particular file as subject to the "Classpath" exception as provided
12.23 -by Sun in the GPL Version 2 section of the License file that
12.24 -accompanied this code. If applicable, add the following below the
12.25 -License Header, with the fields enclosed by brackets [] replaced by
12.26 -your own identifying information:
12.27 -"Portions Copyrighted [year] [name of copyright owner]"
12.28 -
12.29 -Contributor(s):
12.30 -
12.31 -The Original Software is the Accelerators module.
12.32 -The Initial Developer of the Original Software is Andrei Badea.
12.33 -Portions Copyright 2005-2006 Andrei Badea.
12.34 -All Rights Reserved.
12.35 -
12.36 -If you wish your version of this file to be governed by only the CDDL
12.37 -or only the GPL Version 2, indicate your decision by adding
12.38 -"[Contributor] elects to include this software in this distribution
12.39 -under the [CDDL or GPL Version 2] license." If you do not indicate a
12.40 -single choice of license, a recipient has the option to distribute
12.41 -your version of this file under either the CDDL, the GPL Version 2 or
12.42 -to extend the choice of license to its licensees as provided above.
12.43 -However, if you add GPL Version 2 code and therefore, elected the GPL
12.44 -Version 2 license, then the option applies only if the new code is
12.45 -made subject to such option by the copyright holder.
12.46 -
12.47 -Contributor(s): Andrei Badea
12.48 --->
12.49 -<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
12.50 -<settings version="1.0">
12.51 - <module name="org.netbeans.modules.accelerators.terminal"/>
12.52 - <instanceof class="org.openide.options.SystemOption"/>
12.53 - <instanceof class="org.netbeans.modules.accelerators.terminal.TerminalOptions"/>
12.54 - <instance class="org.netbeans.modules.accelerators.terminal.TerminalOptions"/>
12.55 -</settings>
13.1 --- a/accelerators.terminal/src/org/netbeans/modules/accelerators/terminal/resources/layer.xml Mon Mar 05 08:56:11 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.0" encoding="UTF-8"?>
13.5 -<!--
13.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
13.7 -
13.8 -Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
13.9 -
13.10 -
13.11 -The contents of this file are subject to the terms of either the GNU
13.12 -General Public License Version 2 only ("GPL") or the Common
13.13 -Development and Distribution License("CDDL") (collectively, the
13.14 -"License"). You may not use this file except in compliance with the
13.15 -License. You can obtain a copy of the License at
13.16 -http://www.netbeans.org/cddl-gplv2.html
13.17 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13.18 -specific language governing permissions and limitations under the
13.19 -License. When distributing the software, include this License Header
13.20 -Notice in each file and include the License file at
13.21 -nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
13.22 -particular file as subject to the "Classpath" exception as provided
13.23 -by Sun in the GPL Version 2 section of the License file that
13.24 -accompanied this code. If applicable, add the following below the
13.25 -License Header, with the fields enclosed by brackets [] replaced by
13.26 -your own identifying information:
13.27 -"Portions Copyrighted [year] [name of copyright owner]"
13.28 -
13.29 -Contributor(s):
13.30 -
13.31 -The Original Software is the Accelerators module.
13.32 -The Initial Developer of the Original Software is Andrei Badea.
13.33 -Portions Copyright 2005-2006 Andrei Badea.
13.34 -All Rights Reserved.
13.35 -
13.36 -If you wish your version of this file to be governed by only the CDDL
13.37 -or only the GPL Version 2, indicate your decision by adding
13.38 -"[Contributor] elects to include this software in this distribution
13.39 -under the [CDDL or GPL Version 2] license." If you do not indicate a
13.40 -single choice of license, a recipient has the option to distribute
13.41 -your version of this file under either the CDDL, the GPL Version 2 or
13.42 -to extend the choice of license to its licensees as provided above.
13.43 -However, if you add GPL Version 2 code and therefore, elected the GPL
13.44 -Version 2 license, then the option applies only if the new code is
13.45 -made subject to such option by the copyright holder.
13.46 -
13.47 -Contributor(s): Andrei Badea, Leon Chiver
13.48 --->
13.49 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
13.50 -<filesystem>
13.51 -
13.52 - <!-- Install the action -->
13.53 - <folder name="Actions">
13.54 - <folder name="Tools">
13.55 - <file name="org-netbeans-modules-accelerators-terminal-RunTerminalAction.instance"/>
13.56 - </folder>
13.57 - </folder>
13.58 -
13.59 - <!-- Install the action shortcut -->
13.60 - <folder name="Shortcuts">
13.61 - <file name="DSO-Enter.shadow">
13.62 - <attr name="originalFile" stringvalue="Actions/Tools/org-netbeans-modules-accelerators-terminal-RunTerminalAction.instance"/>
13.63 - </file>
13.64 - </folder>
13.65 -
13.66 - <!-- Install the options item for the Run Terminal action-->
13.67 - <folder name="Services">
13.68 - <file name="TerminalOptions.settings" url="TerminalOptions.xml"/>
13.69 - </folder>
13.70 -
13.71 - <!-- Show the options item in the right folder in the Options dialog -->
13.72 - <folder name="UI">
13.73 - <folder name="Services">
13.74 - <folder name="IDEConfiguration">
13.75 - <folder name="ServerAndExternalToolSettings">
13.76 - <file name="TerminalOptions.shadow">
13.77 - <attr name="originalFile" stringvalue="Services/TerminalOptions.settings"/>
13.78 - </file>
13.79 - </folder>
13.80 - </folder>
13.81 - </folder>
13.82 - </folder>
13.83 -
13.84 -</filesystem>