Package net.sourceforge.ztail.modules.bookmark.data

Examples of net.sourceforge.ztail.modules.bookmark.data.BookmarkItem


      win.setName(sess.getSession().getFile().getName());
     
      win.setSaveAction(new UXAbstractAction() {
        @Override
        public void doAction() {
          BookmarkItem bookmark = new BookmarkItem();
          bookmark.setName(win.getName());
          bookmark.setNrOfLines(10);
         
          BookmarkFolder folder = win.getSelectedFolder();
          if (folder == null) {
            UXMessages.getInstance()
              .showWarningMessage("Please select a folder where the bookmark will be stored");
            return;
          }
         
          bookmark.setFolder(win.getSelectedFolder());
         
          try {
            bookmark.setUri(new URI(win.getURI()));
          } catch (URISyntaxException e) {
            e.printStackTrace();
            UXMessages.getInstance().showWarningMessage(e);
            return;
          }
         
          try {
            BookmarkService.instance().save(bookmark);
            bookmark.getFolder().addBookmark(bookmark);
          } catch (ServiceException e) {
            e.printStackTrace();
            UXMessages.getInstance().showErrorMessage(e);
          }
         
View Full Code Here


    }
  }
 
  public void editBookmarkReq(final BookmarkManagerWin mWin) {
    final LocalBookmarkPropWin win = new LocalBookmarkPropWin(Display.getCurrent().getActiveShell());
    final BookmarkItem bookmark = mWin.getSelectedBookmark();
   
    if (bookmark == null) {
      UXMessages.getInstance().showWarningMessage("You must select bookmark to be able edit it!");
      return;
    }
   
    win.setURI(bookmark.getUri().toString());
    win.setName(bookmark.getName());
    win.setSelectedFolder(bookmark.getFolder());
   
    win.setSaveAction(new UXAbstractAction() {
      @Override
      public void doAction() {
        // Create an old bookmark object for transaction.
        BookmarkItem oldBookmark = new BookmarkItem();
        oldBookmark.setName(bookmark.getName());
        oldBookmark.setUri(bookmark.getUri());
        oldBookmark.setNrOfLines(bookmark.getNrOfLines());
        oldBookmark.setAutoOpen(bookmark.isAutoOpen());
        oldBookmark.setFolder(bookmark.getFolder());
       
        bookmark.setName(win.getName());
        bookmark.setNrOfLines(10);
       
        BookmarkFolder folder = win.getSelectedFolder();
        if (folder == null) {
          UXMessages.getInstance()
            .showWarningMessage("Please select a folder where the bookmark will be stored!");
          return;
        }
       
        bookmark.getFolder().removeBookmark(bookmark);
        bookmark.setFolder(win.getSelectedFolder());
       
        try {
          bookmark.setUri(new URI(win.getURI()));
          BookmarkService.instance().update(bookmark);
          bookmark.getFolder().addBookmark(bookmark);
        } catch (Exception e) {
          e.printStackTrace();
          UXMessages.getInstance().showWarningMessage(e);
         
          bookmark.setName(oldBookmark.getName());
          bookmark.setUri(oldBookmark.getUri());
          bookmark.setNrOfLines(oldBookmark.getNrOfLines());
          bookmark.setAutoOpen(oldBookmark.isAutoOpen());
          bookmark.setFolder(oldBookmark.getFolder());
          bookmark.getFolder().addBookmark(bookmark);
          return;
        }
       
        win.close();
View Full Code Here

   
    win.open();
  }
 
  public void removeBookmarkReq(final BookmarkManagerWin mWin) {
    final BookmarkItem bookmark = mWin.getSelectedBookmark();
   
    if (bookmark == null) {
      UXMessages.getInstance()
        .showWarningMessage("Please select a bookmark to be able to remove it!");
      return;
    }
   
    final UXConfirmWindow win =
      new UXConfirmWindow(mWin.getShell(), "Bookmark", "You are sure you want to remove bookmark?");
   
    win.setOkAction(new UXAbstractAction() {
      @Override
      public void doAction() {
        try {
          BookmarkService.instance().remove(bookmark);
          bookmark.getFolder().removeBookmark(bookmark);
          mWin.refreshTree();
        } catch (ServiceException e) {
          UXMessages.getInstance().showErrorMessage(e);
        } finally {
          win.close();
View Full Code Here

    });
    win.open();
  }
 
  public void openBookmarkReq(final BookmarkManagerWin mWin) {
    BookmarkItem bookmark = mWin.getSelectedBookmark();
   
    if (bookmark == null) return;
   
    TabPanelController.instance().openLocalFileReq(bookmark.getUri(), bookmark.getNrOfLines());
    mWin.close();
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.ztail.modules.bookmark.data.BookmarkItem

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.