|
50 | 50 | import java.util.logging.Logger; |
51 | 51 | import javax.swing.Action; |
52 | 52 | import org.netbeans.modules.php.api.util.FileUtils; |
| 53 | +import org.netbeans.modules.php.wordpress.modules.WordPressModule; |
| 54 | +import org.netbeans.modules.php.wordpress.ui.actions.CreateChildThemeAction; |
| 55 | +import org.netbeans.modules.php.wordpress.ui.actions.CreatePluginAction; |
| 56 | +import org.netbeans.modules.php.wordpress.ui.actions.CreateThemeAction; |
53 | 57 | import org.netbeans.spi.project.ui.support.CommonProjectActions; |
54 | 58 | import org.netbeans.spi.project.ui.support.FileSensitiveActions; |
55 | 59 | import org.netbeans.spi.project.ui.support.ProjectSensitiveActions; |
@@ -79,20 +83,22 @@ public class MVCNode extends FilterNode { |
79 | 83 |
|
80 | 84 | private static final String ICON_PATH = "org/netbeans/modules/php/wordpress/resources/wordpress_icon_8.png"; //NOI18N |
81 | 85 | private static final Image WP_ICON = ImageUtilities.loadImage(ICON_PATH); |
| 86 | + private final WordPressModule.DIR_TYPE type; |
82 | 87 |
|
83 | 88 | /** |
84 | 89 | * creates source root node based on specified DataFolder. Uses specified |
85 | 90 | * name. |
86 | 91 | */ |
87 | | - MVCNode(DataFolder folder, DataFilter filter, String name) { |
88 | | - this(folder, new FilterNode(folder.getNodeDelegate(), folder.createNodeChildren(filter)), name); |
| 92 | + MVCNode(DataFolder folder, DataFilter filter, String name, WordPressModule.DIR_TYPE type) { |
| 93 | + this(folder, new FilterNode(folder.getNodeDelegate(), folder.createNodeChildren(filter)), name, type); |
89 | 94 | } |
90 | 95 |
|
91 | | - private MVCNode(DataFolder folder, FilterNode node, String name) { |
| 96 | + private MVCNode(DataFolder folder, FilterNode node, String name, WordPressModule.DIR_TYPE type) { |
92 | 97 | super(node, new MVCNode.FolderChildren(node, false), new ProxyLookup(folder.getNodeDelegate().getLookup())); |
93 | 98 |
|
94 | 99 | disableDelegation(DELEGATE_GET_DISPLAY_NAME | DELEGATE_SET_DISPLAY_NAME | DELEGATE_GET_SHORT_DESCRIPTION | DELEGATE_GET_ACTIONS); |
95 | 100 | setDisplayName(name); |
| 101 | + this.type = type; |
96 | 102 | } |
97 | 103 |
|
98 | 104 | @Override |
@@ -134,6 +140,18 @@ public boolean canDestroy() { |
134 | 140 | public Action[] getActions(boolean context) { |
135 | 141 | List<Action> actions = new ArrayList<>(); |
136 | 142 | actions.add(CommonProjectActions.newFileAction()); |
| 143 | + // WordPress Actions |
| 144 | + switch (type) { |
| 145 | + case PLUGINS: |
| 146 | + actions.add(CreatePluginAction.getInstance()); |
| 147 | + break; |
| 148 | + case THEMES: |
| 149 | + actions.add(CreateThemeAction.getInstance()); |
| 150 | + actions.add(CreateChildThemeAction.getInstance()); |
| 151 | + break; |
| 152 | + default: |
| 153 | + break; |
| 154 | + } |
137 | 155 | actions.add(null); |
138 | 156 | actions.add(FileSensitiveActions.fileCommandAction("dowonload", Bundle.LBL_DownloadCommand(), null)); |
139 | 157 | actions.add(FileSensitiveActions.fileCommandAction("upload", Bundle.LBL_UploadCommand(), null)); |
|
0 commit comments