Package com.mucommander.bookmark

Examples of com.mucommander.bookmark.Bookmark


        boolean componentsEnabled = false;

        if(!bookmarkList.isSelectionEmpty() && bookmarks.size()>0) {
            componentsEnabled = true;

            Bookmark b = (Bookmark)bookmarkList.getSelectedValue();
            nameValue = b.getName();
            locationValue = b.getLocation();
        }

        // Ignore text field events while setting values
        ignoreDocumentListenerEvents = true;
View Full Code Here


        // Make sure that the selected index is not out of bounds
        if(!bookmarkList.isIndexValid(selectedIndex))
            return;

        Bookmark selectedBookmark = bookmarks.elementAt(selectedIndex);

        if(currentBookmarkSave==null) {
            // Create a clone of the current bookmark in order to cancel any modifications made to it if the dialog
            // is cancelled.
            try { currentBookmarkSave = (Bookmark)selectedBookmark.clone(); }
            catch(CloneNotSupportedException ex) {}

            this.currentListIndex = selectedIndex;
        }

        // Update name
        if(sourceDocument==nameField.getDocument()) {
            String name = nameField.getText();
            if(name.trim().equals(""))
                name = getFreeNameVariation(Translator.get("untitled"));

            selectedBookmark.setName(name);
            bookmarkList.itemModified(selectedIndex, false);
        }
        // Update location
        else {
            selectedBookmark.setLocation(locationField.getText());
        }
    }
View Full Code Here

            dispose();
        }
        // Create a new empty bookmark / duplicate the currently selected bookmark
        else if (source==newButton || source==duplicateButton) {
            Bookmark newBookmark;
            if(source==newButton) {
                newBookmark = new Bookmark(getFreeNameVariation(Translator.get("untitled")), "");
            }
            else {      // Duplicate button
                try {
                    Bookmark currentBookmark = (Bookmark)bookmarkList.getSelectedValue();
                    newBookmark = (Bookmark)currentBookmark.clone();
                    newBookmark.setName(getFreeNameVariation(currentBookmark.getName()));
                }
                catch(CloneNotSupportedException ex) { return; }
            }

            bookmarks.add(newBookmark);
View Full Code Here

//        String newToolTip = null;

        // First tries to find a bookmark matching the specified folder
        java.util.List<Bookmark> bookmarks = BookmarkManager.getBookmarks();
        int nbBookmarks = bookmarks.size();
        Bookmark b;
        for(int i=0; i<nbBookmarks; i++) {
            b = bookmarks.get(i);
            if(currentPath.equals(b.getLocation())) {
                // Note: if several bookmarks match current folder, the first one will be used
                newLabel = b.getName();
                break;
            }
        }
   
        // If no bookmark matched current folder
View Full Code Here

        if (source==addButton)  {
            // Starts by disposing the dialog
            dispose();

            // Add bookmark and write bookmarks file to disk
            BookmarkManager.addBookmark(new Bookmark(nameField.getText(), locationField.getText()));
            try {BookmarkManager.writeBookmarks(false);}
            // We should probably pop an error dialog here.
            catch(Exception e2) {}
        }
        else if (source==cancelButton)  {
View Full Code Here

        popupMenu.add(new JSeparator());

        // Add boookmarks
        java.util.List<Bookmark> bookmarks = BookmarkManager.getBookmarks();
        int nbBookmarks = bookmarks.size();
        Bookmark b;  

        if(nbBookmarks>0) {
            for(int i=0; i<nbBookmarks; i++) {
                b = bookmarks.get(i);
                item = popupMenu.add(new CustomOpenLocationAction(mainFrame, new Hashtable<String, Object>(), b));
                setMnemonic(item, mnemonicHelper);
            }
        }
        else {
            // No bookmark : add a disabled menu item saying there is no bookmark
            popupMenu.add(Translator.get("bookmarks_menu.no_bookmark")).setEnabled(false);
        }

        popupMenu.add(new JSeparator());

        // Add 'Network shares' shortcut
        if(FileFactory.isRegisteredProtocol(FileProtocols.SMB)) {
            action = new CustomOpenLocationAction(mainFrame, new Hashtable<String, Object>(), new Bookmark(Translator.get("drive_popup.network_shares"), "smb:///"));
            action.setIcon(IconManager.getIcon(IconManager.FILE_ICON_SET, CustomFileIconProvider.NETWORK_ICON_NAME));
            setMnemonic(popupMenu.add(action), mnemonicHelper);
        }

        // Add Bonjour services menu
View Full Code Here

        // Indicate we search for location corresponding to the given string.
        // it will be false we'll find one.
        boolean tryToInterpretEnteredString = true;

        // Look for a bookmark which name is the entered string (case insensitive)
        Bookmark b = BookmarkManager.getBookmark(location);
        if(b!=null) {
          // Change the current folder to the bookmark's location
          setText(location = b.getLocation());
          tryToInterpretEnteredString = false;
        }

        // Look for a volume whose name is the entered string (case insensitive)
        AbstractFile volumes[] = LocalFile.getVolumes();
View Full Code Here

     */
    @Override
    public void renameTo(AbstractFile destination) throws IOException {
        checkRenamePrerequisites(destination, true, true);

        Bookmark oldBookmark;
        Bookmark newBookmark;

        destination = destination.getTopAncestor();

        // Makes sure we're working with a bookmark.
        if(!(destination instanceof BookmarkFile))
            throw new IOException();

        // Creates the new bookmark and checks for conflicts.
        newBookmark = new Bookmark(destination.getName(), bookmark.getLocation());
        if((oldBookmark = BookmarkManager.getBookmark(newBookmark.getName())) != null)
            BookmarkManager.removeBookmark(oldBookmark);

        // Adds the new bookmark and deletes its 'old' version.
        BookmarkManager.addBookmark(newBookmark);
        BookmarkManager.removeBookmark(bookmark);
View Full Code Here

        destination = destination.getTopAncestor();
        if(!(destination instanceof BookmarkFile))
            throw new IOException();

        // Copies this bookmark to the specified destination.
        BookmarkManager.addBookmark(new Bookmark(destination.getName(), bookmark.getLocation()));
    }
View Full Code Here

     * </p>
     * @param name     name of the new bookmark.
     * @Param location location of the new bookmark.
     */
    public void addBookmark(String name, String location) {
        Bookmark oldBookmark; // Old bookmark of the same name, if any.
        Bookmark newBookmark; // Bookmark to create.

        // Creates the new bookmark and checks for conflicts.
        newBookmark = new Bookmark(name, location);
        if((oldBookmark = BookmarkManager.getBookmark(name)) != null)
            BookmarkManager.removeBookmark(oldBookmark);

        // Adds the new bookmark.
        BookmarkManager.addBookmark(newBookmark);
View Full Code Here

TOP

Related Classes of com.mucommander.bookmark.Bookmark

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.