1.1 --- a/php.smarty/manifest.mf Thu May 26 16:36:10 2011 +0400
1.2 +++ b/php.smarty/manifest.mf Tue Jun 14 17:07:43 2011 +0200
1.3 @@ -1,4 +1,4 @@
1.4 OpenIDE-Module: org.netbeans.modules.php.smarty
1.5 OpenIDE-Module-Layer: org/netbeans/modules/php/smarty/resources/layer.xml
1.6 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/smarty/resources/Bundle.properties
1.7 -OpenIDE-Module-Specification-Version: 1.50
1.8 +OpenIDE-Module-Specification-Version: 1.50.1
2.1 --- a/php.smarty/nbproject/project.xml Thu May 26 16:36:10 2011 +0400
2.2 +++ b/php.smarty/nbproject/project.xml Tue Jun 14 17:07:43 2011 +0200
2.3 @@ -6,6 +6,15 @@
2.4 <code-name-base>org.netbeans.modules.php.smarty</code-name-base>
2.5 <module-dependencies>
2.6 <dependency>
2.7 + <code-name-base>org.netbeans.api.progress</code-name-base>
2.8 + <build-prerequisite/>
2.9 + <compile-dependency/>
2.10 + <run-dependency>
2.11 + <release-version>1</release-version>
2.12 + <specification-version>1.23.1</specification-version>
2.13 + </run-dependency>
2.14 + </dependency>
2.15 + <dependency>
2.16 <code-name-base>org.netbeans.modules.csl.api</code-name-base>
2.17 <build-prerequisite/>
2.18 <compile-dependency/>
3.1 --- a/php.smarty/src/org/netbeans/modules/php/smarty/Bundle.properties Thu May 26 16:36:10 2011 +0400
3.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/Bundle.properties Tue Jun 14 17:07:43 2011 +0200
3.3 @@ -42,3 +42,5 @@
3.4 # framework customizer extender
3.5 LBL_Smarty=Smarty
3.6
3.7 +MSG_SearchingForSmartyExt=Scanning for Smarty file extensions in project.
3.8 +
4.1 --- a/php.smarty/src/org/netbeans/modules/php/smarty/SmartyPhpFrameworkProvider.java Thu May 26 16:36:10 2011 +0400
4.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/SmartyPhpFrameworkProvider.java Tue Jun 14 17:07:43 2011 +0200
4.3 @@ -39,6 +39,9 @@
4.4 package org.netbeans.modules.php.smarty;
4.5
4.6 import java.io.File;
4.7 +import java.util.logging.Level;
4.8 +import java.util.logging.Logger;
4.9 +import org.netbeans.api.progress.ProgressUtils;
4.10 import org.netbeans.modules.php.api.phpmodule.BadgeIcon;
4.11 import org.netbeans.modules.php.api.phpmodule.PhpModule;
4.12 import org.netbeans.modules.php.api.phpmodule.PhpModuleProperties;
4.13 @@ -136,17 +139,33 @@
4.14 @Override
4.15 public boolean isInPhpModule(final PhpModule phpModule) {
4.16 // get php files within the module
4.17 - final FoundSmarty fs = new FoundSmarty();
4.18 + long time = System.currentTimeMillis();
4.19 + try {
4.20 + final FoundSmarty fs = new FoundSmarty();
4.21
4.22 - if (phpModule.getPreferences(SmartyPhpFrameworkProvider.class, true).get(SMARTY_AVAILABLE, "0").equals("1")) {
4.23 - fs.setFound(true);
4.24 - }
4.25 + if (phpModule.getPreferences(SmartyPhpFrameworkProvider.class, true).get(SMARTY_AVAILABLE, "0").equals("1")) {
4.26 + fs.setFound(true);
4.27 + }
4.28
4.29 - if (fs.isFound()) {
4.30 - return true;
4.31 - } else {
4.32 - FileObject sourceDirectory = phpModule.getSourceDirectory();
4.33 - return locatedTplFiles(sourceDirectory, SmartyOptions.getInstance().getScanningDepth(), 0);
4.34 + if (fs.isFound()) {
4.35 + return true;
4.36 + } else {
4.37 + ProgressUtils.showProgressDialogAndRun(new Runnable() {
4.38 + @Override
4.39 + public void run() {
4.40 + FileObject sourceDirectory = phpModule.getSourceDirectory();
4.41 + if (locatedTplFiles(sourceDirectory, SmartyOptions.getInstance().getScanningDepth(), 0)) {
4.42 + phpModule.getPreferences(SmartyPhpFrameworkProvider.class, true).put(SMARTY_AVAILABLE, "1");
4.43 + fs.setFound(true);
4.44 + }
4.45 + }
4.46 + }, NbBundle.getMessage(SmartyPhpFrameworkProvider.class, "MSG_SearchingForSmartyExt"));
4.47 +
4.48 + }
4.49 + return fs.isFound();
4.50 + } finally {
4.51 + Logger.getLogger(SmartyPhpFrameworkProvider.class.getName()).log(
4.52 + Level.INFO, "Smarty.isInPhpModule total time spent={0} ms", (System.currentTimeMillis() - time));
4.53 }
4.54 }
4.55
5.1 --- a/php.smarty/src/org/netbeans/modules/php/smarty/ui/options/Bundle.properties Thu May 26 16:36:10 2011 +0400
5.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/ui/options/Bundle.properties Tue Jun 14 17:07:43 2011 +0200
5.3 @@ -38,11 +38,15 @@
5.4 # ide options
5.5 LBL_OptionsName=Smarty
5.6 LBL_OptionsTooltip=PHP Smarty Framework
5.7 +
5.8 SmartyOptionsPanel.openDelimiterLabel.text=Open delimiter
5.9 SmartyOptionsPanel.closeDelimiterLabel.text=Close delimiter
5.10 SmartyOptionsPanel.openDelimiterTextField.text=
5.11 SmartyOptionsPanel.closeDelimiterTextField.text=
5.12 +
5.13 WRN_EmptyDelimiterFields=Delimiter text fields can't be blank.
5.14 +WRN_TooDeepScanningLevel=Setup of deeper directory level by scanning for TPL files can cause slowness by working with PHP projects.
5.15 +
5.16 SmartyOptionsPanel.errorLabel.text=Error Message
5.17 SmartyOptionsPanel.AccessibleContext.accessibleDescription=Panel for Smarty options.
5.18 SmartyOptionsPanel.learnMoreLabel.text=<html><font color="#0000FF"><u>Learn more</u></font></html>
6.1 --- a/php.smarty/src/org/netbeans/modules/php/smarty/ui/options/SmartyOptionsPanel.java Thu May 26 16:36:10 2011 +0400
6.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/ui/options/SmartyOptionsPanel.java Tue Jun 14 17:07:43 2011 +0200
6.3 @@ -45,8 +45,11 @@
6.4
6.5 package org.netbeans.modules.php.smarty.ui.options;
6.6
6.7 +import java.awt.Color;
6.8 import java.awt.Component;
6.9 import java.awt.Cursor;
6.10 +import java.awt.event.ActionEvent;
6.11 +import java.awt.event.ActionListener;
6.12 import java.awt.event.MouseAdapter;
6.13 import java.awt.event.MouseEvent;
6.14 import java.net.MalformedURLException;
6.15 @@ -88,24 +91,18 @@
6.16 setCloseDelimiter(SmartyOptions.getInstance().getDefaultCloseDelimiter());
6.17 setDepthOfScanning(SmartyOptions.getInstance().getScanningDepth());
6.18
6.19 - openDelimiterTextField.getDocument().addDocumentListener(new DocumentListener() {
6.20 - public void insertUpdate(DocumentEvent e) {
6.21 - processUpdate();
6.22 - }
6.23 - public void removeUpdate(DocumentEvent e) {
6.24 - processUpdate();
6.25 - }
6.26 - public void changedUpdate(DocumentEvent e) {
6.27 - processUpdate();
6.28 - }
6.29 - private void processUpdate() {
6.30 + openDelimiterTextField.getDocument().addDocumentListener(new SmartyDocumentListener());
6.31 + closeDelimiterTextField.getDocument().addDocumentListener(new SmartyDocumentListener());
6.32 + depthOfScanningComboBox.addActionListener(new ActionListener() {
6.33 + @Override
6.34 + public void actionPerformed(ActionEvent e) {
6.35 fireChange();
6.36 }
6.37 });
6.38 }
6.39
6.40 private void setDepthOfScanningComboBox() {
6.41 - for (int i = 0; i < 5; i++) {
6.42 + for (int i = 0; i < 4; i++) {
6.43 depthOfScanningComboBox.addItem(String.valueOf(i));
6.44 }
6.45 }
6.46 @@ -292,4 +289,20 @@
6.47 private JTextField openDelimiterTextField;
6.48 // End of variables declaration//GEN-END:variables
6.49
6.50 + private final class SmartyDocumentListener implements DocumentListener {
6.51 +
6.52 + public void insertUpdate(DocumentEvent e) {
6.53 + processUpdate();
6.54 + }
6.55 + public void removeUpdate(DocumentEvent e) {
6.56 + processUpdate();
6.57 + }
6.58 + public void changedUpdate(DocumentEvent e) {
6.59 + processUpdate();
6.60 + }
6.61 + private void processUpdate() {
6.62 + fireChange();
6.63 + }
6.64 + }
6.65 +
6.66 }
7.1 --- a/php.smarty/src/org/netbeans/modules/php/smarty/ui/options/SmartyOptionsPanelController.java Thu May 26 16:36:10 2011 +0400
7.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/ui/options/SmartyOptionsPanelController.java Tue Jun 14 17:07:43 2011 +0200
7.3 @@ -99,6 +99,12 @@
7.4 return false;
7.5 }
7.6
7.7 + // too deep level for scanning
7.8 + if (smartyOptionsPanel.getDepthOfScanning() > 1) {
7.9 + smartyOptionsPanel.setWarning(NbBundle.getMessage(SmartyOptionsPanel.class, "WRN_TooDeepScanningLevel"));
7.10 + return true;
7.11 + }
7.12 +
7.13 // everything ok
7.14 smartyOptionsPanel.setWarning(" "); // NOI18N
7.15 return true;