Exemplo n.º 1
0
  public static void main(String[] args) throws Exception {
    Folder root = staticFunctionsTest.initConfig(config);

    // create F1
    File folder = new File(root.getLocalFile().getPath() + File.separator + ".ignore-folder1");
    if (!folder.exists()) {
      folder.mkdirs();
    }

    File f1 =
        staticFunctionsTest.createFile(
            root.getLocalFile().getPath()
                + File.separator
                + ".ignore-folder1"
                + File.separator
                + staticFunctionsTest.ignoreFileName1,
            "content1");

    File f2 =
        staticFunctionsTest.createFile(
            root.getLocalFile().getPath()
                + File.separator
                + ".ignore-folder1"
                + File.separator
                + staticFunctionsTest.fileName2,
            "content2");

    folder = new File(root.getLocalFile().getPath() + File.separator + "folder1");
    if (!folder.exists()) {
      folder.mkdirs();
    }

    File f3 =
        staticFunctionsTest.createFile(
            root.getLocalFile().getPath()
                + File.separator
                + "folder1"
                + File.separator
                + staticFunctionsTest.ignoreFileName1,
            "content2");

    staticFunctionsTest.indexNewRequest(root, folder, null);
    staticFunctionsTest.indexNewRequest(root, f1, null);
    staticFunctionsTest.indexNewRequest(root, f2, null);
    staticFunctionsTest.indexNewRequest(root, f3, null);

    System.out.println(
        "The result is: \n ignore folder1 exist with 2 files. \n 0 rows in database New.");
    while (true) {}
  }
Exemplo n.º 2
0
  private void initMenu(String initialMessage) {
    // Create
    menu = new PopupMenu();

    // Status
    itemStatus = new MenuItem(initialMessage);
    itemStatus.setEnabled(false);

    menu.add(itemStatus);

    // Profile and folders
    menu.addSeparator();

    Profile profile = config.getProfile();

    final Folder folder = profile.getFolder();
    if (folder != null && folder.isActive() && folder.getLocalFile() != null) {

      MenuItem itemFolder = new MenuItem(folder.getLocalFile().getName());

      itemFolder.addActionListener(
          new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
              fireTrayEvent(
                  new TrayEvent(
                      TrayEvent.EventType.OPEN_FOLDER, folder.getLocalFile().getAbsolutePath()));
            }
          });

      menu.add(itemFolder);
    }

    menu.addSeparator();

    // Preferences
    // itemPreferences = new MenuItem("Preferencias ...");
    // itemPreferences.addActionListener(new ActionListener() {

    //    @Override
    //    public void actionPerformed(ActionEvent ae) {
    //        fireTrayEvent(new TrayEvent(TrayEvent.EventType.PREFERENCES));
    //    }
    // });

    // menu.add(itemPreferences);

    // menu.addSeparator();
    itemWebsite = new MenuItem(resourceBundle.getString("tray_stacksync_website"));
    itemWebsite.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent ae) {
            fireTrayEvent(new TrayEvent(TrayEvent.EventType.WEBSITE));
          }
        });
    menu.add(itemWebsite);

    itemWebsite2 = new MenuItem(resourceBundle.getString("tray_ast_website"));
    itemWebsite2.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent ae) {
            fireTrayEvent(new TrayEvent(TrayEvent.EventType.WEBSITE2));
          }
        });
    menu.add(itemWebsite2);

    menu.addSeparator();

    // Quit
    itemQuit = new MenuItem(resourceBundle.getString("tray_exit"));
    itemQuit.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent ae) {
            fireTrayEvent(new TrayEvent(TrayEvent.EventType.QUIT));
          }
        });

    menu.add(itemQuit);
  }