Skip to content

Commit 2f509a5

Browse files
committed
Merge branch 'nb73dev'
2 parents 6e0aa5c + b00e1e1 commit 2f509a5

5 files changed

Lines changed: 43 additions & 47 deletions

File tree

manifest.mf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ Manifest-Version: 1.0
22
OpenIDE-Module: org.netbeans.modules.php.wordpress
33
OpenIDE-Module-Layer: org/netbeans/modules/php/wordpress/resources/layer.xml
44
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/wordpress/Bundle.properties
5-
OpenIDE-Module-Specification-Version: 0.4.6
5+
OpenIDE-Module-Specification-Version: 0.4.7
66

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=e57dacac
1+
build.xml.data.CRC32=4bf0d9e8
22
build.xml.script.CRC32=f6cbff90
33
build.xml.stylesheet.CRC32=a56c6a5b@2.56.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=e57dacac
6+
nbproject/build-impl.xml.data.CRC32=4bf0d9e8
77
nbproject/build-impl.xml.script.CRC32=bfa38a5f
88
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.56.1

nbproject/project.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,6 @@
121121
<implementation-version/>
122122
</run-dependency>
123123
</dependency>
124-
<dependency>
125-
<code-name-base>org.netbeans.modules.php.project</code-name-base>
126-
<build-prerequisite/>
127-
<compile-dependency/>
128-
<run-dependency>
129-
<implementation-version/>
130-
</run-dependency>
131-
</dependency>
132124
<dependency>
133125
<code-name-base>org.netbeans.modules.projectapi</code-name-base>
134126
<build-prerequisite/>

src/org/netbeans/modules/php/wordpress/ui/logicalview/MVCNode.java

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,7 @@
4949
import java.util.logging.Level;
5050
import java.util.logging.Logger;
5151
import javax.swing.Action;
52-
import org.netbeans.modules.php.project.PhpProject;
53-
import org.netbeans.modules.php.project.ui.actions.DebugFileCommand;
54-
import org.netbeans.modules.php.project.ui.actions.DownloadCommand;
55-
import org.netbeans.modules.php.project.ui.actions.RunFileCommand;
56-
import org.netbeans.modules.php.project.ui.actions.RunTestCommand;
57-
import org.netbeans.modules.php.project.ui.actions.SyncCommand;
58-
import org.netbeans.modules.php.project.ui.actions.UploadCommand;
59-
import org.netbeans.modules.php.project.ui.actions.support.CommandUtils;
52+
import org.netbeans.modules.php.api.util.FileUtils;
6053
import org.netbeans.spi.project.ui.support.CommonProjectActions;
6154
import org.netbeans.spi.project.ui.support.FileSensitiveActions;
6255
import org.netbeans.spi.project.ui.support.ProjectSensitiveActions;
@@ -65,12 +58,14 @@
6558
import org.openide.actions.PasteAction;
6659
import org.openide.actions.ToolsAction;
6760
import org.openide.filesystems.FileObject;
61+
import org.openide.filesystems.FileUtil;
6862
import org.openide.loaders.DataFilter;
6963
import org.openide.loaders.DataFolder;
7064
import org.openide.loaders.DataObject;
7165
import org.openide.nodes.FilterNode;
7266
import org.openide.nodes.Node;
7367
import org.openide.util.ImageUtilities;
68+
import org.openide.util.NbBundle;
7469
import org.openide.util.actions.SystemAction;
7570
import org.openide.util.lookup.ProxyLookup;
7671

@@ -89,12 +84,12 @@ public class MVCNode extends FilterNode {
8984
* creates source root node based on specified DataFolder. Uses specified
9085
* name.
9186
*/
92-
MVCNode(PhpProject project, DataFolder folder, DataFilter filter, String name) {
93-
this(project, folder, new FilterNode(folder.getNodeDelegate(), folder.createNodeChildren(filter)), name);
87+
MVCNode(DataFolder folder, DataFilter filter, String name) {
88+
this(folder, new FilterNode(folder.getNodeDelegate(), folder.createNodeChildren(filter)), name);
9489
}
9590

96-
private MVCNode(PhpProject project, DataFolder folder, FilterNode node, String name) {
97-
super(node, new MVCNode.FolderChildren(project, node, false), new ProxyLookup(folder.getNodeDelegate().getLookup()));
91+
private MVCNode(DataFolder folder, FilterNode node, String name) {
92+
super(node, new MVCNode.FolderChildren(node, false), new ProxyLookup(folder.getNodeDelegate().getLookup()));
9893

9994
disableDelegation(DELEGATE_GET_DISPLAY_NAME | DELEGATE_SET_DISPLAY_NAME | DELEGATE_GET_SHORT_DESCRIPTION | DELEGATE_GET_ACTIONS);
10095
setDisplayName(name);
@@ -131,13 +126,18 @@ public boolean canDestroy() {
131126
}
132127

133128
@Override
129+
@NbBundle.Messages({
130+
"LBL_DownloadCommand=Download...",
131+
"LBL_UploadCommand=Upload...",
132+
"LBL_SyncCommand=Synchronize..."
133+
})
134134
public Action[] getActions(boolean context) {
135135
List<Action> actions = new ArrayList<Action>();
136136
actions.add(CommonProjectActions.newFileAction());
137137
actions.add(null);
138-
actions.add(FileSensitiveActions.fileCommandAction(DownloadCommand.ID, DownloadCommand.DISPLAY_NAME, null));
139-
actions.add(FileSensitiveActions.fileCommandAction(UploadCommand.ID, UploadCommand.DISPLAY_NAME, null));
140-
actions.add(FileSensitiveActions.fileCommandAction(SyncCommand.ID, SyncCommand.DISPLAY_NAME, null));
138+
actions.add(FileSensitiveActions.fileCommandAction("dowonload", Bundle.LBL_DownloadCommand(), null));
139+
actions.add(FileSensitiveActions.fileCommandAction("upload", Bundle.LBL_UploadCommand(), null));
140+
actions.add(FileSensitiveActions.fileCommandAction("synchronize", Bundle.LBL_SyncCommand(), null));
141141
actions.add(null);
142142
actions.add(SystemAction.get(FileSystemAction.class));
143143
actions.add(null);
@@ -155,9 +155,9 @@ public Action[] getActions(boolean context) {
155155
}
156156
static final Action[] COMMON_ACTIONS = new Action[]{
157157
null,
158-
FileSensitiveActions.fileCommandAction(DownloadCommand.ID, DownloadCommand.DISPLAY_NAME, null),
159-
FileSensitiveActions.fileCommandAction(UploadCommand.ID, UploadCommand.DISPLAY_NAME, null),
160-
FileSensitiveActions.fileCommandAction(SyncCommand.ID, SyncCommand.DISPLAY_NAME, null),};
158+
FileSensitiveActions.fileCommandAction("dowonload", Bundle.LBL_DownloadCommand(), null),
159+
FileSensitiveActions.fileCommandAction("upload", Bundle.LBL_UploadCommand(), null),
160+
FileSensitiveActions.fileCommandAction("synchronize", Bundle.LBL_SyncCommand(), null),};
161161

162162
public static Action createDownloadAction() {
163163
return COMMON_ACTIONS[1];
@@ -177,12 +177,10 @@ public static Action createSynchronizeAction() {
177177
private static class FolderChildren extends FilterNode.Children {
178178
// common actions for both PackageNode and ObjectNode (equals has to be the same)
179179

180-
private final PhpProject project;
181180
private final boolean isTest;
182181

183-
FolderChildren(PhpProject project, final Node originalNode, boolean isTest) {
182+
FolderChildren(final Node originalNode, boolean isTest) {
184183
super(originalNode);
185-
this.project = project;
186184
this.isTest = isTest;
187185
}
188186

@@ -200,16 +198,16 @@ protected Node copyNode(final Node originalNode) {
200198
return super.copyNode(originalNode);
201199
}
202200
if (fo.isFolder()) {
203-
return new MVCNode.PackageNode(project, originalNode, isTest);
201+
return new MVCNode.PackageNode(originalNode, isTest);
204202
}
205203
return new MVCNode.ObjectNode(originalNode, isTest);
206204
}
207205
}
208206

209207
private static final class PackageNode extends FilterNode {
210208

211-
public PackageNode(PhpProject project, final Node originalNode, boolean isTest) {
212-
super(originalNode, new MVCNode.FolderChildren(project, originalNode, isTest),
209+
public PackageNode(final Node originalNode, boolean isTest) {
210+
super(originalNode, new MVCNode.FolderChildren(originalNode, isTest),
213211
new ProxyLookup(originalNode.getLookup()));
214212

215213
}
@@ -290,15 +288,20 @@ public Action[] getActions(boolean context) {
290288
return actions.toArray(new Action[actions.size()]);
291289
}
292290

291+
@NbBundle.Messages({
292+
"LBL_RunProject=Run",
293+
"LBL_DebugProject=Debug",
294+
"LBL_TestFile=Test"
295+
})
293296
private Action[] getCommonActions() {
294297
List<Action> toAdd = new ArrayList<Action>();
295-
if (CommandUtils.isPhpOrHtmlFile(getFileObject())) {
298+
if (isPhpOrHtmlFile(getFileObject())) {
296299
// not available for multiple selected nodes => create new instance every time
297300
toAdd.add(null);
298-
toAdd.add(ProjectSensitiveActions.projectCommandAction(RunFileCommand.ID, RunFileCommand.DISPLAY_NAME, null));
299-
toAdd.add(ProjectSensitiveActions.projectCommandAction(DebugFileCommand.ID, DebugFileCommand.DISPLAY_NAME, null));
301+
toAdd.add(ProjectSensitiveActions.projectCommandAction("run.single", Bundle.LBL_RunProject(), null));
302+
toAdd.add(ProjectSensitiveActions.projectCommandAction("debug.single", Bundle.LBL_DebugProject(), null));
300303
if (!isTest) {
301-
toAdd.add(ProjectSensitiveActions.projectCommandAction(RunTestCommand.ID, RunTestCommand.DISPLAY_NAME, null));
304+
toAdd.add(ProjectSensitiveActions.projectCommandAction("test.single", Bundle.LBL_TestFile(), null));
302305
}
303306
}
304307

@@ -311,6 +314,12 @@ private Action[] getCommonActions() {
311314
return actions.toArray(new Action[actions.size()]);
312315
}
313316

317+
public static boolean isPhpOrHtmlFile(FileObject file) {
318+
assert file != null;
319+
String mimeType = FileUtil.getMIMEType(file, FileUtils.PHP_MIME_TYPE, "text/html");
320+
return FileUtils.PHP_MIME_TYPE.equals(mimeType) || "text/html".equals(mimeType);
321+
}
322+
314323
private FileObject getFileObject() {
315324
FileObject fileObject = originalNode.getLookup().lookup(FileObject.class);
316325
if (fileObject != null) {

src/org/netbeans/modules/php/wordpress/ui/logicalview/MVCNodeFactory.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
import javax.swing.event.ChangeListener;
5050
import org.netbeans.api.project.Project;
5151
import org.netbeans.modules.php.api.phpmodule.PhpModule;
52-
import org.netbeans.modules.php.project.PhpProject;
53-
import org.netbeans.modules.php.project.ui.logicalview.PhpSourcesFilter;
5452
import org.netbeans.modules.php.wordpress.util.WPFileUtils;
5553
import org.netbeans.modules.php.wordpress.util.WPUtils;
5654
import org.netbeans.spi.project.ui.support.NodeFactory;
@@ -72,22 +70,19 @@ public MVCNodeFactory() {
7270

7371
@Override
7472
public NodeList<?> createNodes(Project p) {
75-
final PhpProject project = p.getLookup().lookup(PhpProject.class);
7673
PhpModule phpModule = PhpModule.lookupPhpModule(p);
7774
if (WPUtils.isWP(phpModule)) {
78-
return new MVCNodeList(project, phpModule);
75+
return new MVCNodeList(phpModule);
7976
}
8077
return NodeFactorySupport.fixedNodeList();
8178
}
8279

8380
private static class MVCNodeList implements NodeList<FileObject> {
8481

8582
private PhpModule phpModule;
86-
private PhpProject project;
8783
private static final Logger LOGGER = Logger.getLogger(MVCNodeList.class.getName());
8884

89-
public MVCNodeList(PhpProject project, PhpModule phpModule) {
90-
this.project = project;
85+
public MVCNodeList(PhpModule phpModule) {
9186
this.phpModule = phpModule;
9287
}
9388

@@ -117,7 +112,7 @@ public Node node(FileObject key) {
117112
FileObject rootFolder = key;
118113
DataFolder folder = getFolder(rootFolder);
119114
if (folder != null) {
120-
node = new MVCNode(project, folder, new PhpSourcesFilter(project, rootFolder), key.getName());
115+
node = new MVCNode(folder, null, key.getName());
121116
}
122117
}
123118
return node;

0 commit comments

Comments
 (0)