Package net.sourceforge.squirrel_sql.client.util

Examples of net.sourceforge.squirrel_sql.client.util.ApplicationFiles


    final Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    // Label containing the location of the plugins at top of dialog.
    final JLabel pluginLoc = new JLabel(s_stringMgr.getString("PluginSummaryDialog.pluginloc",
          new ApplicationFiles().getPluginsDirectory().getAbsolutePath()));
    pluginLoc.setBorder(BorderFactory.createEmptyBorder(1, 4, 1, 4));

    contentPane.add(pluginLoc, BorderLayout.NORTH);

    // Table of loaded plugins in centre of dialog.
View Full Code Here


    final String internalName = getInternalName();
    if (internalName == null || internalName.trim().length() == 0)
    {
      throw new IllegalStateException("IPlugin doesn't have a valid internal name");
    }
    final File pluginDir = new ApplicationFiles().getPluginsDirectory();
    final File file = new File(pluginDir, internalName);
    if (!file.exists())
    {
      file.mkdirs();
    }
View Full Code Here

  /**
   * @see net.sourceforge.squirrel_sql.client.plugin.IPlugin#getPluginJarFilePath()
   */
  public synchronized String getPluginJarFilePath() throws IllegalStateException {
    final String internalName = getInternalName();
    final File pluginDir = new ApplicationFiles().getPluginsDirectory();
    if (internalName == null || internalName.trim().length() == 0)
    {
      throw new IllegalStateException("IPlugin doesn't have a valid internal name");
    }
    final File resultFile = new File(pluginDir, internalName + ".jar");
View Full Code Here

    if (internalName == null || internalName.trim().length() == 0)
    {
      throw new IllegalStateException("IPlugin doesn't have a valid internal name");
    }
    String name =
      new ApplicationFiles().getPluginsUserSettingsDirectory()
        + File.separator
        + internalName
        + File.separator;
    File file = new File(name);
    if (!file.exists())
View Full Code Here

   *
   * @return  The contents tree.
   */
  private JScrollPane createContentsTree() throws IOException
  {
    final ApplicationFiles appFiles = new ApplicationFiles();
        // i18n[HelpViewerWindow.help=Help]
    final FolderNode root = new FolderNode(s_stringMgr.getString("HelpViewerWindow.help"));
    _tree = new JTree(new DefaultTreeModel(root));
    _tree.setShowsRootHandles(true);
    _tree.addTreeSelectionListener(new ObjectTreeSelectionListener());

    // Renderer for tree.
    DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
    SquirrelResources rsrc = _app.getResources();
    renderer.setLeafIcon(rsrc.getIcon(SquirrelResources.IImageNames.HELP_TOPIC));
    renderer.setOpenIcon(rsrc.getIcon(SquirrelResources.IImageNames.HELP_TOC_OPEN));
    renderer.setClosedIcon(rsrc.getIcon(SquirrelResources.IImageNames.HELP_TOC_CLOSED));
    _tree.setCellRenderer(renderer);

     // First put the Welcome to SQuirreL node.
     File file = appFiles.getWelcomeFile();
     try
     {
            // i18n[HelpViewerWindow.welcome=Welcome]
       DocumentNode dn = new DocumentNode(s_stringMgr.getString("HelpViewerWindow.welcome"), file);
       root.add(dn);
       _nodes.put(dn.getURL().toString(), dn);
     }
     catch (MalformedURLException ex)
     {
            // i18n[HelpViewerWindow.error.loadwelcomefile=Error retrieving Welcome file URL for {0}]
         String msg =
             s_stringMgr.getString("HelpViewerWindow.error.loadwelcomefile",
                                      file.getAbsolutePath());
       s_log.error(msg, ex);
     }

    // Add Help, Licence and Change Log nodes to the tree.
        // i18n[HelpViewerWindow.help=Help]
    final FolderNode helpRoot = new FolderNode(s_stringMgr.getString("HelpViewerWindow.help"));
    root.add(helpRoot);
    _nodes.put(helpRoot.getURL().toString(), helpRoot);
        // i18n[HelpViewerWindow.licences=Licences]
    final FolderNode licenceRoot = new FolderNode(s_stringMgr.getString("HelpViewerWindow.licences"));
    root.add(licenceRoot);
    _nodes.put(licenceRoot.getURL().toString(), licenceRoot);
        // i18n[HelpViewerWindow.changelogs=Change Logs]
    final FolderNode changeLogRoot = new FolderNode(s_stringMgr.getString("HelpViewerWindow.changelogs"));
    root.add(changeLogRoot);
    _nodes.put(changeLogRoot.getURL().toString(), changeLogRoot);

    // Add SQuirreL help to the Help node.
    file = appFiles.getQuickStartGuideFile();
    try
    {
            // i18n[HelpViewerWindow.squirrel=SQuirreL]
      DocumentNode dn = new DocumentNode(s_stringMgr.getString("HelpViewerWindow.squirrel"), file);
      helpRoot.add(dn);
      _homeURL = dn.getURL();
      _nodes.put(_homeURL.toString(), dn);
    }
    catch (MalformedURLException ex)
    {
            // i18n[HelpViewerWindow.error.loadwelcomefile=Error retrieving Help file URL for {0}]
            String msg =
                s_stringMgr.getString("HelpViewerWindow.error.loadhelpfile",
                                      file.getAbsolutePath());
      s_log.error(msg, ex);
    }

    // Add SQuirreL Licence to the Licence node.
    file = appFiles.getLicenceFile();
    try
    {
            // i18n[HelpViewerWindow.squirrel=SQuirreL]
      DocumentNode dn = new DocumentNode(s_stringMgr.getString("HelpViewerWindow.squirrel"), file);
      licenceRoot.add(dn);
      _nodes.put(dn.getURL().toString(), dn);
    }
    catch (MalformedURLException ex)
    {
            // i18n[HelpViewerWindow.error.loadlicencefile=Error retrieving Licence file URL for {0}]
            String msg =
                s_stringMgr.getString("HelpViewerWindow.error.loadlicencefile",
                                      file.getAbsolutePath());
      s_log.error(msg, ex);
    }

    // Add SQuirreL Change Log to the Licence node.
    file = appFiles.getChangeLogFile();
    try
    {
            // i18n[HelpViewerWindow.squirrel=SQuirreL]
      DocumentNode dn = new DocumentNode(s_stringMgr.getString("HelpViewerWindow.squirrel"), file);
      changeLogRoot.add(dn);
      _nodes.put(dn.getURL().toString(), dn);
    }
    catch (MalformedURLException ex)
    {
            // i18n[HelpViewerWindow.error.loadchangelogfile=Error retrieving Change Log file URL for {0}]
            String msg =
                s_stringMgr.getString("HelpViewerWindow.error.loadchangelogfile",
                                      file.getAbsolutePath());
      s_log.error(msg, ex);
    }

    // Add plugin help, licence and change log documents to the tree.
    PluginInfo[] pi = _app.getPluginManager().getPluginInformation();
    for (int i = 0; i < pi.length; ++i)
    {
      try
      {
        final File dir = pi[i].getPlugin().getPluginAppSettingsFolder();
        final String title = pi[i].getDescriptiveName();

        // Help document.
        try
        {
          final String fn = pi[i].getHelpFileName();
          if (fn != null && fn.length() > 0)
          {
            DocumentNode dn = new DocumentNode(title, new File(dir, fn));
            helpRoot.add(dn);
            _nodes.put(dn.getURL().toString(), dn);
          }
        }
        catch (IOException ex)
        {
                    // i18n[HelpViewerWindow.error.loadpluginhelp=Error generating Help entry for plugin {0}]
                    String msg =
                        s_stringMgr.getString("HelpViewerWindow.error.loadpluginhelp",
                                              pi[i].getDescriptiveName());
          s_log.error(msg, ex);
        }

        // Licence document.
        try
        {
          final String fn = pi[i].getLicenceFileName();
          if (fn != null && fn.length() > 0)
          {
            DocumentNode dn = new DocumentNode(title, new File(dir, fn));
            licenceRoot.add(dn);
            _nodes.put(dn.getURL().toString(), dn);
          }
        }
        catch (IOException ex)
        {
                    // i18n[HelpViewerWindow.error.loadpluginlicence=Error generating Licence entry for plugin {0}]
                    String msg =
                        s_stringMgr.getString("HelpViewerWindow.error.loadpluginlicence",
                                              pi[i].getDescriptiveName());
          s_log.error(msg, ex);
        }

        try
        {
          // Change log.
          final String fn = pi[i].getChangeLogFileName();
          if (fn != null && fn.length() > 0)
          {
            DocumentNode dn = new DocumentNode(title, new File(dir, fn));
            changeLogRoot.add(dn);
            _nodes.put(dn.getURL().toString(), dn);
          }
        }
        catch (IOException ex)
        {
                    // i18n[HelpViewerWindow.error.loadchangelog=Error generating Change Log entry for plugin {0}]
                    String msg =
                        s_stringMgr.getString("HelpViewerWindow.error.loadchangelog",
                                              pi[i].getDescriptiveName());
          s_log.error(msg, ex);
        }
      }
      catch (IOException ex)
      {
                // i18n[HelpViewerWindow.error.loadpluginsettings=Error retrieving app settings folder for plugin {0}]
                String msg =
                    s_stringMgr.getString("HelpViewerWindow.error.loadpluginsettings",
                                          pi[i].getDescriptiveName());
        s_log.error(msg, ex);
      }
    }

    // FAQ.
    file = appFiles.getFAQFile();
    try
    {
            // i18n[HelpViewerWindow.faq=FAQ]
      DocumentNode dn = new DocumentNode(s_stringMgr.getString("HelpViewerWindow.faq"), file);
      root.add(dn);
View Full Code Here

  {
    DefaultTreeModel treeModel = (DefaultTreeModel) _tree.getModel();
    DefaultMutableTreeNode root = (DefaultMutableTreeNode) treeModel.getRoot();
    root.removeAllChildren();

    File file = new ApplicationFiles().getDatabaseAliasesTreeStructureFile();

    if (!readTreeStructureFile(root, file))
    {
      for (int i = 0; i < _aliasesListModel.size(); i++)
      {
View Full Code Here

         DefaultMutableTreeNode root = (DefaultMutableTreeNode) dtm.getRoot();

         AliasFolderState state = new AliasFolderState(root, _tree);

         XMLBeanWriter wrt = new XMLBeanWriter(state);
         wrt.save(new ApplicationFiles().getDatabaseAliasesTreeStructureFile());
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
      }
View Full Code Here

    {
      _prefs = app.getSquirrelPreferences();
      _plugins = app.getPluginManager().getPluginInformation();
      _appArgs = ApplicationArguments.getInstance().getRawArguments();
      _version = Version.getVersion();
      _pluginLoc = new ApplicationFiles().getPluginsDirectory().getAbsolutePath();
      URL[] urls = app.getPluginManager().getPluginURLs();
      _pluginURLs = new URLWrapper[urls.length];
      for (int i = 0; i < urls.length; ++i)
      {
        _pluginURLs[i] = new URLWrapper(urls[i]);
View Full Code Here

  public ExportConfigPreferences()
  {
    super();

    final File here = new File(".");
    final ApplicationFiles appFiles = new ApplicationFiles();
    _preferencesFileName = getFileName(here, appFiles.getUserPreferencesFile().getName());
    _driversFileName = getFileName(here, appFiles.getDatabaseDriversFile().getName());
    _aliasesFileName = getFileName(here, appFiles.getDatabaseAliasesFile().getName());
  }
View Full Code Here

      JOptionPane.showMessageDialog(app.getMainFrame(), msg);
    }

    URL[] sourceUrls = getUrlsToLoadI18nPropertiesFrom(workDir);

    String pluginDir = new ApplicationFiles().getPluginsDirectory().getPath();

    ArrayList<I18nProps> defaultI18nProps = new ArrayList<I18nProps>();
    ArrayList<I18nProps> localizedI18nProps = new ArrayList<I18nProps>();

    for (int i = 0; i < sourceUrls.length; i++)
View Full Code Here

TOP

Related Classes of net.sourceforge.squirrel_sql.client.util.ApplicationFiles

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.