Skip to content

Commit 538f1d2

Browse files
committed
Support for RunCommand #16
1 parent 5c2f7d2 commit 538f1d2

15 files changed

Lines changed: 1474 additions & 72 deletions

nbproject/genfiles.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
build.xml.data.CRC32=351e2421
1+
build.xml.data.CRC32=c16cf6ec
22
build.xml.script.CRC32=f6cbff90
33
build.xml.stylesheet.CRC32=a56c6a5b@2.62.1
44
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
55
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6-
nbproject/build-impl.xml.data.CRC32=351e2421
6+
nbproject/build-impl.xml.data.CRC32=c16cf6ec
77
nbproject/build-impl.xml.script.CRC32=bfa38a5f
88
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.62.1

nbproject/project.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@
6969
<specification-version>1.29.1</specification-version>
7070
</run-dependency>
7171
</dependency>
72+
<dependency>
73+
<code-name-base>org.netbeans.modules.extexecution</code-name-base>
74+
<build-prerequisite/>
75+
<compile-dependency/>
76+
<run-dependency>
77+
<release-version>2</release-version>
78+
<specification-version>1.39.1</specification-version>
79+
</run-dependency>
80+
</dependency>
7281
<dependency>
7382
<code-name-base>org.netbeans.modules.lexer</code-name-base>
7483
<build-prerequisite/>
@@ -189,6 +198,14 @@
189198
<specification-version>8.5.1</specification-version>
190199
</run-dependency>
191200
</dependency>
201+
<dependency>
202+
<code-name-base>org.openide.io</code-name-base>
203+
<build-prerequisite/>
204+
<compile-dependency/>
205+
<run-dependency>
206+
<specification-version>1.42.1</specification-version>
207+
</run-dependency>
208+
</dependency>
192209
<dependency>
193210
<code-name-base>org.openide.loaders</code-name-base>
194211
<build-prerequisite/>

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,15 @@
4444
import java.util.ArrayList;
4545
import java.util.List;
4646
import javax.swing.Action;
47+
import org.netbeans.modules.php.api.util.StringUtils;
4748
import org.netbeans.modules.php.spi.framework.PhpModuleActionsExtender;
49+
import org.netbeans.modules.php.spi.framework.actions.RunCommandAction;
50+
import org.netbeans.modules.php.wordpress.commands.WordPressCli;
4851
import org.netbeans.modules.php.wordpress.ui.actions.CodeCompletionRefreshAction;
4952
import org.netbeans.modules.php.wordpress.ui.actions.CreatePluginAction;
5053
import org.netbeans.modules.php.wordpress.ui.actions.CreateThemeAction;
54+
import org.netbeans.modules.php.wordpress.ui.actions.WordPressRunCommandAction;
55+
import org.netbeans.modules.php.wordpress.ui.options.WordPressOptions;
5156
import org.openide.util.NbBundle;
5257

5358
/**
@@ -62,6 +67,20 @@ public String getMenuName() {
6267
return Bundle.LBL_MenuName();
6368
}
6469

70+
@Override
71+
public RunCommandAction getRunCommandAction() {
72+
// If wp-cli path is invalid, run command action is not added to context menu.
73+
String wpCliPath = WordPressOptions.getInstance().getWpCliPath();
74+
if (StringUtils.isEmpty(wpCliPath)) {
75+
return null;
76+
}
77+
String error = WordPressCli.validate(wpCliPath);
78+
if (error != null) {
79+
return null;
80+
}
81+
return WordPressRunCommandAction.getInstance();
82+
}
83+
6584
@Override
6685
public List<? extends Action> getActions() {
6786
List<Action> actions = new ArrayList<Action>();

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import org.netbeans.modules.php.spi.framework.PhpModuleExtender;
5757
import org.netbeans.modules.php.spi.framework.PhpModuleIgnoredFilesExtender;
5858
import org.netbeans.modules.php.spi.framework.commands.FrameworkCommandSupport;
59+
import org.netbeans.modules.php.wordpress.commands.WordPressCommandSupport;
5960
import org.netbeans.modules.php.wordpress.customizer.WordPressCustomizerExtender;
6061
import org.netbeans.modules.php.wordpress.editor.WordPressEditorExtender;
6162
import org.netbeans.modules.php.wordpress.preferences.WordPressPreferences;
@@ -160,7 +161,7 @@ public PhpModuleIgnoredFilesExtender getIgnoredFilesExtender(PhpModule pm) {
160161

161162
@Override
162163
public FrameworkCommandSupport getFrameworkCommandSupport(PhpModule pm) {
163-
return null;
164+
return new WordPressCommandSupport(pm);
164165
}
165166

166167
@Override

0 commit comments

Comments
 (0)