Source code: org/aspectj/tools/ajde/jbuilder/BuildConfigNodeViewer.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 com.borland.primetime.ide.*;
29 import com.borland.primetime.viewer.*;
30 import javax.swing.*;
31 import org.aspectj.ajde.*;
32 import org.aspectj.ajde.ui.swing.AjdeUIManager;
33
34 public class BuildConfigNodeViewer extends AbstractNodeViewer {
35
36 JPanel panel = null;
37 private String file = "";
38
39 public BuildConfigNodeViewer(Context context) {
40 super(context);
41 file = context.getNode().getLongDisplayName();
42 }
43
44 public javax.swing.JComponent createStructureComponent() {
45 return null;
46 }
47
48 public javax.swing.JComponent createViewerComponent() {
49 try {
50 if (!JBuilderManager.INSTANCE.isEnabled() && Browser.getActiveBrowser() != null) {
51 Install.ajEnableAjdeAction.actionPerformed(Browser.getActiveBrowser());
52 }
53 AjdeUIManager.getDefault().getBuildConfigEditor().openFile(file);
54 panel = AjdeUIManager.getDefault().getBuildConfigEditor();
55 } catch (Exception e) {
56 Ajde.getDefault().getErrorHandler().handleError("Coud not edit config file: " + e.getMessage());
57 }
58 return panel;
59 }
60
61 public javax.swing.JComponent getViewerComponent() {
62 if (panel == null) {
63 return createViewerComponent();
64 } else {
65 return panel;
66 }
67 }
68
69 public String getViewerTitle() {
70 return "lst Designer";
71 }
72
73 public String getViewerDescription() {
74 return "Viwer for AspectJ Build Configuration File";
75 }
76
77 public javax.swing.JComponent getStructureComponent() {
78 return null;
79 }
80 }