diff --git a/manifest.mf b/manifest.mf index 21204f8..9830ee2 100644 --- a/manifest.mf +++ b/manifest.mf @@ -2,4 +2,4 @@ Manifest-Version: 1.0 OpenIDE-Module: org.cakephp.netbeans OpenIDE-Module-Layer: org/cakephp/netbeans/resources/layer.xml OpenIDE-Module-Localizing-Bundle: org/cakephp/netbeans/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 0.9.2 +OpenIDE-Module-Specification-Version: 0.9.3 diff --git a/src/org/cakephp/netbeans/CakePhpModuleExtender.java b/src/org/cakephp/netbeans/CakePhpModuleExtender.java index 4ee11c4..e35fb69 100755 --- a/src/org/cakephp/netbeans/CakePhpModuleExtender.java +++ b/src/org/cakephp/netbeans/CakePhpModuleExtender.java @@ -177,7 +177,9 @@ public Set extend(PhpModule phpModule) throws ExtendingException { CakePhpFileUtils.chmodTmpDirectory(tmp); } + // set default configurations setIgnoreTmpDirectory(phpModule); + setAutoCreateViewFile(phpModule); CakePhpModule module = CakePhpModule.forPhpModule(phpModule); FileObject config = module.getConfigFile(); @@ -429,6 +431,13 @@ private void setIgnoreTmpDirectory(PhpModule phpModule) { } } + private void setAutoCreateViewFile(PhpModule phpModule) { + boolean isAutoCreate = CakePhpOptions.getInstance().isAutoCreateView(); + if (isAutoCreate) { + CakePreferences.setAutoCreateView(phpModule, isAutoCreate); + } + } + /** * Set app name. * diff --git a/src/org/cakephp/netbeans/options/Bundle.properties b/src/org/cakephp/netbeans/options/Bundle.properties index 4c93c18..124b6db 100755 --- a/src/org/cakephp/netbeans/options/Bundle.properties +++ b/src/org/cakephp/netbeans/options/Bundle.properties @@ -65,3 +65,5 @@ CakePhpPanel.localFilePathTextField.text= CakePhpPanel.browseButton.text=Browse... CakePhpPanel.resetButton.text=Reset CakePhpPanel.ignoreTempDirectoryCheckBox.text=Ignore tmp directory +CakePhpPanel.defaultLabel.text=default +CakePhpPanel.autoCreateViewCheckBox.text=Auto create a view file when go to view action is run. diff --git a/src/org/cakephp/netbeans/options/CakePhpOptions.java b/src/org/cakephp/netbeans/options/CakePhpOptions.java index d7280d6..adcc969 100755 --- a/src/org/cakephp/netbeans/options/CakePhpOptions.java +++ b/src/org/cakephp/netbeans/options/CakePhpOptions.java @@ -60,6 +60,7 @@ public class CakePhpOptions { private static final String NEW_PROJECT = "new-project"; // NOI18N private static final String LOCAL_ZIP_FILE_PATH = "local-zip-file-path"; // NOI18N private static final String IGNORE_TMP = "ignore-tmp"; // NOI18N + private static final String AUTO_CREATE_VIEW = "auto-create-view"; // NOI18N private static CakePhpOptions INSTANCE = new CakePhpOptions(); private CakePhpOptions() { @@ -122,6 +123,14 @@ public void setIgnoreTmpDirectory(boolean isIgnore) { getPreferences().putBoolean(IGNORE_TMP, isIgnore); } + public boolean isAutoCreateView() { + return getPreferences().getBoolean(AUTO_CREATE_VIEW, false); + } + + public void setAutoCreateView(boolean isAuto) { + getPreferences().putBoolean(AUTO_CREATE_VIEW, isAuto); + } + public Preferences getPreferences() { return NbPreferences.forModule(CakePhpOptions.class); } diff --git a/src/org/cakephp/netbeans/options/CakePhpPanel.form b/src/org/cakephp/netbeans/options/CakePhpPanel.form index e1a1e66..cdf86e6 100755 --- a/src/org/cakephp/netbeans/options/CakePhpPanel.form +++ b/src/org/cakephp/netbeans/options/CakePhpPanel.form @@ -50,7 +50,7 @@ - + @@ -58,8 +58,16 @@ - - + + + + + + + + + + @@ -77,9 +85,16 @@ + + + + + - + + + @@ -129,6 +144,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/org/cakephp/netbeans/options/CakePhpPanel.java b/src/org/cakephp/netbeans/options/CakePhpPanel.java index 34986b2..8e876e1 100755 --- a/src/org/cakephp/netbeans/options/CakePhpPanel.java +++ b/src/org/cakephp/netbeans/options/CakePhpPanel.java @@ -97,6 +97,9 @@ private void initComponents() { browseButton = new javax.swing.JButton(); resetButton = new javax.swing.JButton(); ignoreTempDirectoryCheckBox = new javax.swing.JCheckBox(); + defaultLabel = new javax.swing.JLabel(); + defaultSeparator = new javax.swing.JSeparator(); + autoCreateViewCheckBox = new javax.swing.JCheckBox(); pluginsPanel = new javax.swing.JPanel(); pluginListLabel = new javax.swing.JLabel(); messageLabel = new javax.swing.JLabel(); @@ -131,6 +134,15 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); + org.openide.awt.Mnemonics.setLocalizedText(defaultLabel, org.openide.util.NbBundle.getMessage(CakePhpPanel.class, "CakePhpPanel.defaultLabel.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(autoCreateViewCheckBox, org.openide.util.NbBundle.getMessage(CakePhpPanel.class, "CakePhpPanel.autoCreateViewCheckBox.text")); // NOI18N + autoCreateViewCheckBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + autoCreateViewCheckBoxActionPerformed(evt); + } + }); + javax.swing.GroupLayout newProjectPanelLayout = new javax.swing.GroupLayout(newProjectPanel); newProjectPanel.setLayout(newProjectPanelLayout); newProjectPanelLayout.setHorizontalGroup( @@ -141,14 +153,20 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, newProjectPanelLayout.createSequentialGroup() .addComponent(localFilePathLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(localFilePathTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 484, Short.MAX_VALUE) + .addComponent(localFilePathTextField) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(newProjectPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(browseButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(resetButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(newProjectPanelLayout.createSequentialGroup() - .addComponent(ignoreTempDirectoryCheckBox) - .addGap(0, 0, Short.MAX_VALUE))) + .addComponent(defaultLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(defaultSeparator)) + .addGroup(newProjectPanelLayout.createSequentialGroup() + .addGroup(newProjectPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(ignoreTempDirectoryCheckBox) + .addComponent(autoCreateViewCheckBox)) + .addGap(0, 295, Short.MAX_VALUE))) .addContainerGap()) ); newProjectPanelLayout.setVerticalGroup( @@ -161,9 +179,15 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(browseButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(resetButton) + .addGap(18, 18, 18) + .addGroup(newProjectPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(defaultLabel) + .addComponent(defaultSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(ignoreTempDirectoryCheckBox) - .addContainerGap(304, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(autoCreateViewCheckBox) + .addContainerGap(238, Short.MAX_VALUE)) ); optionsTabbedPane.addTab(org.openide.util.NbBundle.getMessage(CakePhpPanel.class, "CakePhpPanel.newProjectPanel.TabConstraints.tabTitle"), newProjectPanel); // NOI18N @@ -329,6 +353,10 @@ private void ignoreTempDirectoryCheckBoxActionPerformed(java.awt.event.ActionEve controller.changed(); }//GEN-LAST:event_ignoreTempDirectoryCheckBoxActionPerformed + private void autoCreateViewCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autoCreateViewCheckBoxActionPerformed + controller.changed(); + }//GEN-LAST:event_autoCreateViewCheckBoxActionPerformed + private void setLocalPath(String path) { localFilePathTextField.setText(path); } @@ -355,6 +383,7 @@ void load() { model.setPlugins(options.getPlugins()); localFilePathTextField.setText(options.getLocalZipFilePath()); ignoreTempDirectoryCheckBox.setSelected(options.isIgnoreTmpDirectory()); + autoCreateViewCheckBox.setSelected(options.isAutoCreateView()); } void store() { @@ -363,6 +392,7 @@ void store() { options.setPlugins(model.getPlugins()); options.setLocalZipFilePath(localFilePathTextField.getText()); options.setIgnoreTmpDirectory(ignoreTempDirectoryCheckBox.isSelected()); + options.setAutoCreateView(autoCreateViewCheckBox.isSelected()); } } @@ -438,7 +468,10 @@ public void removePlugin(int index) { } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton addButton; + private javax.swing.JCheckBox autoCreateViewCheckBox; private javax.swing.JButton browseButton; + private javax.swing.JLabel defaultLabel; + private javax.swing.JSeparator defaultSeparator; private javax.swing.JButton deleteButton; private javax.swing.JButton editButton; private javax.swing.JCheckBox ignoreTempDirectoryCheckBox; diff --git a/src/org/cakephp/netbeans/ui/CakePhpStatusLineElement.java b/src/org/cakephp/netbeans/ui/CakePhpStatusLineElement.java index 7abd9b3..01c5923 100644 --- a/src/org/cakephp/netbeans/ui/CakePhpStatusLineElement.java +++ b/src/org/cakephp/netbeans/ui/CakePhpStatusLineElement.java @@ -197,7 +197,7 @@ public Dimension getPreferredSize() { * @return debug level */ public String getDebugLevel(FileObject config) { - String debubLv = ""; // NOI18N + String debugLv = ""; // NOI18N Pattern pattern = Pattern.compile(DEBUG_REGEX); try { @@ -205,7 +205,7 @@ public String getDebugLevel(FileObject config) { for (String line : lines) { Matcher matcher = pattern.matcher(line); if (matcher.find()) { - debubLv = matcher.group(1); + debugLv = matcher.group(1); break; } } @@ -213,7 +213,7 @@ public String getDebugLevel(FileObject config) { Exceptions.printStackTrace(ex); } - return debubLv; + return debugLv; } /**