Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 195706 | Differences between
and this patch

Collapse All | Expand All

(-)php.project/nbproject/project.xml (+17 lines)
 Lines 47-52    Link Here 
47
            <code-name-base>org.netbeans.modules.php.project</code-name-base>
47
            <code-name-base>org.netbeans.modules.php.project</code-name-base>
48
            <module-dependencies>
48
            <module-dependencies>
49
                <dependency>
49
                <dependency>
50
                    <code-name-base>org.apache.tools.ant.module</code-name-base>
51
                    <build-prerequisite/>
52
                    <compile-dependency/>
53
                    <run-dependency>
54
                        <release-version>3</release-version>
55
                        <specification-version>3.39</specification-version>
56
                    </run-dependency>
57
                </dependency>
58
                <dependency>
50
                    <code-name-base>org.netbeans.api.java.classpath</code-name-base>
59
                    <code-name-base>org.netbeans.api.java.classpath</code-name-base>
51
                    <build-prerequisite/>
60
                    <build-prerequisite/>
52
                    <compile-dependency/>
61
                    <compile-dependency/>
 Lines 255-260    Link Here 
255
                    </run-dependency>
264
                    </run-dependency>
256
                </dependency>
265
                </dependency>
257
                <dependency>
266
                <dependency>
267
                    <code-name-base>org.openide.execution</code-name-base>
268
                    <build-prerequisite/>
269
                    <compile-dependency/>
270
                    <run-dependency>
271
                        <specification-version>1.17</specification-version>
272
                    </run-dependency>
273
                </dependency>
274
                <dependency>
258
                    <code-name-base>org.openide.explorer</code-name-base>
275
                    <code-name-base>org.openide.explorer</code-name-base>
259
                    <build-prerequisite/>
276
                    <build-prerequisite/>
260
                    <compile-dependency/>
277
                    <compile-dependency/>
(-)php.project/src/org/netbeans/modules/php/project/PhpActionProvider.java (+4 lines)
 Lines 60-65    Link Here 
60
import org.netbeans.modules.php.project.ui.actions.RunTestCommand;
60
import org.netbeans.modules.php.project.ui.actions.RunTestCommand;
61
import org.netbeans.modules.php.project.ui.actions.TestProjectCommand;
61
import org.netbeans.modules.php.project.ui.actions.TestProjectCommand;
62
import org.netbeans.modules.php.project.ui.actions.UploadCommand;
62
import org.netbeans.modules.php.project.ui.actions.UploadCommand;
63
import org.netbeans.modules.php.project.ui.actions.BuildProjectCommand;
64
import org.netbeans.modules.php.project.ui.actions.RebuildProjectCommand;
63
import org.netbeans.spi.project.ActionProvider;
65
import org.netbeans.spi.project.ActionProvider;
64
import org.netbeans.spi.project.ui.support.FileSensitiveActions;
66
import org.netbeans.spi.project.ui.support.FileSensitiveActions;
65
import org.netbeans.spi.project.ui.support.ProjectSensitiveActions;
67
import org.netbeans.spi.project.ui.support.ProjectSensitiveActions;
 Lines 87-92    Link Here 
87
            new CopyCommand(project),
89
            new CopyCommand(project),
88
            new MoveCommand(project),
90
            new MoveCommand(project),
89
            new RenameCommand(project),
91
            new RenameCommand(project),
92
            new BuildProjectCommand(project),
93
            new RebuildProjectCommand(project),
90
94
91
            // file sensitive actions
95
            // file sensitive actions
92
            new DownloadCommand(project),
96
            new DownloadCommand(project),
(-)php.project/src/org/netbeans/modules/php/project/ui/actions/Bundle.properties (+2 lines)
 Lines 40-45    Link Here 
40
#DefaultAntProjectOperations:
40
#DefaultAntProjectOperations:
41
LBL_RunProject=Run
41
LBL_RunProject=Run
42
LBL_DebugProject=Debug
42
LBL_DebugProject=Debug
43
LBL_BuildProject=Build
44
LBL_RebuildProject=Rebuild
43
LBL_TestProject=Test
45
LBL_TestProject=Test
44
LBL_TestFile=Test
46
LBL_TestFile=Test
45
LBL_UploadCommand=Upload
47
LBL_UploadCommand=Upload
(-)php.project/src/org/netbeans/modules/php/project/ui/actions/support/ConfigAction.java (-1 / +107 lines)
 Lines 39-58    Link Here 
39
39
40
package org.netbeans.modules.php.project.ui.actions.support;
40
package org.netbeans.modules.php.project.ui.actions.support;
41
41
42
import java.io.IOException;
42
import java.util.logging.Logger;
43
import java.util.logging.Logger;
44
import org.apache.tools.ant.module.api.AntProjectCookie;
45
import org.apache.tools.ant.module.api.AntTargetExecutor;
46
import org.apache.tools.ant.module.api.AntTargetExecutor.Env;
43
import org.netbeans.modules.php.project.PhpProject;
47
import org.netbeans.modules.php.project.PhpProject;
44
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
48
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
45
import org.netbeans.modules.php.project.ui.customizer.CompositePanelProviderImpl;
49
import org.netbeans.modules.php.project.ui.customizer.CompositePanelProviderImpl;
46
import org.netbeans.modules.php.project.ui.customizer.CustomizerProviderImpl;
50
import org.netbeans.modules.php.project.ui.customizer.CustomizerProviderImpl;
47
import org.netbeans.modules.php.project.ui.customizer.PhpProjectProperties;
51
import org.netbeans.modules.php.project.ui.customizer.PhpProjectProperties;
52
import org.netbeans.spi.project.ui.support.BuildExecutionSupport;
53
import org.openide.execution.ExecutorTask;
48
import org.openide.filesystems.FileObject;
54
import org.openide.filesystems.FileObject;
55
import org.openide.loaders.DataObject;
56
import org.openide.loaders.DataObjectNotFoundException;
57
import org.openide.util.Exceptions;
49
import org.openide.util.Lookup;
58
import org.openide.util.Lookup;
59
import org.openide.util.Task;
60
import org.openide.util.TaskListener;
50
61
51
/**
62
/**
52
 * Common action for all the possible Run Configurations of a PHP project.
63
 * Common action for all the possible Run Configurations of a PHP project.
53
 * <p>
64
 * <p>
54
 * Meant to be stateless, so thread safe.
65
 * Meant to be stateless, so thread safe.
55
 * @author Tomas Mysik
66
 * @author Tomas Mysik, Phil Lello
56
 */
67
 */
57
public abstract class ConfigAction {
68
public abstract class ConfigAction {
58
    public static enum Type {
69
    public static enum Type {
 Lines 123-128    Link Here 
123
        return XDebugStarterFactory.getInstance() != null;
134
        return XDebugStarterFactory.getInstance() != null;
124
    }
135
    }
125
136
137
    // TODO: Decide how much effort these should put into detecting targets.
138
    // Testing for build.xml is cheap and easy, probing build.xml via XPath
139
    // to detect targets would be better, but then opens up a can of worms over
140
    // includes, etc.
141
    // It would probably be good to support Maven too.
142
    private DataObject getBuildXmlDataObject() {
143
        FileObject buildXml = project.getHelper().getProjectDirectory().getFileObject("build.xml");
144
        DataObject buildXmlDO = null;
145
        try {
146
            if (buildXml != null) buildXmlDO = DataObject.find(buildXml);
147
        } catch (DataObjectNotFoundException ex) {
148
        }
149
        return buildXmlDO;
150
    }
151
152
    private boolean isBuildXmlPresent() {
153
        return getBuildXmlDataObject() != null;
154
    }
155
156
    public boolean isBuildProjectEnabled() {
157
        return isBuildXmlPresent();
158
    }
159
160
    public boolean isRebuildProjectEnabled() {
161
        return isBuildXmlPresent();
162
    }
163
164
    public void buildProject() {
165
        try {
166
            new AntBuildExecutionSupportItem(getBuildXmlDataObject(), new String[]{"build"}).startRunning();
167
        } catch (IOException ex) {
168
            Exceptions.printStackTrace(ex);
169
        }
170
    }
171
172
    public void rebuildProject() {
173
        try {
174
            new AntBuildExecutionSupportItem(getBuildXmlDataObject(), new String[]{"rebuild"}).startRunning();
175
        } catch (IOException ex) {
176
            Exceptions.printStackTrace(ex);
177
        }
178
    }
179
126
    public abstract boolean isValid(boolean indexFileNeeded);
180
    public abstract boolean isValid(boolean indexFileNeeded);
127
181
128
    public abstract boolean isRunFileEnabled(Lookup context);
182
    public abstract boolean isRunFileEnabled(Lookup context);
 Lines 146-149    Link Here 
146
        }
200
        }
147
        return true;
201
        return true;
148
    }
202
    }
203
204
    private class AntBuildExecutionSupportItem implements BuildExecutionSupport.Item, TaskListener {
205
        private final AntTargetExecutor mTargetExecutor;
206
        private final String[] mTargets;
207
        private final AntProjectCookie mProjectCookie;
208
        private ExecutorTask mExecutorTask;
209
        
210
        AntBuildExecutionSupportItem(DataObject buildFileObject, String[] targets) {
211
            mProjectCookie = buildFileObject.getCookie(AntProjectCookie.class);
212
            mTargets = targets;
213
            mTargetExecutor = AntTargetExecutor.createTargetExecutor(new Env());
214
        }
215
    
216
        @Override
217
        public String getDisplayName() {
218
            return "Running Ant Build";
219
        }
220
    
221
        @Override
222
        public void repeatExecution() {
223
            stopRunning();
224
            try {
225
                startRunning();
226
            } catch (IOException ex) {
227
                Exceptions.printStackTrace(ex);
228
            }
229
        }
230
    
231
        @Override
232
        public boolean isRunning() {
233
            return (mExecutorTask == null)?false:true;
234
        }
235
    
236
        @Override
237
        public void stopRunning() {
238
            if (mExecutorTask != null) mExecutorTask.stop();
239
            mExecutorTask.waitFinished();
240
            taskFinished(mExecutorTask);
241
        }
242
    
243
        public void startRunning() throws IOException {
244
            mExecutorTask = mTargetExecutor.execute(mProjectCookie, mTargets);
245
            mExecutorTask.addTaskListener(this);
246
            BuildExecutionSupport.registerRunningItem(this);
247
        }
248
    
249
        @Override
250
        public void taskFinished(Task task) {
251
            mExecutorTask = null;
252
            BuildExecutionSupport.registerFinishedItem(this);
253
        }
254
    }
149
}
255
}

Return to bug 195706
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo