Lines 26-32
Link Here
|
26 |
import java.beans.PropertyEditor; |
26 |
import java.beans.PropertyEditor; |
27 |
import java.io.IOException; |
27 |
import java.io.IOException; |
28 |
import java.util.*; |
28 |
import java.util.*; |
29 |
|
|
|
30 |
import org.openide.ErrorManager; |
29 |
import org.openide.ErrorManager; |
31 |
import org.openide.DialogDisplayer; |
30 |
import org.openide.DialogDisplayer; |
32 |
import org.openide.filesystems.FileObject; |
31 |
import org.openide.filesystems.FileObject; |
Lines 37-47
Link Here
|
37 |
import org.openide.DialogDescriptor; |
36 |
import org.openide.DialogDescriptor; |
38 |
import org.openide.util.NbBundle; |
37 |
import org.openide.util.NbBundle; |
39 |
import org.netbeans.api.java.classpath.ClassPath; |
38 |
import org.netbeans.api.java.classpath.ClassPath; |
40 |
|
39 |
import org.netbeans.api.java.project.JavaProjectConstants; |
|
|
40 |
import org.netbeans.api.project.FileOwnerQuery; |
41 |
import org.netbeans.api.project.Project; |
42 |
import org.netbeans.api.project.ProjectUtils; |
43 |
import org.netbeans.api.project.SourceGroup; |
44 |
import org.netbeans.api.project.Sources; |
41 |
import org.netbeans.modules.properties.*; |
45 |
import org.netbeans.modules.properties.*; |
42 |
import org.netbeans.modules.i18n.*; |
46 |
import org.netbeans.modules.i18n.*; |
43 |
import org.netbeans.modules.i18n.java.JavaResourceHolder; |
47 |
import org.netbeans.modules.i18n.java.JavaResourceHolder; |
44 |
|
|
|
45 |
import org.netbeans.modules.form.I18nService; |
48 |
import org.netbeans.modules.form.I18nService; |
46 |
import org.netbeans.modules.form.I18nValue; |
49 |
import org.netbeans.modules.form.I18nValue; |
47 |
|
50 |
|
Lines 461-478
Link Here
|
461 |
return null; |
464 |
return null; |
462 |
|
465 |
|
463 |
FileObject folder; |
466 |
FileObject folder; |
464 |
String fileName; |
|
|
465 |
ClassPath cp = ClassPath.getClassPath(srcDataObject.getPrimaryFile(), ClassPath.SOURCE); |
467 |
ClassPath cp = ClassPath.getClassPath(srcDataObject.getPrimaryFile(), ClassPath.SOURCE); |
|
|
468 |
FileObject root = cp.getRoots()[0]; |
469 |
String fileName; |
466 |
int idx = filePath.lastIndexOf('/'); |
470 |
int idx = filePath.lastIndexOf('/'); |
|
|
471 |
boolean hasCustomRes = false; |
472 |
Project owner = FileOwnerQuery.getOwner(srcDataObject.getPrimaryFile()); |
473 |
if (owner != null) { |
474 |
// this is for projects that have split sources/resources folder structures. |
475 |
Sources srcs = ProjectUtils.getSources(owner); |
476 |
SourceGroup[] grps = srcs.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_RESOURCES); |
477 |
if (grps != null && grps.length > 0) { |
478 |
hasCustomRes = true; |
479 |
root = grps[0].getRootFolder(); |
480 |
} |
481 |
} |
467 |
if (idx < 0) { // default package |
482 |
if (idx < 0) { // default package |
468 |
folder = cp.getRoots()[0]; |
483 |
folder = root; |
469 |
fileName = filePath; |
484 |
fileName = filePath; |
470 |
} |
485 |
} |
471 |
else { |
486 |
else { |
472 |
String folderPath = filePath.substring(0, idx); |
487 |
String folderPath = filePath.substring(0, idx); |
473 |
folder = cp.findResource(folderPath); |
488 |
folder = cp.findResource(folderPath); |
474 |
if (folder == null) { |
489 |
if (folder == null || hasCustomRes) { |
475 |
folder = FileUtil.createFolder(cp.getRoots()[0], folderPath); |
490 |
folder = FileUtil.createFolder(root, folderPath); |
476 |
} |
491 |
} |
477 |
fileName = filePath.substring(idx + 1); |
492 |
fileName = filePath.substring(idx + 1); |
478 |
} |
493 |
} |