Skip to content

Commit fe7741c

Browse files
committed
Check Options value #22
1 parent 5465d6f commit fe7741c

5 files changed

Lines changed: 51 additions & 23 deletions

File tree

src/org/netbeans/modules/php/wordpress/WordPressCoreUpgradeChecker.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ public WordPressCoreUpgradeChecker() {
7979

8080
@Override
8181
public boolean hasUpgrade(PhpModule phpModule) {
82+
if (!WordPressOptions.getInstance().isCheckCoreNewVersion()) {
83+
return false;
84+
}
85+
8286
try {
8387
if (StringUtils.isEmpty(upgradeVersionNumber)) {
8488
WordPressVersionCheckApi versionCheckApi = new WordPressVersionCheckApi();

src/org/netbeans/modules/php/wordpress/ui/options/Bundle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ WordPressOptionsPanel.wpCliGetCommandsOnBootCheckBox.text=Get command list on Bo
2323
WordPressOptionsPanel.generalLabel.text=General:
2424
WordPressOptionsPanel.localeLabel.text=locale:
2525
WordPressOptionsPanel.localeTextField.text=
26-
WordPressOptionsPanel.checkNewVersionCheckBox.text=Check new version when project is opened
26+
WordPressOptionsPanel.checkNewVersionLabel.text=Check new version when project is opened:
27+
WordPressOptionsPanel.checkCoreNewVersionCheckBox.text=core

src/org/netbeans/modules/php/wordpress/ui/options/WordPressOptions.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class WordPressOptions {
5555
private static final WordPressOptions INSTANCE = new WordPressOptions();
5656
private static final String PREFERENCES_PATH = "wordpress"; // NOI18N
5757
private static final String LOCALE = "locale"; // NOI18N
58-
private static final String CHECK_NEW_VERSION = "check.new.version"; // NOI18N
58+
private static final String CHECK_CORE_NEW_VERSION = "check.core.new.version"; // NOI18N
5959
private static final String DOWNLOAD_URL = "download.url"; // NOI18N
6060
private static final String LOCAL_FILE_PATH = "local.file.path"; // NOI18N
6161
private static final String WP_CLI_PATH = "wp-cli.path"; // NOI18N
@@ -83,12 +83,12 @@ public void setWpLocale(String locale) {
8383
getPreferences().put(LOCALE, locale);
8484
}
8585

86-
public boolean isCheckNewVersion() {
87-
return getPreferences().getBoolean(CHECK_NEW_VERSION, true);
86+
public boolean isCheckCoreNewVersion() {
87+
return getPreferences().getBoolean(CHECK_CORE_NEW_VERSION, true);
8888
}
8989

90-
public void setCheckNewVersion(boolean check) {
91-
getPreferences().putBoolean(CHECK_NEW_VERSION, check);
90+
public void setCheckCoreNewVersion(boolean check) {
91+
getPreferences().putBoolean(CHECK_CORE_NEW_VERSION, check);
9292
}
9393

9494
public synchronized String getDownloadUrl() {

src/org/netbeans/modules/php/wordpress/ui/options/WordPressOptionsPanel.form

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
<Component id="wpCliDownloadVersionTextField" min="-2" pref="100" max="-2" attributes="0"/>
9696
</Group>
9797
</Group>
98-
<EmptySpace min="0" pref="22" max="32767" attributes="0"/>
98+
<EmptySpace min="0" pref="66" max="32767" attributes="0"/>
9999
</Group>
100100
</Group>
101101
<EmptySpace max="-2" attributes="0"/>
@@ -110,7 +110,11 @@
110110
<Group type="102" alignment="0" attributes="0">
111111
<EmptySpace min="12" pref="12" max="-2" attributes="0"/>
112112
<Group type="103" groupAlignment="0" attributes="0">
113-
<Component id="checkNewVersionCheckBox" min="-2" max="-2" attributes="0"/>
113+
<Group type="102" attributes="0">
114+
<Component id="checkNewVersionLabel" min="-2" max="-2" attributes="0"/>
115+
<EmptySpace max="-2" attributes="0"/>
116+
<Component id="checkCoreNewVersionCheckBox" min="-2" max="-2" attributes="0"/>
117+
</Group>
114118
<Group type="102" attributes="0">
115119
<Component id="localeLabel" min="-2" max="-2" attributes="0"/>
116120
<EmptySpace max="-2" attributes="0"/>
@@ -140,7 +144,10 @@
140144
<Component id="localeTextField" alignment="3" min="-2" max="-2" attributes="0"/>
141145
</Group>
142146
<EmptySpace max="-2" attributes="0"/>
143-
<Component id="checkNewVersionCheckBox" min="-2" max="-2" attributes="0"/>
147+
<Group type="103" groupAlignment="3" attributes="0">
148+
<Component id="checkCoreNewVersionCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
149+
<Component id="checkNewVersionLabel" alignment="3" min="-2" max="-2" attributes="0"/>
150+
</Group>
144151
<EmptySpace max="-2" attributes="0"/>
145152
<Group type="103" groupAlignment="1" attributes="0">
146153
<Group type="102" attributes="0">
@@ -391,10 +398,17 @@
391398
</Component>
392399
<Component class="javax.swing.JSeparator" name="newProjectSeparator1">
393400
</Component>
394-
<Component class="javax.swing.JCheckBox" name="checkNewVersionCheckBox">
401+
<Component class="javax.swing.JCheckBox" name="checkCoreNewVersionCheckBox">
402+
<Properties>
403+
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
404+
<ResourceString bundle="org/netbeans/modules/php/wordpress/ui/options/Bundle.properties" key="WordPressOptionsPanel.checkCoreNewVersionCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
405+
</Property>
406+
</Properties>
407+
</Component>
408+
<Component class="javax.swing.JLabel" name="checkNewVersionLabel">
395409
<Properties>
396410
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
397-
<ResourceString bundle="org/netbeans/modules/php/wordpress/ui/options/Bundle.properties" key="WordPressOptionsPanel.checkNewVersionCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
411+
<ResourceString bundle="org/netbeans/modules/php/wordpress/ui/options/Bundle.properties" key="WordPressOptionsPanel.checkNewVersionLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
398412
</Property>
399413
</Properties>
400414
</Component>

src/org/netbeans/modules/php/wordpress/ui/options/WordPressOptionsPanel.java

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ public void setWpLocale(String locale) {
122122
localeTextField.setText(locale);
123123
}
124124

125-
public boolean isCheckNewVersion() {
126-
return checkNewVersionCheckBox.isSelected();
125+
public boolean isCheckCoreNewVersion() {
126+
return checkCoreNewVersionCheckBox.isSelected();
127127
}
128128

129-
public void setCheckNewVersion(boolean check) {
130-
checkNewVersionCheckBox.setSelected(check);
129+
public void setCheckCoreNewVersion(boolean check) {
130+
checkCoreNewVersionCheckBox.setSelected(check);
131131
}
132132

133133
public String getWpCliPath() {
@@ -248,7 +248,8 @@ private void initComponents() {
248248
localeLabel = new javax.swing.JLabel();
249249
localeTextField = new javax.swing.JTextField();
250250
newProjectSeparator1 = new javax.swing.JSeparator();
251-
checkNewVersionCheckBox = new javax.swing.JCheckBox();
251+
checkCoreNewVersionCheckBox = new javax.swing.JCheckBox();
252+
checkNewVersionLabel = new javax.swing.JLabel();
252253

253254
org.openide.awt.Mnemonics.setLocalizedText(newProjectLabel, org.openide.util.NbBundle.getMessage(WordPressOptionsPanel.class, "WordPressOptionsPanel.newProjectLabel.text")); // NOI18N
254255

@@ -323,7 +324,9 @@ public void mousePressed(java.awt.event.MouseEvent evt) {
323324

324325
localeTextField.setText(org.openide.util.NbBundle.getMessage(WordPressOptionsPanel.class, "WordPressOptionsPanel.localeTextField.text")); // NOI18N
325326

326-
org.openide.awt.Mnemonics.setLocalizedText(checkNewVersionCheckBox, org.openide.util.NbBundle.getMessage(WordPressOptionsPanel.class, "WordPressOptionsPanel.checkNewVersionCheckBox.text")); // NOI18N
327+
org.openide.awt.Mnemonics.setLocalizedText(checkCoreNewVersionCheckBox, org.openide.util.NbBundle.getMessage(WordPressOptionsPanel.class, "WordPressOptionsPanel.checkCoreNewVersionCheckBox.text")); // NOI18N
328+
329+
org.openide.awt.Mnemonics.setLocalizedText(checkNewVersionLabel, org.openide.util.NbBundle.getMessage(WordPressOptionsPanel.class, "WordPressOptionsPanel.checkNewVersionLabel.text")); // NOI18N
327330

328331
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
329332
this.setLayout(layout);
@@ -392,7 +395,7 @@ public void mousePressed(java.awt.event.MouseEvent evt) {
392395
.addComponent(wpCliDownloadVersionLabel)
393396
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
394397
.addComponent(wpCliDownloadVersionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
395-
.addGap(0, 22, Short.MAX_VALUE)))
398+
.addGap(0, 66, Short.MAX_VALUE)))
396399
.addContainerGap())
397400
.addGroup(layout.createSequentialGroup()
398401
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -403,7 +406,10 @@ public void mousePressed(java.awt.event.MouseEvent evt) {
403406
.addGroup(layout.createSequentialGroup()
404407
.addGap(12, 12, 12)
405408
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
406-
.addComponent(checkNewVersionCheckBox)
409+
.addGroup(layout.createSequentialGroup()
410+
.addComponent(checkNewVersionLabel)
411+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
412+
.addComponent(checkCoreNewVersionCheckBox))
407413
.addGroup(layout.createSequentialGroup()
408414
.addComponent(localeLabel)
409415
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@@ -423,7 +429,9 @@ public void mousePressed(java.awt.event.MouseEvent evt) {
423429
.addComponent(localeLabel)
424430
.addComponent(localeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
425431
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
426-
.addComponent(checkNewVersionCheckBox)
432+
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
433+
.addComponent(checkCoreNewVersionCheckBox)
434+
.addComponent(checkNewVersionLabel))
427435
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
428436
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
429437
.addGroup(layout.createSequentialGroup()
@@ -549,7 +557,7 @@ private void learnMoreWpCliLabelMouseEntered(java.awt.event.MouseEvent evt) {//G
549557

550558
void load() {
551559
setWpLocale(getOptions().getWpLocale());
552-
setCheckNewVersion(getOptions().isCheckNewVersion());
560+
setCheckCoreNewVersion(getOptions().isCheckCoreNewVersion());
553561
setUrl(getOptions().getDownloadUrl());
554562
setLocalPath(getOptions().getLocalFilePath());
555563
wpCliPath = getOptions().getWpCliPath();
@@ -562,7 +570,7 @@ void load() {
562570

563571
void store() {
564572
getOptions().setWpLocale(getWpLocale());
565-
getOptions().setCheckNewVersion(isCheckNewVersion());
573+
getOptions().setCheckCoreNewVersion(isCheckCoreNewVersion());
566574
String url = downloadUrlTextField.getText();
567575
String localFile = localFileTextField.getText();
568576

@@ -642,7 +650,8 @@ boolean valid() {
642650
}
643651
// Variables declaration - do not modify//GEN-BEGIN:variables
644652
private javax.swing.JButton browseButton;
645-
private javax.swing.JCheckBox checkNewVersionCheckBox;
653+
private javax.swing.JCheckBox checkCoreNewVersionCheckBox;
654+
private javax.swing.JLabel checkNewVersionLabel;
646655
private javax.swing.JLabel downloadUrlLabel;
647656
private javax.swing.JTextField downloadUrlTextField;
648657
private javax.swing.JLabel errorLabel;

0 commit comments

Comments
 (0)