KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > tools > ajbrowser > BrowserProperties


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
27 package org.aspectj.tools.ajbrowser;
28
29 import java.util.*;
30 import java.io.*;
31 import org.aspectj.ajde.*;
32 import org.aspectj.ajde.ui.*;
33
34 public class BrowserProperties implements ProjectPropertiesAdapter {
35     
36     UserPreferencesAdapter preferencesAdapter = null;
37     
38     public BrowserProperties(UserPreferencesAdapter preferencesAdapter) {
39         this.preferencesAdapter = preferencesAdapter;
40     }
41
42     public String JavaDoc getLastOpenSourceFilePath() {
43         return preferencesAdapter.getProjectPreference("editor.lastOpenFile");
44     }
45
46     public void setLastOpenSourceFilePath(String JavaDoc value) {
47         preferencesAdapter.setProjectPreference("editor.lastOpenFile",value);
48     }
49
50     public String JavaDoc getLastOpenSourceLineNumber() {
51         return preferencesAdapter.getProjectPreference("editor.lastOpenLineNumber");
52     }
53
54     public void setLastOpenSourceLineNumber(String JavaDoc value) {
55         preferencesAdapter.setProjectPreference("editor.lastOpenLineNumber",value);
56     }
57
58     public List getBuildConfigFiles() {
59         return BrowserManager.getDefault().getConfigFiles();
60     }
61     
62     public String JavaDoc getDefaultBuildConfigFile() {
63         return null;
64     }
65
66     public String JavaDoc getLastActiveBuildConfigFile() {
67         return null;
68     }
69
70     public String JavaDoc getProjectName() {
71         return null;
72     }
73
74     public String JavaDoc getClassToExecute() {
75         return preferencesAdapter.getProjectPreference("runtime.mainClass");
76     }
77
78     public void setClassToExecute(String JavaDoc mainClass) {
79         preferencesAdapter.setProjectPreference("runtime.mainClass", mainClass);
80     }
81
82     public String JavaDoc getRootProjectDir() {
83         return new File(Ajde.getDefault().getConfigurationManager().getActiveConfigFile()).getParent();
84     }
85
86     public String JavaDoc getExecutionArgs() {
87         return null;
88     }
89
90     public List getProjectSourceFiles() {
91         return null;
92     }
93     
94     public String JavaDoc getVmArgs() {
95         return null;
96     }
97
98     public String JavaDoc getProjectSourcePath() {
99         return null;
100     }
101
102     public String JavaDoc getBootClasspath() {
103         return null;
104     }
105
106     public void setAjcOptions(String JavaDoc flags) {
107         preferencesAdapter.setProjectPreference("build.flags", flags);
108     }
109
110     public String JavaDoc getAjcOptions() {
111         return preferencesAdapter.getProjectPreference("build.flags");
112     }
113
114     public String JavaDoc getOutputPath() {
115         String JavaDoc outputPath = preferencesAdapter.getProjectPreference("build.outputpath");
116         if (outputPath == null) {
117             return ".";
118         } else {
119             return outputPath;
120         }
121     }
122
123     public void setOutputPath(String JavaDoc path) {
124         preferencesAdapter.setProjectPreference("build.outputpath", path);
125     }
126
127     public String JavaDoc getUserClasspath() {
128         return preferencesAdapter.getProjectPreference("build.classpath");
129     }
130
131     public String JavaDoc getClasspath() {
132         String JavaDoc systemPath = System.getProperty("java.class.path", ".");
133         String JavaDoc userPath = preferencesAdapter.getProjectPreference("build.classpath");
134         return userPath + File.pathSeparator + systemPath;
135     }
136
137     public void setClasspath(String JavaDoc path) {
138         preferencesAdapter.setProjectPreference("build.classpath", path);
139     }
140
141     public String JavaDoc getAjcWorkingDir() {
142         String JavaDoc workingDir = preferencesAdapter.getProjectPreference("build.workingdir");
143         if (workingDir == null || workingDir.equals(getOutputPath())) {
144             return getOutputPath() + "./ajworkingdir";
145         } else {
146             return workingDir;
147         }
148     }
149
150     public void setAjcWorkingDir(String JavaDoc path) {
151         preferencesAdapter.setProjectPreference("build.workingdir", path);
152     }
153 }
154
Popular Tags