Source code: org/aspectj/tools/ajde/jbuilder/AJRunAction.java
1
2 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3 *
4 * This file is part of the IDE support for the AspectJ(tm)
5 * programming language; see http://aspectj.org
6 *
7 * The contents of this file are subject to the Mozilla Public License
8 * Version 1.1 (the "License"); you may not use this file except in
9 * compliance with the License. You may obtain a copy of the License at
10 * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
11 *
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 * for the specific language governing rights and limitations under the
15 * License.
16 *
17 * The Original Code is AspectJ.
18 *
19 * The Initial Developer of the Original Code is Xerox Corporation. Portions
20 * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
21 * All Rights Reserved.
22 *
23 * Contributor(s):
24 */
25
26 package org.aspectj.tools.ajde.jbuilder;
27
28 import javax.swing.*;
29 import java.awt.*;
30 import java.awt.event.*;
31 import java.util.*;
32 import java.io.*;
33 import com.borland.primetime.ide.*;
34 import com.borland.primetime.actions.*;
35 import com.borland.primetime.node.*;
36 import com.borland.jbuilder.node.*;
37 import com.borland.primetime.editor.*;
38 import com.borland.primetime.ide.*;
39 import com.borland.primetime.vfs.*;
40 import com.borland.jbuilder.runtime.*;
41 import com.borland.primetime.runtime.*;
42 import com.borland.primetime.viewer.*;
43 import com.borland.primetime.properties.*;
44 import org.aspectj.ajde.*;
45 import org.aspectj.ajde.ui.*;
46
47 /**
48 * @author Mik Kersten
49 */
50 public class AJRunAction extends AJAction {
51
52 public AJRunAction(String p0, char p1, String p2, Icon p3) {
53 super(p0, p1, p2, p3);
54 }
55
56 public void actionPerformed(Browser browser) {
57 if (Ajde.getDefault().getProjectProperties().getClassToExecute().equals("")) {
58 Ajde.getDefault().getErrorHandler().handleWarning("Please set a class to run.");
59 BrowserFile.ACTION_EditProjectProperties.actionPerformed(Browser.getActiveBrowser());
60 JBuilderManager.INSTANCE.saveAll();
61 return;
62 }
63
64 RunConfiguration runConfig = new RunConfiguration(Browser.getActiveBrowser().getActiveProject(), 0);
65 new AspectJRunner().run(Browser.getActiveBrowser(), Browser.getActiveBrowser().getActiveProject(), runConfig.getMap(), false);
66
67 }
68
69 private class AspectJRunner extends JavaRunner {
70
71 public String getClassPath(JBProject project, java.util.Map propertyMap) {
72 return Ajde.getDefault().getProjectProperties().getClasspath();
73 }
74
75 public String getMainClassName(JBProject project, Map propertyMap) {
76 return Ajde.getDefault().getProjectProperties().getClassToExecute();
77 }
78
79 public String getParameters(JBProject p0, Map p1) {
80 return Ajde.getDefault().getProjectProperties().getExecutionArgs();
81 }
82
83 public String getVMParameters(JBProject project, Map propertyMap) {
84 return Ajde.getDefault().getProjectProperties().getVmArgs();
85 }
86
87 public PropertyPageFactory getPageFactory(Project project, Map propertyMap) {
88 return null;
89 }
90
91 public boolean isValid(Browser browser, Project project, Map propertyMap, boolean debug) {
92 return !debug;
93 }
94 }
95 }