001: /*
002: * Gruntspud
003: *
004: * Copyright (C) 2002 Brett Smith.
005: *
006: * Written by: Brett Smith <t_magicthize@users.sourceforge.net>
007: *
008: * This program is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU Library General Public License
010: * as published by the Free Software Foundation; either version 2 of
011: * the License, or (at your option) any later version.
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU Library General Public License for more details.
016: *
017: * You should have received a copy of the GNU Library General Public
018: * License along with this program; if not, write to the Free Software
019: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
020: */
021:
022: package gruntspud;
023:
024: import gruntspud.style.TextStyle;
025:
026: import java.awt.Color;
027: import java.awt.Insets;
028: import java.awt.Window;
029: import java.io.File;
030: import java.io.IOException;
031: import java.net.URL;
032: import java.util.Properties;
033:
034: import javax.swing.Icon;
035: import javax.swing.JComponent;
036:
037: /**
038: * To formalise the use of Gruntspud as a plugin into other applications,
039: * the 'hosting' application must provide some basic services for
040: * Gruntspud. The services are actions that may differ in implementation
041: * depending on the 'Host'. The host must provide an implementation of this
042: * interface and pass it to the main Gruntspud class when it is constructed.
043: *
044: *@author magicthize
045: *@created 26 May 2002
046: */
047: public interface GruntspudHost {
048: /**
049: *
050: */
051: public boolean isExitActionAvailable();
052:
053: /**
054: *
055: */
056: public boolean canExit();
057:
058: /**
059: *
060: */
061: public void exit();
062:
063: /**
064: * DOCUMENT ME!
065: *
066: * @param key DOCUMENT ME!
067: *
068: * @return DOCUMENT ME!
069: */
070: public boolean isGeometryStored(String key);
071:
072: /**
073: * Gets the property attribute of the JEditPlugin object
074: *
075: *@param key Description of the Parameter
076: *@param defaultValue Description of the Parameter
077: *@return The property value
078: */
079: public JComponent getAccessoryComponent();
080:
081: /**
082: * Gets the property attribute of the JEditPlugin object
083: *
084: *@param key Description of the Parameter
085: *@param defaultValue Description of the Parameter
086: *@return The property value
087: */
088: public void unsetProperty(String key);
089:
090: /**
091: * Gets the property attribute of the JEditPlugin object
092: *
093: *@param key Description of the Parameter
094: *@param defaultValue Description of the Parameter
095: *@return The property value
096: */
097: public void reset();
098:
099: /**
100: * Gets the property attribute of the JEditPlugin object
101: *
102: *@param key Description of the Parameter
103: *@param defaultValue Description of the Parameter
104: *@return The property value
105: */
106: public Properties getProperties();
107:
108: /**
109: * Gets the property attribute of the JEditPlugin object
110: *
111: *@param key Description of the Parameter
112: *@param defaultValue Description of the Parameter
113: *@return The property value
114: */
115: public JComponent getMainComponent();
116:
117: /**
118: * Return the value of a property
119: *
120: *@param key Description of the Parameter
121: *@return The property value
122: */
123: public String getProperty(String key);
124:
125: /**
126: * Gets the property attribute of the GruntspudHost object
127: *
128: *@param key Description of the Parameter
129: *@param defaultValue Description of the Parameter
130: *@return The property value
131: */
132: public String getProperty(String key, String defaultValue);
133:
134: /**
135: * Gets the booleanProperty attribute of the GruntspudHost object
136: *
137: *@param key Description of the Parameter
138: *@return The booleanProperty value
139: */
140: public boolean getBooleanProperty(String key);
141:
142: /**
143: * Gets the booleanProperty attribute of the GruntspudHost object
144: *
145: *@param key Description of the Parameter
146: *@param defaultValue Description of the Parameter
147: *@return The booleanProperty value
148: */
149: public boolean getBooleanProperty(String key, boolean defaultValue);
150:
151: /**
152: * Gets the booleanProperty attribute of the GruntspudHost object
153: *
154: *@param key Description of the Parameter
155: *@return The booleanProperty value
156: */
157: public int getIntegerProperty(String key);
158:
159: /**
160: * Gets the booleanProperty attribute of the GruntspudHost object
161: *
162: *@param key Description of the Parameter
163: *@return The booleanProperty value
164: */
165: public int getIntegerProperty(String key, int defaultValue);
166:
167: /**
168: * Sets the property attribute of the GruntspudHost object
169: *
170: *@param key The new property value
171: *@param value The new property value
172: */
173: public void setProperty(String key, String value);
174:
175: /**
176: * Sets the booleanProperty attribute of the GruntspudHost object
177: *
178: *@param key The new booleanProperty value
179: *@param value The new booleanProperty value
180: */
181: public void setBooleanProperty(String key, boolean value);
182:
183: /**
184: * Sets the booleanProperty attribute of the GruntspudHost object
185: *
186: *@param key The new booleanProperty value
187: *@param value The new booleanProperty value
188: */
189: public void setIntegerProperty(String key, int value);
190:
191: /**
192: * Return the name of the host
193: *
194: *@param f Description of the Parameter
195: *@exception IOException Description of the Exception
196: */
197: public String getName();
198:
199: /**
200: * Description of the Method
201: *
202: *@param f Description of the Parameter
203: *@exception IOException Description of the Exception
204: */
205: public void openNode(CVSFileNode node) throws IOException;
206:
207: /**
208: * Description of the Method
209: *
210: *@param component Description of the Parameter
211: *@param key Description of the Parameter
212: */
213: public void saveGeometry(Window component, String key);
214:
215: /**
216: * Description of the Method
217: *
218: *@param component Description of the Parameter
219: *@param key Description of the Parameter
220: */
221: public void loadGeometry(Window component, String key);
222:
223: /**
224: * Gets the useCanonicalPaths attribute of the GruntspudHost object
225: *
226: *@return The useCanonicalPaths value
227: */
228: public boolean isUseCanonicalPaths();
229:
230: /**
231: * Description of the Method
232: *
233: *@param text Description of the Parameter
234: *@param message Description of the Parameter
235: */
236: public void writeToConsole(TextStyle style, String message);
237:
238: /**
239: * Description of the Method
240: *
241: *@param text Description of the Parameter
242: *@param message Description of the Parameter
243: */
244: public void writeToStatusLine(Color text, String message, Icon icon);
245:
246: /**
247: * Description of the Method
248: *
249: *@param text Description of the Parameter
250: *@param message Description of the Parameter
251: */
252: public void writeToInfoLine(Color text, String message, Icon icon);
253:
254: /**
255: * Description of the Method
256: *
257: *@param t Description of the Parameter
258: */
259: public void showException(Throwable t);
260:
261: /**
262: * Description of the Method
263: *
264: *@param t Description of the Parameter
265: *@param message Description of the Parameter
266: */
267: public void showException(Throwable t, String message);
268:
269: /**
270: * Gets the localizedString attribute of the GruntspudHost object
271: *
272: *@param name Description of the Parameter
273: *@param defaultValue Description of the Parameter
274: *@return The localizedString value
275: */
276: public String getLocalizedString(String name, String defaultValue);
277:
278: /**
279: * If this host is capable of performing a diff on two files, this
280: * method should return a name for the diff viewer. This will be
281: * presented when the user requests a diff as one of the 'viewers' that
282: * can be used to provided the differences.
283: *
284: *@return the name of the diff viewer
285: */
286: public String getDiffViewerName();
287:
288: /**
289: * Perform a diff on the two files. This will only be called if
290: * the host declared itself to be capable of performing a diff by
291: * returning a value other than <code>null</code> from the
292: * <code>getDiffViewerName()</code> method
293: *
294: *@param f1 Description of the Parameter
295: *@param f2 Description of the Parameter
296: */
297: public void diff(File f1, String title1, File f2, String title2,
298: String encoding);
299:
300: /**
301: * If this host is capable of displaying HTML, this method should return
302: * a name for the HTML viewer.
303: *
304: *@return the name of the diff viewer
305: */
306: public String getHTMLViewerName();
307:
308: /**
309: * View some HTML given a URL.
310: *
311: *@param u Description of the Parameter
312: */
313: public void viewHTML(URL u);
314:
315: /**
316: * Return a directory that may be used for temporary storage
317: *
318: *@return The tmpDir value
319: */
320: public File getTmpDir();
321:
322: /**
323: * Implement to show a dialog containing the preferences for Gruntspud.
324: */
325: public void showPreferences();
326:
327: /**
328: * Inform of when a command starts running and stops running
329: *
330: * @param commandRunning command is running
331: */
332: public void setCommandRunning(boolean commandRunning);
333:
334: /**
335: * DOCUMENT ME!
336: *
337: * @param resource DOCUMENT ME!
338: */
339: public void showHelp(String resource);
340:
341: /**
342: * DOCUMENT ME!
343: *
344: * @param resource DOCUMENT ME!
345: */
346: public void updateComponentTreeUI();
347:
348: /**
349: *
350: */
351: public Icon getIcon(String name);
352:
353: /**
354: *
355: */
356: public boolean isNodeOpenedInEditor(CVSFileNode node);
357:
358: /**
359: *
360: */
361: public TextStyle getNodeStyle(CVSFileNode node);
362:
363: public Insets getFileRendererInsets();
364:
365: }
|