001: package net.sourceforge.squirrel_sql.plugins.i18n;
002:
003: import net.sourceforge.squirrel_sql.client.gui.session.ObjectTreeInternalFrame;
004: import net.sourceforge.squirrel_sql.client.gui.session.SQLInternalFrame;
005: import net.sourceforge.squirrel_sql.client.plugin.DefaultSessionPlugin;
006: import net.sourceforge.squirrel_sql.client.plugin.PluginException;
007: import net.sourceforge.squirrel_sql.client.plugin.PluginResources;
008: import net.sourceforge.squirrel_sql.client.plugin.PluginSessionCallback;
009: import net.sourceforge.squirrel_sql.client.preferences.IGlobalPreferencesPanel;
010: import net.sourceforge.squirrel_sql.client.session.ISession;
011: import net.sourceforge.squirrel_sql.client.IApplication;
012:
013: /**
014: * The SQL Script plugin class.
015: */
016: public class I18nPlugin extends DefaultSessionPlugin {
017: private PluginResources _resources;
018: private I18nPanelController _i18nPanelController;
019:
020: /**
021: * Return the internal name of this plugin.
022: *
023: * @return the internal name of this plugin.
024: */
025: public String getInternalName() {
026: return "i18n";
027: }
028:
029: /**
030: * Return the descriptive name of this plugin.
031: *
032: * @return the descriptive name of this plugin.
033: */
034: public String getDescriptiveName() {
035: return "I18n Plugin";
036: }
037:
038: /**
039: * Returns the current version of this plugin.
040: *
041: * @return the current version of this plugin.
042: */
043: public String getVersion() {
044: return "1.0";
045: }
046:
047: /**
048: * Returns the authors name.
049: *
050: * @return the authors name.
051: */
052: public String getAuthor() {
053: return "Gerd Wagner";
054: }
055:
056: /**
057: * Returns the name of the change log for the plugin. This should
058: * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
059: * directory.
060: *
061: * @return the changelog file name or <TT>null</TT> if plugin doesn't have
062: * a change log.
063: */
064: public String getChangeLogFileName() {
065: return "changes.txt";
066: }
067:
068: /**
069: * Returns the name of the Help file for the plugin. This should
070: * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
071: * directory.
072: *
073: * @return the Help file name or <TT>null</TT> if plugin doesn't have
074: * a help file.
075: */
076: public String getHelpFileName() {
077: return "readme.txt";
078: }
079:
080: /**
081: * Returns the name of the Licence file for the plugin. This should
082: * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
083: * directory.
084: *
085: * @return the Licence file name or <TT>null</TT> if plugin doesn't have
086: * a licence file.
087: */
088: public String getLicenceFileName() {
089: return "licence.txt";
090: }
091:
092: /**
093: * @return Comma separated list of contributors.
094: */
095: public String getContributors() {
096: return "Rob Manning";
097: }
098:
099: /**
100: * Create preferences panel for the Global Preferences dialog.
101: *
102: * @return Preferences panel.
103: */
104: public IGlobalPreferencesPanel[] getGlobalPreferencePanels() {
105: if (null == _i18nPanelController) {
106: _i18nPanelController = new I18nPanelController(_resources);
107: }
108:
109: return new IGlobalPreferencesPanel[] { _i18nPanelController };
110: }
111:
112: /**
113: * Initialize this plugin.
114: */
115: public synchronized void initialize() throws PluginException {
116: _resources = new PluginResources(
117: "net.sourceforge.squirrel_sql.plugins.i18n.i18n", this );
118: }
119:
120: /**
121: * Called when a session started. Add commands to popup menu
122: * in object tree.
123: *
124: * @param session The session that is starting.
125: *
126: * @return An implementation of PluginSessionCallback or null to indicate
127: * the plugin does not work with this session
128: */
129: public PluginSessionCallback sessionStarted(ISession session) {
130: try {
131: return new PluginSessionCallback() {
132: public void sqlInternalFrameOpened(
133: SQLInternalFrame sqlInternalFrame, ISession sess) {
134: }
135:
136: public void objectTreeInternalFrameOpened(
137: ObjectTreeInternalFrame objectTreeInternalFrame,
138: ISession sess) {
139: }
140: };
141: } catch (Exception e) {
142: throw new RuntimeException(e);
143: }
144: }
145:
146: }
|