Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.IFolder


    /* Reload if required */
    if (fReloadRequired && fEntities.size() == 1)
      Controller.getDefault().reloadQueued((IBookMark) fEntities.get(0), getWorkbenchShell());

    /* Reparent if necessary */
    IFolder sameParent = getSameParent(fEntities);
    if (sameParent != null && sameParent != fFolderChooser.getFolder()) {
      List<ReparentInfo<IFolderChild, IFolder>> reparenting = new ArrayList<ReparentInfo<IFolderChild, IFolder>>();
      for (IEntity entity : fEntities) {
        /* Check BookMark and Folder */
        if (entity instanceof IBookMark || entity instanceof IFolder) {
View Full Code Here


  @Test
  public void testLoadAllBookMarksActivation() throws Exception {
    IFeed feed = fFactory.createFeed(null, new URI("http://www.myfeed.com"));
    DynamicDAO.save(feed);

    IFolder root1 = fFactory.createFolder(null, null, "Root 1");
    final String folderName = root1.getName();
    fFactory.createBookMark(null, root1, new FeedLinkReference(feed.getLink()), "Bookmark 1");
    feed = null;
    DynamicDAO.save(root1);
    root1 = null;
    System.gc();
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testLoadRootFolders() throws Exception {
    IFolder root1 = fFactory.createFolder(null, null, "Root 1");
    IFolder root2 = fFactory.createFolder(null, null, "Root 2");
    IFolder root3 = fFactory.createFolder(null, null, "Root 3");

    fFactory.createFolder(null, root1, "Child of Root 1");
    fFactory.createFolder(null, root2, "Child of Root 2");

    FolderReference root1Ref = new FolderReference(DynamicDAO.save(root1).getId());
View Full Code Here

  /**
   * @throws Exception
   */
  @Test
  public void testLoadRootFoldersActivation() throws Exception {
    IFolder root1 = fFactory.createFolder(null, null, "Root 1");
    fFactory.createFolder(null, root1, "Child of Root 1");
    String childFolderName = root1.getFolders().get(0).getName();
    DynamicDAO.save(root1);
    root1 = null;
    System.gc();

    Collection<IFolder> rootFolders = Owl.getPersistenceService().getDAOService().getFolderDAO().loadRoots();
    assertEquals(1, rootFolders.size());
    IFolder folder = rootFolders.iterator().next();
    assertEquals(1, folder.getFolders().size());
    assertEquals(childFolderName, folder.getFolders().get(0).getName());
  }
View Full Code Here

    DynamicDAO.addEntityListener(IFolder.class, fFolderListener);
  }

  private void expand(IFolder folder) {
    IFolder parent = folder.getParent();
    if (parent != null)
      expand(parent);

    fFolderViewer.setExpandedState(folder, true);
  }
View Full Code Here

    /* Sort by Name if set so */
    if (Owl.getPreferenceService().getGlobalScope().getBoolean(DefaultPreferences.BE_SORT_BY_NAME))
      fFolderViewer.setComparator(new ViewerComparator() {
        @Override
        public int compare(Viewer viewer, Object e1, Object e2) {
          IFolder f1 = (IFolder) e1;
          IFolder f2 = (IFolder) e2;

          return f1.getName().compareTo(f2.getName());
        }
      });

    /* Filter excluded Folders */
    fFolderViewer.addFilter(new ViewerFilter() {
      @Override
      public boolean select(Viewer viewer, Object parentElement, Object element) {
        if (fExcludes == null)
          return true;

        return !fExcludes.contains(element) && !fExcludes.contains(parentElement);
      }
    });

    fFolderViewer.setContentProvider(new ITreeContentProvider() {
      public Object[] getElements(Object inputElement) {
        Set<IFolder> rootFolders = Controller.getDefault().getCacheService().getRootFolders();
        return rootFolders.toArray();
      }

      public Object[] getChildren(Object parentElement) {
        if (parentElement instanceof IFolder) {
          IFolder folder = (IFolder) parentElement;
          return folder.getFolders().toArray();
        }

        return new Object[0];
      }

      public Object getParent(Object element) {
        if (element instanceof IFolder) {
          IFolder folder = (IFolder) element;
          return folder.getParent();
        }

        return null;
      }

      public boolean hasChildren(Object element) {
        if (element instanceof IFolder) {
          IFolder folder = (IFolder) element;
          return !folder.getFolders().isEmpty();
        }

        return false;
      }

      public void dispose() {}

      public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
    });

    fFolderViewer.setLabelProvider(new BookMarkLabelProvider());
    fFolderViewer.setInput(new Object());

    fFolderViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent event) {
        IStructuredSelection selection = (IStructuredSelection) event.getSelection();
        if (!selection.isEmpty())
          onFolderSelected((IFolder) selection.getFirstElement());
      }
    });

    fFolderViewer.addDoubleClickListener(new IDoubleClickListener() {
      public void doubleClick(DoubleClickEvent event) {
        IStructuredSelection selection = (IStructuredSelection) event.getSelection();
        IFolder folder = (IFolder) selection.getFirstElement();

        /* Expand / Collapse Folder */
        if (!folder.getFolders().isEmpty()) {
          boolean expandedState = !fFolderViewer.getExpandedState(folder);
          fFolderViewer.setExpandedState(folder, expandedState);
        }

        /* Select Folder and toggle */
 
View Full Code Here

   */
  @Test
  public void testProcessFolderByAge() throws Exception {
    long today = DateUtils.getToday().getTimeInMillis();

    IFolder folder = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    IFeed feed1 = createFeedWithNews(new URI("http://www.url1.com"), 100, 0, today - DAY, today + 5 * HOUR, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed1.getLink()), "BookMark1");

    IFeed feed2 = createFeedWithNews(new URI("http://www.url2.com"), 100, 50, today - 7 * DAY, today + 8 * HOUR, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed2.getLink()), "BookMark2");

    IFeed feed3 = createFeedWithNews(new URI("http://www.url3.com"), 100, 100, today - 31 * DAY, today - 25 * DAY, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed3.getLink()), "BookMark3");

    DynamicDAO.save(folder);

    IBookMark bookMark1 = null, bookMark2 = null, bookMark3 = null;
    List<IMark> marks = folder.getMarks();
    for (IMark mark : marks) {
      if (mark.getName().equals("BookMark1"))
        bookMark1 = (IBookMark) mark;
      else if (mark.getName().equals("BookMark2"))
        bookMark2 = (IBookMark) mark;
View Full Code Here

   */
  @Test
  public void testProcessFolderByState() throws Exception {
    long today = DateUtils.getToday().getTimeInMillis();

    IFolder folder = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    IFeed feed1 = createFeedWithNews(new URI("http://www.url1.com"), 100, 0, today - DAY, today + 5 * HOUR, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed1.getLink()), "BookMark1");

    IFeed feed2 = createFeedWithNews(new URI("http://www.url2.com"), 100, 50, today - 7 * DAY, today + 8 * HOUR, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed2.getLink()), "BookMark2");

    IFeed feed3 = createFeedWithNews(new URI("http://www.url3.com"), 100, 100, today - 31 * DAY, today - 25 * DAY, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed3.getLink()), "BookMark3");

    DynamicDAO.save(folder);

    IBookMark bookMark1 = null, bookMark2 = null, bookMark3 = null;
    List<IMark> marks = folder.getMarks();
    for (IMark mark : marks) {
      if (mark.getName().equals("BookMark1"))
        bookMark1 = (IBookMark) mark;
      else if (mark.getName().equals("BookMark2"))
        bookMark2 = (IBookMark) mark;
View Full Code Here

   */
  @Test
  public void testProcessFolderByCount() throws Exception {
    long today = DateUtils.getToday().getTimeInMillis();

    IFolder folder = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    IFeed feed1 = createFeedWithNews(new URI("http://www.url1.com"), 100, 0, today - DAY, today + 5 * HOUR, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed1.getLink()), "BookMark1");

    IFeed feed2 = createFeedWithNews(new URI("http://www.url2.com"), 100, 50, today - 7 * DAY, today + 8 * HOUR, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed2.getLink()), "BookMark2");

    IFeed feed3 = createFeedWithNews(new URI("http://www.url3.com"), 100, 100, today - 31 * DAY, today - 25 * DAY, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed3.getLink()), "BookMark3");

    DynamicDAO.save(folder);

    IBookMark bookMark1 = null, bookMark2 = null, bookMark3 = null;
    List<IMark> marks = folder.getMarks();
    for (IMark mark : marks) {
      if (mark.getName().equals("BookMark1"))
        bookMark1 = (IBookMark) mark;
      else if (mark.getName().equals("BookMark2"))
        bookMark2 = (IBookMark) mark;
View Full Code Here

   */
  @Test
  public void testProcessFolderByAgeAndCount() throws Exception {
    long today = DateUtils.getToday().getTimeInMillis();

    IFolder folder = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    IFeed feed1 = createFeedWithNews(new URI("http://www.url1.com"), 100, 0, today - DAY, today + 5 * HOUR, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed1.getLink()), "BookMark1");

    IFeed feed2 = createFeedWithNews(new URI("http://www.url2.com"), 100, 50, today - 7 * DAY, today + 8 * HOUR, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed2.getLink()), "BookMark2");

    IFeed feed3 = createFeedWithNews(new URI("http://www.url3.com"), 100, 100, today - 31 * DAY, today - 25 * DAY, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed3.getLink()), "BookMark3");

    DynamicDAO.save(folder);

    IBookMark bookMark1 = null, bookMark2 = null, bookMark3 = null;
    List<IMark> marks = folder.getMarks();
    for (IMark mark : marks) {
      if (mark.getName().equals("BookMark1"))
        bookMark1 = (IBookMark) mark;
      else if (mark.getName().equals("BookMark2"))
        bookMark2 = (IBookMark) mark;
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.IFolder

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.