<commit_before>/*
 * WebView - A desktop-like web browsing experience
 * Copyright (C) 2014-2015 <NAME>. All rights reserved.
 * 
 * Project:         WebView
 * Version:         0.0.1
 * Website:
 *
 * File:            BrowserWindow.java
 * Created:         2014-03-30
 * Author:          <NAME> <<EMAIL>>
 */

package net.peterfolta.webview.view;

import net.peterfolta.webview.model.WVApp;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class BrowserWindow {

    private Display display;
    private WVApp wvApp;

    private Shell browserShell;
    private Browser browser;

    public BrowserWindow(Display display, WVApp wvApp) {
        this.display = display;
        this.wvApp = wvApp;

        browserShell = new Shell(display, SWT.TITLE | SWT.MIN | SWT.RESIZE | SWT.MAX | SWT.CLOSE);
        browserShell.setText(wvApp.getTitle());
        browserShell.setImage(wvApp.getIcon());

        browserShell.addShellListener(new ShellListener() {
            public void shellActivated(ShellEvent event) {
            }

            public void shellClosed(ShellEvent event) {
                browserShell.close();
            }

            public void shellDeactivated(ShellEvent event) {
            }

            public void shellDeiconified(ShellEvent event) {
            }

            public void shellIconified(ShellEvent event) {
            }
        });

        browserShell.setLayout(new FillLayout());

        browser = new Browser(browserShell, SWT.MOZILLA);
        browser.setUrl(wvApp.getUrl());
        browser.addTitleListener(event -> browserShell.setText(event.title));

        browserShell.setSize(1440, 900);
    }

    public void open() {
        browserShell.open();
    }

}<commit_msg>Added OpenWindowListener to Open External Links Inside the Application<commit_after>/*
 * WebView - A desktop-like web browsing experience
 * Copyright (C) 2014-2015 <NAME>. All rights reserved.
 * 
 * Project:         WebView
 * Version:         0.0.1
 * Website:
 *
 * File:            BrowserWindow.java
 * Created:         2014-03-30
 * Author:          <NAME> <<EMAIL>>
 */

package net.peterfolta.webview.view;

import net.peterfolta.webview.model.WVApp;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class BrowserWindow {

    private Display display;
    private WVApp wvApp;

    private Shell browserShell;
    private Browser browser;

    public BrowserWindow(Display display, WVApp wvApp) {
        this.display = display;
        this.wvApp = wvApp;

        browserShell = new Shell(display, SWT.TITLE | SWT.MIN | SWT.RESIZE | SWT.MAX | SWT.CLOSE);
        browserShell.setText(wvApp.getTitle());
        browserShell.setImage(wvApp.getIcon());

        browserShell.addShellListener(new ShellListener() {
            public void shellActivated(ShellEvent event) {
            }

            public void shellClosed(ShellEvent event) {
                browserShell.close();
            }

            public void shellDeactivated(ShellEvent event) {
            }

            public void shellDeiconified(ShellEvent event) {
            }

            public void shellIconified(ShellEvent event) {
            }
        });

        browserShell.setLayout(new FillLayout());

        browser = new Browser(browserShell, SWT.MOZILLA);
        browser.setUrl(wvApp.getUrl());
        browser.addTitleListener(event -> browserShell.setText(event.title));

        // Open external links inside the application
        browser.addOpenWindowListener(event -> event.browser = browser);

        browserShell.setSize(1440, 900);
    }

    public void open() {
        browserShell.open();
    }

}
{'fraction_non_alphanumeric': 0.1023142509135201, 'fraction_numerical': 0.01266747868453106, 'mean_word_length': 2.4826123833757423, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4228536', 'n_tokens_mistral': 1256, 'n_tokens_neox': 1163, 'n_words': 249}