use of osx.macadapter.MacAdapter in project jabref by JabRef.
the class JabRefFrame method init.
private void init() {
tabbedPane = new DragDropPopupPane(tabPopupMenu());
MyGlassPane glassPane = new MyGlassPane();
setGlassPane(glassPane);
setTitle(FRAME_TITLE);
setIconImages(IconTheme.getLogoSet());
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
if (OS.OS_X) {
JabRefFrame.this.setVisible(false);
} else {
new CloseAction().actionPerformed(null);
}
}
});
initSidePane();
initLayout();
initActions();
// Show the toolbar if it was visible at last shutdown:
tlb.setVisible(Globals.prefs.getBoolean(JabRefPreferences.TOOLBAR_VISIBLE));
setBounds(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds());
WindowLocation pw = new WindowLocation(this, JabRefPreferences.POS_X, JabRefPreferences.POS_Y, JabRefPreferences.SIZE_X, JabRefPreferences.SIZE_Y);
pw.displayWindowAtStoredLocation();
tabbedPane.setBorder(null);
tabbedPane.setForeground(GUIGlobals.INACTIVE_TABBED_COLOR);
/*
* The following state listener makes sure focus is registered with the
* correct database when the user switches tabs. Without this,
* cut/paste/copy operations would some times occur in the wrong tab.
*/
tabbedPane.addChangeListener(e -> {
markActiveBasePanel();
BasePanel currentBasePanel = getCurrentBasePanel();
if (currentBasePanel == null) {
return;
}
Platform.runLater(() -> Globals.stateManager.activeDatabaseProperty().setValue(Optional.of(currentBasePanel.getBibDatabaseContext())));
if (new SearchPreferences(Globals.prefs).isGlobalSearch()) {
globalSearchBar.performSearch();
} else {
String content = "";
Optional<SearchQuery> currentSearchQuery = currentBasePanel.getCurrentSearchQuery();
if (currentSearchQuery.isPresent()) {
content = currentSearchQuery.get().getQuery();
}
globalSearchBar.setSearchTerm(content, true);
}
currentBasePanel.getPreviewPanel().updateLayout();
groupSidePane.getToggleAction().setSelected(sidePaneManager.isComponentVisible(GroupSidePane.class));
previewToggle.setSelected(Globals.prefs.getPreviewPreferences().isPreviewPanelEnabled());
generalFetcher.getToggleAction().setSelected(sidePaneManager.isComponentVisible(GeneralFetcher.class));
openOfficePanel.getToggleAction().setSelected(sidePaneManager.isComponentVisible(OpenOfficeSidePanel.class));
Globals.getFocusListener().setFocused(currentBasePanel.getMainTable());
setWindowTitle();
editModeAction.initName();
currentBasePanel.updateSearchManager();
currentBasePanel.setBackAndForwardEnabledState();
currentBasePanel.getUndoManager().postUndoRedoEvent();
currentBasePanel.getMainTable().requestFocus();
});
//opened (double-clicked) documents are not displayed.
if (OS.OS_X) {
try {
new MacAdapter().registerMacEvents(this);
} catch (Exception e) {
LOGGER.fatal("Could not interface with Mac OS X methods.", e);
}
}
initShowTrackingNotification();
}
Aggregations