Package net.sf.jabref.gui

Examples of net.sf.jabref.gui.FileListEntryEditor


        if (flEntry == null) {
            // This shouldn't happen, so I'm not sure what to put in here:
            throw new RuntimeException("Could not find the file list entry "+link+" in "+entry.toString());
        }

        FileListEntryEditor editor = new FileListEntryEditor(frame, flEntry, false, true, metaData);
        editor.setVisible(true, false);
        if (editor.okPressed()) {
            // Store the changes and add an undo edit:
            String newValue = tModel.getStringRepresentation();
            UndoableFieldChange ce = new UndoableFieldChange(entry, GUIGlobals.FILE_FIELD,
                    oldValue, newValue);
            entry.setField(GUIGlobals.FILE_FIELD, newValue);
View Full Code Here


                                answer = 2; // We should delete this link.
                            }
                            switch (answer) {
                                case 1:
                                    // Assign new file.
                                    FileListEntryEditor flEditor = new FileListEntryEditor
                                            (panel.frame(), flEntry, false, true, panel.metaData());
                                    flEditor.setVisible(true, true);
                                    break;
                                case 2:
                                    // Clear field:
                                    tableModel.removeEntry(j);
                                    deleted = true; // Make sure we don't investigate this link further.
                                    j--; // Step back in the iteration, because we removed an entry.
                                    break;
                                case 3:
                                    // Clear field:
                                    tableModel.removeEntry(j);
                                    deleted = true; // Make sure we don't investigate this link further.
                                    j--; // Step back in the iteration, because we removed an entry.
                                    removeAllBroken = true; // Notify for further cases.
                                    break;
                                case 4:
                                    // Cancel
                                    break mainLoop;
                            }
                            brokenLinks++;
                        }

                        // Unless we deleted this link, see if its file type is recognized:
                        if (!deleted && (flEntry.getType() instanceof UnknownExternalFileType)) {
                            String[] options = new String[]
                                    {Globals.lang("Define '%0'", flEntry.getType().getName()),
                                    Globals.lang("Change file type"), Globals.lang("Cancel")};
                            String defOption = options[0];
                            int answer = JOptionPane.showOptionDialog(panel.frame(), Globals.lang("One or more file links are of the type '%0', which is undefined. What do you want to do?",
                                    flEntry.getType().getName()),
                                    Globals.lang("Undefined file type"), JOptionPane.YES_NO_CANCEL_OPTION,
                                    JOptionPane.QUESTION_MESSAGE, null, options, defOption);
                            if (answer == JOptionPane.CANCEL_OPTION) {
                                // User doesn't want to handle this unknown link type.
                            }
                            else if (answer == JOptionPane.YES_OPTION) {
                                // User wants to define the new file type. Show the dialog:
                                ExternalFileType newType = new ExternalFileType(flEntry.getType().getName(), "", "", "", "new");
                                ExternalFileTypeEntryEditor editor = new ExternalFileTypeEntryEditor(panel.frame(), newType);
                                editor.setVisible(true);
                                if (editor.okPressed()) {
                                    // Get the old list of types, add this one, and update the list in prefs:
                                    java.util.List<ExternalFileType> fileTypes = new ArrayList<ExternalFileType>();
                                    ExternalFileType[] oldTypes = Globals.prefs.getExternalFileTypeSelection();
                                    for (int k = 0; k < oldTypes.length; k++) {
                                        fileTypes.add(oldTypes[k]);
                                    }
                                    fileTypes.add(newType);
                                    Collections.sort(fileTypes);
                                    Globals.prefs.setExternalFileTypes(fileTypes);
                                    panel.mainTable.repaint();
                                }
                            }
                            else {
                                // User wants to change the type of this link.
                                // First get a model of all file links for this entry:
                                FileListEntryEditor editor = new FileListEntryEditor
                                        (panel.frame(), flEntry, false, true, panel.metaData());
                                editor.setVisible(true, false);
                            }
                        }
                    }

                    if (!tableModel.getStringRepresentation().equals(old)) {
View Full Code Here

        final String directory = fDirectory;
        final String suggestDir = directory != null ? directory : System.getProperty("user.home");
        File file = new File(new File(suggestDir), suggestedName);
        FileListEntry entry = new FileListEntry("", bibtexKey != null ? file.getCanonicalPath() : "",
                suggestedType);
        editor = new FileListEntryEditor(frame, entry, true, false, metaData);
        editor.getProgressBar().setIndeterminate(true);
        editor.setOkEnabled(false);
        editor.setExternalConfirm(new ConfirmCloseFileListEntryEditor() {
            public boolean confirmClose(FileListEntry entry) {
                File f = directory != null ? expandFilename(directory, entry.getLink())
View Full Code Here

TOP

Related Classes of net.sf.jabref.gui.FileListEntryEditor

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.