Source code: org/aspectj/tools/ajde/jbuilder/Actions.java
1 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * This file is part of the IDE support for the AspectJ(tm)
4 * programming language; see http://aspectj.org
5 *
6 * The contents of this file are subject to the Mozilla Public License
7 * Version 1.1 (the "License"); you may not use this file except in
8 * compliance with the License. You may obtain a copy of the License at
9 * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is AspectJ.
17 *
18 * The Initial Developer of the Original Code is Xerox Corporation. Portions
19 * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
20 * All Rights Reserved.
21 *
22 * Contributor(s):
23 */
24
25 package org.aspectj.tools.ajde.jbuilder;
26
27 import javax.swing.*;
28 import java.awt.*;
29 import java.awt.event.*;
30 import java.util.*;
31 import java.io.*;
32 import com.borland.primetime.ide.*;
33 import com.borland.primetime.actions.*;
34 import com.borland.primetime.ui.DefaultDialog;
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.viewer.*;
40 import com.borland.jbuilder.runtime.*;
41 import com.borland.primetime.runtime.*;
42 import com.borland.primetime.util.VetoException;
43 import com.borland.primetime.vfs.Url;
44 import org.aspectj.ajde.*;
45 import org.aspectj.ajde.ui.*;
46
47
48 /**
49 * This class represents all of the user actions that are made available by AJBuilder.
50 * <P>
51 * These actions should all be registered with the IDE by the <CODE>AJBuilder</CODE>
52 * OpenTools class. Each action should be associated with a button or icon that the
53 * user can press in the IDE.
54 *
55 * @author Mik Kersten
56 */
57
58 public class Actions {
59 /**
60 * Todo: fix code duplication with Listnerers.IDE_LISTENER.
61 */
62
63 // public static final AJDEBrowserAction TEST =
64 // new AJDEBrowserAction("Debug with ajdb", 'H', "Debug using AJDB", BrowserIcons.ICON_IDL_INITIALIZER) {
65 // public void actionPerformed(Browser browser) {
66 // Ajde.getDefault().getEditorManager().showSourcelineAnnotation(Browser.getActiveBrowser().getActiveNode().getLongDisplayName(), 2, null);
67 // }
68 // };
69
70 // public static final AJDEBrowserAction RUN =
71 // new AJDEBrowserAction("Run Project", 'H', "Run Project", JBuilderIcons.INSTANCE.getExecuteIcon()) {
72 // public void actionPerformed(Browser browser) {
73 // JBuilderManager.INSTANCE.run();
74 // }
75 // };
76
77 }
78
79 // public static final AJDEBrowserAction DEBUG =
80 // new AJDEBrowserAction("Debug with ajdb", 'H', "Debug with ajdb", JBuilderIcons.INSTANCE.getDebugIcon()) {
81 // public void actionPerformed(Browser browser) {
82 // //JBuilderManager.INSTANCE.debug();
83 // }
84 // };
85
86 //class CrosscutFinder {
87 //
88 // private org.aspectj.tools.ajde.jbuilder4.structureView.JBuilderActions jBuilderActions = new org.aspectj.tools.ajde.jbuilder4.structureView.JBuilderActions();
89 // private MessageCategory category = null;
90 // private MessageView messageView = null;
91 //
92 // public CrosscutFinder() {
93 // Browser.getActiveBrowser().getStatusView().setText("Searching for crosscuts...");
94 // JBuilderCompilerMessages compilerMessages = new JBuilderCompilerMessages("Crosscut-comment Finder");
95 //
96 // Vector files = JBuilderManager.getActiveManager().getProjectProperties().getProjectFiles();
97 // Vector messages = new Vector();
98 // for (int i = 0; i < files.size(); i++) {
99 // Vector newMessages = findMatches((String)files.elementAt(i));
100 // for (int j = 0; j < newMessages.size(); j++) {
101 // messages.add(newMessages.elementAt(j));
102 // }
103 // }
104 //
105 // String resultString = "";
106 // for (int k = 0; k < messages.size(); k++) {
107 // resultString += (String)messages.elementAt(k) + "\n";
108 // }
109 // compilerMessages.addCompilerMessages(new CompileResult(resultString));
110 // }
111 //
112 // public Vector findMatches(String filePath) {
113 // Vector lines = new Vector();
114 // try {
115 // BufferedReader reader = new BufferedReader(new FileReader(filePath));
116 // int i = 0;
117 // while (true) {
118 // String line = reader.readLine();
119 // if (line == null) break;
120 //
121 // if (line.indexOf("// CROSSCUT: ") != -1) {
122 // lines.add(filePath + ":" + i + ":xxx: " + line.trim().substring(12, line.trim().length()) +"\n");
123 // }
124 // i++;
125 // }
126 // } catch (Exception e) {
127 // . . .
128 // }
129 // return lines;
130 // }
131 //
132 // public void addMessage(String message, String filePath, int lineNumber) {
133 // messageView.addMessage(category, new Message(
134 // message,
135 // BrowserIcons.ICON_PROJECT,
136 // new CompilerMessageAction(
137 // filePath,
138 // lineNumber,
139 // new org.aspectj.tools.ajde.jbuilder4.structureView.JBuilderActions())));
140 // }
141 //}