Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.IFolder


    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(false));
    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

    fFolderListener = new FolderListener() {

      /* Folders got added */
      public void entitiesAdded(Set<FolderEvent> events) {
        for (FolderEvent folderEvent : events) {
          IFolder folder = folderEvent.getEntity();
          if (folder.getParent() == null)
            fRootFolders.add(folder);
        }
      }

      /* Folders got Deleted */
      public void entitiesDeleted(Set<FolderEvent> events) {
        for (FolderEvent folderEvent : events) {
          IFolder folder = folderEvent.getEntity();
          if (folder.getParent() == null)
            fRootFolders.remove(folder);
        }
      }

      /* Folders got Updated */
 
View Full Code Here

        /* New BookMark */
        Action newBookmarkAction = new Action(Messages.BookMarkExplorer_BOOKMARK) {
          @Override
          public void run() {
            IStructuredSelection selection = (IStructuredSelection) fViewer.getSelection();
            IFolder parent = getParent(selection);
            IMark position = (IMark) ((selection.getFirstElement() instanceof IMark) ? selection.getFirstElement() : null);
            new NewBookMarkAction(fViewSite.getShell(), parent, position).run(null);
          }

          @Override
          public ImageDescriptor getImageDescriptor() {
            return OwlUI.BOOKMARK;
          }
        };
        newBookmarkAction.setId("org.rssowl.ui.actions.NewBookMark"); //$NON-NLS-1$
        newBookmarkAction.setActionDefinitionId("org.rssowl.ui.actions.NewBookMark"); //$NON-NLS-1$
        newMenu.add(newBookmarkAction);

        /* New NewsBin */
        Action newNewsBinAction = new Action(Messages.BookMarkExplorer_NEWSBIN) {
          @Override
          public void run() {
            IStructuredSelection selection = (IStructuredSelection) fViewer.getSelection();
            IFolder parent = getParent(selection);
            IMark position = (IMark) ((selection.getFirstElement() instanceof IMark) ? selection.getFirstElement() : null);
            new NewNewsBinAction(fViewSite.getShell(), parent, position).run(null);
          }

          @Override
          public ImageDescriptor getImageDescriptor() {
            return OwlUI.NEWSBIN;
          }
        };
        newNewsBinAction.setId("org.rssowl.ui.actions.NewNewsBin"); //$NON-NLS-1$
        newNewsBinAction.setActionDefinitionId("org.rssowl.ui.actions.NewNewsBin"); //$NON-NLS-1$
        newMenu.add(newNewsBinAction);

        /* New Saved Search */
        Action newSavedSearchAction = new Action(Messages.BookMarkExplorer_SAVED_SEARCH) {
          @Override
          public void run() {
            IStructuredSelection selection = (IStructuredSelection) fViewer.getSelection();
            IFolder parent = getParent(selection);
            IMark position = (IMark) ((selection.getFirstElement() instanceof IMark) ? selection.getFirstElement() : null);
            new NewSearchMarkAction(fViewSite.getShell(), parent, position).run(null);
          }

          @Override
          public ImageDescriptor getImageDescriptor() {
            return OwlUI.SEARCHMARK;
          }
        };
        newSavedSearchAction.setId("org.rssowl.ui.actions.NewSearchMark"); //$NON-NLS-1$
        newSavedSearchAction.setActionDefinitionId("org.rssowl.ui.actions.NewSearchMark"); //$NON-NLS-1$
        newMenu.add(newSavedSearchAction);

        /* New Folder */
        newMenu.add(new Separator());
        Action newFolderAction = new Action(Messages.BookMarkExplorer_FOLDER) {
          @Override
          public void run() {
            IStructuredSelection selection = (IStructuredSelection) fViewer.getSelection();
            IFolder parent = getParent(selection);
            IMark position = (IMark) ((selection.getFirstElement() instanceof IMark) ? selection.getFirstElement() : null);
            new NewFolderAction(fViewSite.getShell(), parent, position).run(null);
          }

          @Override
View Full Code Here

      @Override
      public void entitiesDeleted(final Set<FolderEvent> events) {
        JobRunner.runInUIThread(fViewer.getControl(), new Runnable() {
          public void run() {
            for (FolderEvent event : events) {
              IFolder deletedFolder = event.getEntity();
              IFolder parentFolder = event.getEntity().getParent();
              if (parentFolder == null) {
                int index = getIndexOfRootFolder(deletedFolder);
                fRootFolders.remove(event.getEntity());

                /* In case this Bookmark set is currently showing in the Explorer */
 
View Full Code Here

    /* Workbench Window */
    action.init(fWindow);

    /* Explorer Selection */
    IFolder folder = OwlUI.getBookMarkExplorerSelection();
    if (folder != null)
      action.selectionChanged(null, new StructuredSelection(folder));

    /* Run */
    action.run(null);
View Full Code Here

          @Override
          public Menu createMenu(Control parent) {
            NewTypeDropdownAction action = new NewTypeDropdownAction();
            action.init(fWindow);
            IFolder folder = OwlUI.getBookMarkExplorerSelection();
            if (folder != null)
              action.selectionChanged(null, new StructuredSelection(folder));

            return action.getMenu(parent);
          }
View Full Code Here

    /* Run Update */
    List<?> list = fSelection.toList();
    Set<FeedLinkReference> handledFeedsFromNews = new HashSet<FeedLinkReference>();
    for (Object selection : list) {
      if (selection instanceof IFolder) {
        IFolder folder = (IFolder) selection;
        getBookMarks(folder, selectedBookMarks);
      }

      else if (selection instanceof IBookMark) {
        IBookMark bookMark = (IBookMark) selection;
View Full Code Here

    int unreadNewsCount = 0;
    int newNewsCount = 0;

    /* Create Label for a Folder */
    if (element instanceof IFolder) {
      IFolder folder = (IFolder) element;
      boolean hasSticky = false;

      if (fIndicateState) {
        FolderDecorationHelper helper = new FolderDecorationHelper();
        computeFolderDecoration(folder, helper);

        hasSticky = helper.fHasSticky;
        unreadNewsCount = helper.fUnreadCount;
        newNewsCount = helper.fNewCount;
      }

      /* Image */
      if (folder.getParent() == null)
        cell.setImage(fBookmarkSetIcon);
      else if (newNewsCount == 0)
        cell.setImage(fFolderIcon);
      else
        cell.setImage(fFolderNewIcon);

      /* Font */
      if (unreadNewsCount > 0)
        cell.setFont(fBoldFont);
      else
        cell.setFont(fDefaultFont);

      /* Text */
      if (unreadNewsCount > 0)
        cell.setText(NLS.bind(Messages.BookMarkLabelProvider_NAME_UNREAD, folder.getName(), unreadNewsCount));
      else
        cell.setText(folder.getName());

      /* Reset Foreground */
      cell.setForeground(null);

      /* Background Color */
 
View Full Code Here

      if (draggedObject.equals(dropTarget))
        return false;

      /* Dragged Folder */
      if (draggedObject instanceof IFolder) {
        IFolder draggedFolder = (IFolder) draggedObject;
        if (!isValidDrop(draggedFolder, dropTarget))
          return false;
      }

      /* Dragged 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.