Package org.rssowl.ui.internal.undo

Examples of org.rssowl.ui.internal.undo.StickyOperation


    List<INews> newsList = ModelUtils.getEntities(fSelection, INews.class);
    if (newsList.isEmpty())
      return;

    /* Support Undo */
    UndoStack.getInstance().addOperation(new StickyOperation(newsList, fMarkSticky));

    /* Set Sticky State */
    for (INews newsItem : newsList) {
      newsItem.setFlagged(fMarkSticky);
    }
View Full Code Here


    /*  Toggle Sticky */
    else if (queryProvided && TOGGLE_STICKY_HANDLER_ID.equals(id)) {
      INews news = getNews(query);
      if (news != null) {
        Set<INews> singleNewsSet = Collections.singleton(news);
        UndoStack.getInstance().addOperation(new StickyOperation(singleNewsSet, !news.isFlagged()));
        news.setFlagged(!news.isFlagged());
        Controller.getDefault().getSavedSearchService().forceQuickUpdate();
        DynamicDAO.saveAll(singleNewsSet);
      }
    }
View Full Code Here

    IFeed feed = fFactory.createFeed(null, new URI("http://www.foo1.com"));
    INews news = fFactory.createNews(null, feed, new Date());
    news.setLink(new URI("http://www.news.com"));

    DynamicDAO.save(feed);
    UndoStack.getInstance().addOperation(new StickyOperation(Collections.singletonList(news), true));

    news.setFlagged(true);
    DynamicDAO.save(news);

    UndoStack.getInstance().undo();
View Full Code Here

    IFeed feed = fFactory.createFeed(null, new URI("http://www.foo1.com"));
    INews news = fFactory.createNews(null, feed, new Date());
    news.setLink(new URI("http://www.news.com"));

    DynamicDAO.save(feed);
    UndoStack.getInstance().addOperation(new StickyOperation(Collections.singletonList(news), true));

    news.setFlagged(true);
    DynamicDAO.save(news);

    UndoStack.getInstance().undo();

    assertEquals(false, news.isFlagged());
    assertEquals(true, UndoStack.getInstance().isRedoSupported());

    UndoStack.getInstance().addOperation(new StickyOperation(Collections.singletonList(news), true));

    assertEquals(false, UndoStack.getInstance().isRedoSupported());
  }
View Full Code Here

    news.setLink(new URI("http://www.news.com"));
    news.setState(INews.State.READ);

    DynamicDAO.save(feed);

    UndoStack.getInstance().addOperation(new StickyOperation(Collections.singletonList(news), true));
    news.setFlagged(true);
    DynamicDAO.save(news);

    for (int i = 0; i < 20; i++) {
      UndoStack.getInstance().addOperation(new NewsStateOperation(Collections.singletonList(news), i % 2 == 0 ? INews.State.UNREAD : INews.State.READ, false));
      DynamicDAO.getDAO(INewsDAO.class).setState(Collections.singletonList(news), i % 2 == 0 ? INews.State.UNREAD : INews.State.READ, false, false);
    }

    int undos = 0;
    while (UndoStack.getInstance().isUndoSupported()) {
      UndoStack.getInstance().undo();
      undos++;
    }

    assertEquals(true, news.toReference().resolve().isFlagged());
    assertEquals(20, undos);

    assertEquals(true, UndoStack.getInstance().isRedoSupported());

    int redos = 0;
    while (UndoStack.getInstance().isRedoSupported()) {
      UndoStack.getInstance().redo();
      redos++;
    }

    assertEquals(20, redos);

    while (UndoStack.getInstance().isUndoSupported()) {
      UndoStack.getInstance().undo();
    }

    UndoStack.getInstance().addOperation(new StickyOperation(Collections.singletonList(news), false));
    news.setFlagged(false);
    DynamicDAO.save(news);

    undos = 0;
    while (UndoStack.getInstance().isUndoSupported()) {
View Full Code Here

        if (isHeadlinesLayout())
          blur(Dynamic.TINY_TOGGLE_STICKY_LINK.getId(news), true);

        /* Toggle Sticky State */
        Set<INews> singleNewsSet = Collections.singleton(news);
        UndoStack.getInstance().addOperation(new StickyOperation(singleNewsSet, !news.isFlagged()));
        news.setFlagged(!news.isFlagged());
        Controller.getDefault().getSavedSearchService().forceQuickUpdate();
        DynamicDAO.saveAll(singleNewsSet);
      }
    }
View Full Code Here

    IFeed feed = fFactory.createFeed(null, new URI("http://www.foo1.com"));
    INews news = fFactory.createNews(null, feed, new Date());
    news.setLink(new URI("http://www.news.com"));

    DynamicDAO.save(feed);
    UndoStack.getInstance().addOperation(new StickyOperation(Collections.singletonList(news), true));

    news.setFlagged(true);
    DynamicDAO.save(news);

    UndoStack.getInstance().undo();
View Full Code Here

    IFeed feed = fFactory.createFeed(null, new URI("http://www.foo1.com"));
    INews news = fFactory.createNews(null, feed, new Date());
    news.setLink(new URI("http://www.news.com"));

    DynamicDAO.save(feed);
    UndoStack.getInstance().addOperation(new StickyOperation(Collections.singletonList(news), true));

    news.setFlagged(true);
    DynamicDAO.save(news);

    UndoStack.getInstance().undo();

    assertEquals(false, news.isFlagged());
    assertEquals(true, UndoStack.getInstance().isRedoSupported());

    UndoStack.getInstance().addOperation(new StickyOperation(Collections.singletonList(news), true));

    assertEquals(false, UndoStack.getInstance().isRedoSupported());
  }
View Full Code Here

    news.setLink(new URI("http://www.news.com"));
    news.setState(INews.State.READ);

    DynamicDAO.save(feed);

    UndoStack.getInstance().addOperation(new StickyOperation(Collections.singletonList(news), true));
    news.setFlagged(true);
    DynamicDAO.save(news);

    for (int i = 0; i < 20; i++) {
      UndoStack.getInstance().addOperation(new NewsStateOperation(Collections.singletonList(news), i % 2 == 0 ? INews.State.UNREAD : INews.State.READ, false));
      DynamicDAO.getDAO(INewsDAO.class).setState(Collections.singletonList(news), i % 2 == 0 ? INews.State.UNREAD : INews.State.READ, false, false);
    }

    int undos = 0;
    while (UndoStack.getInstance().isUndoSupported()) {
      UndoStack.getInstance().undo();
      undos++;
    }

    assertEquals(true, news.toReference().resolve().isFlagged());
    assertEquals(20, undos);

    assertEquals(true, UndoStack.getInstance().isRedoSupported());

    int redos = 0;
    while (UndoStack.getInstance().isRedoSupported()) {
      UndoStack.getInstance().redo();
      redos++;
    }

    assertEquals(20, redos);

    while (UndoStack.getInstance().isUndoSupported()) {
      UndoStack.getInstance().undo();
    }

    UndoStack.getInstance().addOperation(new StickyOperation(Collections.singletonList(news), false));
    news.setFlagged(false);
    DynamicDAO.save(news);

    undos = 0;
    while (UndoStack.getInstance().isUndoSupported()) {
View Full Code Here

    List<INews> newsList = ModelUtils.getEntities(fSelection, INews.class);
    if (newsList.isEmpty())
      return;

    /* Support Undo */
    UndoStack.getInstance().addOperation(new StickyOperation(newsList, fMarkSticky));

    /* Set Sticky State */
    for (INews newsItem : newsList) {
      newsItem.setFlagged(fMarkSticky);
    }
View Full Code Here

TOP

Related Classes of org.rssowl.ui.internal.undo.StickyOperation

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.