Skip to content

Commit

Permalink
Only open files if not already opened
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-kolb committed Aug 3, 2016
1 parent 84e3e6c commit 412fd16
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
21 changes: 16 additions & 5 deletions src/main/java/net/sf/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,10 @@
* The main window of the application.
*/
public class JabRefFrame extends JFrame implements OutputPrinter {
private static final Log LOGGER = LogFactory.getLog(JabRefFrame.class);

// Frame titles.
private static final String FRAME_TITLE = "JabRef";

private static final Log LOGGER = LogFactory.getLog(JabRefFrame.class);
private static final String ELLIPSES = "...";

private final JSplitPane splitPane = new JSplitPane();
Expand Down Expand Up @@ -1379,22 +1378,34 @@ public static JMenu subMenu(String name) {
return res;
}

public void addParserResult(ParserResult pr, boolean raisePanel) {
public void addParserResult(ParserResult pr, boolean focusPanel) {
if (pr.toOpenTab()) {
// Add the entries to the open tab.
BasePanel panel = getCurrentBasePanel();
if (panel == null) {
// There is no open tab to add to, so we create a new tab:
addTab(pr.getDatabaseContext(), raisePanel);
addTab(pr.getDatabaseContext(), focusPanel);
} else {
List<BibEntry> entries = new ArrayList<>(pr.getDatabase().getEntries());
addImportedEntries(panel, entries, false);
}
} else {
addTab(pr.getDatabaseContext(), raisePanel);
// only add tab if DB is not already open
if (!isOpen(pr.getFile())) {
addTab(pr.getDatabaseContext(), focusPanel);
}
}
}

private boolean isOpen(File file) {
for (BasePanel panel : getBasePanelList()) {
if (panel.getBibDatabaseContext().getDatabaseFile().equals(file)) {
return true;
}
}
return false;
}

private void createToolBar() {
tlb.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
tlb.setBorder(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
import org.apache.commons.logging.LogFactory;

public class RemoteListenerServer implements Runnable {
private static final Log LOGGER = LogFactory.getLog(RemoteListenerServer.class);

private static final int BACKLOG = 1;
private static final int ONE_SECOND_TIMEOUT = 1000;

private static final Log LOGGER = LogFactory.getLog(RemoteListenerServer.class);
private static final int ONE_SECOND_TIMEOUT = 1000;

private final MessageHandler messageHandler;
private final ServerSocket serverSocket;
Expand Down

0 comments on commit 412fd16

Please sign in to comment.