List of usage examples for javafx.application Platform setImplicitExit
public static void setImplicitExit(boolean implicitExit)
From source file:com.vladsch.idea.multimarkdown.editor.MultiMarkdownFxPreviewEditor.java
/** * Build a new instance of {@link MultiMarkdownFxPreviewEditor}. * * @param project the {@link Project} containing the document * @param doc the {@link Document} previewed in this editor. *//*from ww w .j av a2 s. co m*/ public MultiMarkdownFxPreviewEditor(@NotNull final Project project, @NotNull Document doc, boolean isRawHtml) { this.isRawHtml = isRawHtml; this.document = doc; this.project = project; this.isWikiDocument = isWikiDocument(document); containingFile = FileDocumentManager.getInstance().getFile(document); resolver = containingFile == null ? null : new GitHubLinkResolver(containingFile, project); // Listen to the document modifications. this.document.addDocumentListener(new DocumentAdapter() { @Override public void documentChanged(DocumentEvent e) { delayedHtmlPreviewUpdate(false); } }); // Listen to settings changes MultiMarkdownGlobalSettings.getInstance() .addListener(globalSettingsListener = new MultiMarkdownGlobalSettingsListener() { public void handleSettingsChanged(@NotNull final MultiMarkdownGlobalSettings newSettings) { if (project.isDisposed()) return; processor = null; updateEditorTabIsVisible(); updateLinkRenderer(); delayedHtmlPreviewUpdate(true); checkNotifyUser(); } }); MultiMarkdownProjectComponent projectComponent = MultiMarkdownPlugin.getProjectComponent(project); if (projectComponent != null) { projectComponent.addListener(projectFileListener = new ReferenceChangeListener() { @Override public void referenceChanged(@Nullable String name) { if (project.isDisposed()) return; delayedHtmlPreviewUpdate(false); } }); } project.getMessageBus().connect(this).subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() { @Override public void enteredDumbMode() { } @Override public void exitDumbMode() { // need to re-evaluate class link accessibility if (project.isDisposed()) return; delayedHtmlPreviewUpdate(false); } }); updateLinkRenderer(); if (isRawHtml) { jEditorPane = null; jfxPanel = null; webView = null; webEngine = null; Language language = Language.findLanguageByID("HTML"); FileType fileType = language != null ? language.getAssociatedFileType() : null; Document myDocument = EditorFactory.getInstance().createDocument(""); myTextViewer = (EditorImpl) EditorFactory.getInstance().createViewer(myDocument, project); if (fileType != null) myTextViewer.setHighlighter( EditorHighlighterFactory.getInstance().createEditorHighlighter(project, fileType)); } else { // Setup the editor pane for rendering HTML. myTextViewer = null; jEditorPane = new JPanel(new BorderLayout(), false); jfxPanel = new JFXPanel(); // initializing javafx jEditorPane.add(jfxPanel, BorderLayout.CENTER); Platform.setImplicitExit(false); Platform.runLater(new Runnable() { @Override public void run() { if (project.isDisposed()) return; webView = new WebView(); webEngine = webView.getEngine(); anchorPane = new AnchorPane(); AnchorPane.setTopAnchor(webView, 0.0); AnchorPane.setLeftAnchor(webView, 0.0); AnchorPane.setBottomAnchor(webView, 0.0); AnchorPane.setRightAnchor(webView, 0.0); anchorPane.getChildren().add(webView); jfxPanel.setScene(new Scene(anchorPane)); webEngine.setCreatePopupHandler(new Callback<PopupFeatures, WebEngine>() { @Override public WebEngine call(PopupFeatures config) { // return a web engine for the new browser window or null to block popups return null; } }); addStateChangeListener(); } }); } checkNotifyUser(); }
From source file:org.martus.client.swingui.UiMainWindow.java
private void startAccountSetupWizard() { try {// w w w . j a va2 s . co m // NOTE: Prevent implicit JavaFX shutdown when the only JFX window is closed Platform.setImplicitExit(false); if (UiSession.isLegacySetupWizard) showWelcomeAndStartSignupProcess(); else showAndStartSignupProcess(); } catch (Exception e) { MartusLogger.logException(e); } }
From source file:org.cryptomator.ui.controllers.MainController.java
public void didUnlock(Vault vault) { Platform.setImplicitExit(false); if (vault.equals(selectedVault.getValue())) { this.showUnlockedView(vault); }/*from ww w. j a v a 2s. c o m*/ }
From source file:org.cryptomator.ui.controllers.MainController.java
public void didLock(UnlockedController ctrl) { unlockedVaults.remove(ctrl.getVault()); showUnlockView();// w ww. j av a2s .c o m if (!vaults.stream().anyMatch(Vault::isUnlocked)) { Platform.setImplicitExit(true); } }
From source file:org.mskcc.shenkers.control.track.fasta.FastaViewNGTest.java
@BeforeClass public static void setUpClass() throws Exception { new JFXPanel(); Platform.setImplicitExit(false); }
From source file:org.nmrfx.processor.gui.MainApp.java
@Override public void start(Stage stage) throws Exception { stages.add(stage);//from w w w . j a v a 2 s . c o m mainApp = this; Parent root = FXMLLoader.load(getClass().getResource("/fxml/NMRScene.fxml")); Platform.setImplicitExit(true); Scene scene = new Scene(root); scene.getStylesheets().add("/styles/Styles.css"); hostServices = getHostServices(); stage.setTitle(appName + " " + getVersion()); stage.setScene(scene); stage.show(); if (mainMenuBar == null) { mainMenuBar = makeMenuBar(appName); } Parameters parameters = getParameters(); System.out.println(parameters.getRaw()); interpreter.exec( "from pyproc import *\ninitLocal()\nfrom gscript import *\nnw=NMRFxWindowScripting()\nfrom dscript import *"); interpreter.set("argv", parameters.getRaw()); interpreter.exec("parseArgs(argv)"); Dataset.addObserver(this); }
From source file:org.openbase.display.DisplayView.java
private void init(final Stage primaryStage) throws InterruptedException, InitializationException { Runtime.getRuntime().addShutdownHook(new Thread() { @Override//from w w w . j a v a 2 s . c om public void run() { Platform.exit(); } }); try { // platform configuration Platform.setImplicitExit(false); primaryStage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH); this.primaryStage = primaryStage; Scene scene = new Scene(cardsPane); // configure hide key combination final KeyCombination escapeKey = new KeyCodeCombination(KeyCode.ESCAPE); scene.addEventHandler(KeyEvent.KEY_RELEASED, new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { if (escapeKey.match(event)) { try { setVisible(false); } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory( new CouldNotPerformException("Could not execute key event!", ex), logger); } } } }); primaryStage.setScene(scene); try { broadcastServer = new DisplayServer(this); broadcastServer.init(JPService.getProperty(JPBroadcastDisplayScope.class).getValue()); broadcastServer.activate(); } catch (JPServiceException | CouldNotPerformException ex) { throw new CouldNotPerformException("Could not load display server!", ex); } try { displayServer = new DisplayServer(this); displayServer.init(JPService.getProperty(JPDisplayScope.class).getValue()); displayServer.activate(); } catch (JPServiceException | CouldNotPerformException ex) { throw new CouldNotPerformException("Could not load display server!", ex); } this.htmlLoader.init(getScreen()); } catch (CouldNotPerformException ex) { throw new InitializationException(this, ex); } }
From source file:org.sleuthkit.autopsy.imageanalyzer.ImageAnalyzerController.java
/** invoked by {@link OnStart} to make sure that the ImageAnalyzer listeners * get setup as early as possible, and do other setup stuff. */ void onStart() {// w w w . j a va2 s . c o m Platform.setImplicitExit(false); LOGGER.info("setting up ImageAnalyzer listeners"); //TODO can we do anything usefull in an InjestJobEventListener? //IngestManager.getInstance().addIngestJobEventListener((PropertyChangeEvent evt) -> {}); IngestManager.getInstance().addIngestModuleEventListener((PropertyChangeEvent evt) -> { switch (IngestManager.IngestModuleEvent.valueOf(evt.getPropertyName())) { case CONTENT_CHANGED: //TODO: do we need to do anything here? -jm case DATA_ADDED: /* we could listen to DATA events and progressivly * update files, and get data from DataSource ingest * modules, but given that most modules don't post new * artifacts in the events and we would have to query for * them, without knowing which are the new ones, we just * ignore these events for now. The relevant data should all * be captured by file done event, anyways -jm */ break; case FILE_DONE: /** getOldValue has fileID * getNewValue has {@link Abstractfile} */ AbstractFile file = (AbstractFile) evt.getNewValue(); if (isListeningEnabled()) { if (ImageAnalyzerModule.isSupportedAndNotKnown(file)) { //this file should be included and we don't already know about it from hash sets (NSRL) queueDBWorkerTask(new UpdateFileTask(file)); } else if (ImageAnalyzerModule.getAllSupportedExtensions().contains(file.getNameExtension())) { //doing this check results in fewer tasks queued up, and faster completion of db update //this file would have gotten scooped up in initial grab, but actually we don't need it queueDBWorkerTask(new RemoveFileTask(file)); } } else { //TODO: keep track of what we missed for later setStale(true); } break; } }); Case.addPropertyChangeListener((PropertyChangeEvent evt) -> { switch (Case.Events.valueOf(evt.getPropertyName())) { case CURRENT_CASE: Case newCase = (Case) evt.getNewValue(); if (newCase != null) { // case has been opened setCase(newCase); //connect db, groupmanager, start worker thread } else { // case is closing //close window, reset everything SwingUtilities.invokeLater(ImageAnalyzerTopComponent::closeTopComponent); reset(); } break; case DATA_SOURCE_ADDED: //copy all file data to drawable databse Content newDataSource = (Content) evt.getNewValue(); if (isListeningEnabled()) { queueDBWorkerTask(new PrePopulateDataSourceFiles(newDataSource.getId())); } else {//TODO: keep track of what we missed for later setStale(true); } break; } }); }
From source file:org.sleuthkit.autopsy.imagegallery.ImageGalleryController.java
/** * invoked by {@link OnStart} to make sure that the ImageGallery listeners * get setup as early as possible, and do other setup stuff. *//*from www . j a va 2s .com*/ void onStart() { Platform.setImplicitExit(false); LOGGER.info("setting up ImageGallery listeners"); //TODO can we do anything usefull in an InjestJobEventListener? //IngestManager.getInstance().addIngestJobEventListener((PropertyChangeEvent evt) -> {}); IngestManager.getInstance().addIngestModuleEventListener((PropertyChangeEvent evt) -> { switch (IngestManager.IngestModuleEvent.valueOf(evt.getPropertyName())) { case CONTENT_CHANGED: //TODO: do we need to do anything here? -jm case DATA_ADDED: /* we could listen to DATA events and progressivly * update files, and get data from DataSource ingest * modules, but given that most modules don't post new * artifacts in the events and we would have to query for * them, without knowing which are the new ones, we just * ignore these events for now. The relevant data should all * be captured by file done event, anyways -jm */ break; case FILE_DONE: /** * getOldValue has fileID getNewValue has * {@link Abstractfile} */ AbstractFile file = (AbstractFile) evt.getNewValue(); if (isListeningEnabled()) { if (ImageGalleryModule.isSupportedAndNotKnown(file)) { //this file should be included and we don't already know about it from hash sets (NSRL) queueDBWorkerTask(new UpdateFileTask(file)); } else if (ImageGalleryModule.getAllSupportedExtensions().contains(file.getNameExtension())) { //doing this check results in fewer tasks queued up, and faster completion of db update //this file would have gotten scooped up in initial grab, but actually we don't need it queueDBWorkerTask(new RemoveFileTask(file)); } } else { //TODO: keep track of what we missed for later setStale(true); } break; } }); Case.addPropertyChangeListener((PropertyChangeEvent evt) -> { switch (Case.Events.valueOf(evt.getPropertyName())) { case CURRENT_CASE: Case newCase = (Case) evt.getNewValue(); if (newCase != null) { // case has been opened setCase(newCase); //connect db, groupmanager, start worker thread } else { // case is closing //close window, reset everything SwingUtilities.invokeLater(ImageGalleryTopComponent::closeTopComponent); reset(); } break; case DATA_SOURCE_ADDED: //copy all file data to drawable databse Content newDataSource = (Content) evt.getNewValue(); if (isListeningEnabled()) { queueDBWorkerTask(new PrePopulateDataSourceFiles(newDataSource)); } else {//TODO: keep track of what we missed for later setStale(true); } break; } }); }
From source file:org.swiftexplorer.SwiftExplorer.java
public static void main(String[] args) { if (isMacOsX()) { System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", Configuration.INSTANCE.getAppName()); try {/*from w w w.java2 s . c om*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { logger.error("Error occurred while initializing the UI", e); } } // required: http://docs.oracle.com/javafx/2/api/javafx/application/Platform.html#setImplicitExit(boolean) // Otherwise, we may get an exception if we attempt to re-open the web-browser login windows Platform.setImplicitExit(false); // load the settings String settingsFile = "swiftexplorer-settings.xml"; if (!new File(settingsFile).exists()) settingsFile = null; try { Configuration.INSTANCE.load(settingsFile); } catch (ConfigurationException e) { logger.error("Error occurred while initializing the configuration", e); } Locale locale = Locale.getDefault(); HasLocalizationSettings localizationSettings = Configuration.INSTANCE.getLocalizationSettings(); if (localizationSettings != null) { Locale.Builder builder = new Locale.Builder(); LanguageCode lang = localizationSettings.getLanguage(); RegionCode reg = localizationSettings.getRegion(); builder.setLanguage(lang.toString()); if (reg != null) builder.setRegion(reg.toString()); else builder.setRegion(""); locale = builder.build(); } final HasLocalizedStrings localizedStrings = new LocalizedStringsImpl(locale); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { openMainWindow(new MainPanel(Configuration.INSTANCE, localizedStrings)); } catch (IOException e) { logger.error("Error occurred while opening the main window", e); } } }); }