This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 46483
Collapse All | Expand All

(-)Actions.java (-8 / +39 lines)
Line 17 Link Here
17
import java.io.*;
Line 18 Link Here
19
import java.util.*;
Line 25 Link Here
27
import org.netbeans.api.java.project.*;
28
import org.netbeans.api.project.*;
Line 31 Link Here
35
import org.openide.filesystems.*;
Line 87 Link Here
92
		
Line 88 Link Here
94
95
		//	Set properties to the selected file if the command is *-single or debug.fix.
96
		
97
        Properties p = null;
98
		
99
		if (COMMAND_COMPILE_SINGLE.equals(command) || COMMAND_RUN_SINGLE.equals(command)
100
			|| COMMAND_DEBUG_SINGLE.equals(command) || JavaProjectConstants.COMMAND_DEBUG_FIX.equals(command)) {
101
			String path = null;
102
			SourceGroup[] groups = ProjectUtils.getSources(project).getSourceGroups("java");
103
			for (int gi = 0; gi < groups.length; ++gi) {
104
				FileObject root = groups[gi].getRootFolder();
105
				FileObject[] files = ActionUtils.findSelectedFiles(context, root, ".java", true); // NOI18N
106
				if (files != null && files.length > 0) {
107
	                path = FileUtil.getRelativePath(root, files[0]);
108
				}
109
			}
110
			if (path != null) {
111
				p = new Properties();
112
				p.setProperty("context.path", path);
113
				if (path.endsWith(".java")) {
114
					String base = path.substring(0, path.length()-5);
115
					p.setProperty("context.base", base);
116
					String clazz = base.replace('/', '.');
117
					p.setProperty("context.class", clazz);
118
				}
119
			}
120
		}
121
		
122
		
Line 97 Link Here
97
                runConfiguredAction(project, actionEl);
132
                runConfiguredAction(project, actionEl, p);
98
--
Line 107 Link Here
107
    private static void runConfiguredAction(FreeformProject project, Element actionEl) {
142
    private static void runConfiguredAction(FreeformProject project, Element actionEl, Properties props) {
108
--
Line 138 Link Here
138
            ActionUtils.runTarget(scriptFile, targetNameArray, null);
173
            ActionUtils.runTarget(scriptFile, targetNameArray, props);
139
--
Line 200 Link Here
200
            runConfiguredAction(p, actionEl);
235
            runConfiguredAction(p, actionEl, null);
201
--

Return to bug 46483