Package eu.mihosoft.vrlstudio.main

Source Code of eu.mihosoft.vrlstudio.main.PreferenceWindow

/*
* PreferenceWindow.java
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2009–2012 Steinbeis Forschungszentrum (STZ Ölbronn),
* Copyright (c) 2007–2012 by Michael Hoffer
*
* This file is part of VRL-Studio.
*
* VRL-Studio is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* as published by the Free Software Foundation.
*
* see: http://opensource.org/licenses/LGPL-3.0
*      file://path/to/VRL/src/eu/mihosoft/vrl/resources/license/lgplv3.txt
*
* VRL-Studio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Lesser General Public License for more details.
*
* This version of VRL-Studio includes copyright notice and attribution requirements.
* According to the LGPL this information must be displayed even if you modify
* the source code of VRL-Studio. Neither the VRL Canvas attribution icon nor any
* copyright statement/attribution may be removed.
*
* Attribution Requirements:
*
* If you create derived work you must do three things regarding copyright
* notice and author attribution.
*
* First, the following text must be displayed on the Canvas:
* "based on VRL source code". In this case the VRL canvas icon must be removed.
*
* Second, keep the links to "About VRL-Studio" and "About VRL". The
* copyright notice must remain.
*
* Third, add an additional notice, stating that you modified VRL. In addition
* you must cite the publications listed below. A suitable notice might read
* "VRL source code modified by YourName 2012".
*
* Note, that these requirements are in full accordance with the LGPL v3
* (see 7. Additional Terms, b).
*
* Publications:
*
* M. Hoffer, C.Poliwoda, G.Wittum. Visual Reflection Library -
* A Framework for Declarative GUI Programming on the Java Platform.
* Computing and Visualization in Science, 2011, in press.
*/
package eu.mihosoft.vrlstudio.main;

import eu.mihosoft.vrl.dialogs.FileDialogManager;
import eu.mihosoft.vrl.visual.LoggingController;
import eu.mihosoft.vrl.io.ConfigurationFile;
import eu.mihosoft.vrl.io.IOUtil;
import eu.mihosoft.vrl.system.PluginCacheController;
import eu.mihosoft.vrl.system.VRL;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
*
* @author Michael Hoffer <info@michaelhoffer.de>
*/
public class PreferenceWindow extends javax.swing.JFrame {

    private ConfigurationFile config;
    static final String RESTORE_WIN_POS_KEY = "Window:restore-pos";
    static final String DIALOG_ON_START_KEY = "Studio:dialog-on-start";
    static final String CHECK_FOR_UPDATES_ON_STARTUP_KEY = "Window:check-for-updates";
    static final String UPDATE_URL_KEY = "Window:update-url";
    static final String UPDATE_KEY_KEY = "Window:update-key";
    private Studio studio;

    /**
     * Creates new form PreferenceWindow
     */
    public PreferenceWindow() {
        initComponents();

        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                studio.window = null;
                PreferenceWindow.this.dispose();
            }
        });
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel9 = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        restoreWinPosOnStartCheckBox = new javax.swing.JCheckBox();
        showDialogOnStartCheckBox = new javax.swing.JCheckBox();
        jPanel7 = new javax.swing.JPanel();
        indicateSaveCheckbox = new javax.swing.JCheckBox();
        compileOnDemandCheckBox = new javax.swing.JCheckBox();
        createVersionOnSaveCheckBox = new javax.swing.JCheckBox();
        flushOnSaveCheckBox = new javax.swing.JCheckBox();
        enableAdvancedOptionsCheckBox = new javax.swing.JCheckBox();
        jPanel13 = new javax.swing.JPanel();
        jPanel14 = new javax.swing.JPanel();
        filler7 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
        filler8 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
        jPanel15 = new javax.swing.JPanel();
        checkForUpdatesOnStartupItem = new javax.swing.JCheckBox();
        jPanel16 = new javax.swing.JPanel();
        filler9 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
        checkForUpdatesBtn = new javax.swing.JButton();
        filler10 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
        jPanel17 = new javax.swing.JPanel();
        updateSourceURLLabel = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jPanel18 = new javax.swing.JPanel();
        filler11 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
        setURLBtn = new javax.swing.JButton();
        filler12 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
        updateSourceLogPanel = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        updateSourceKeyLabel = new javax.swing.JTextField();
        chooseUpdateKyFileBtn = new javax.swing.JButton();
        jPanel10 = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        enableInvokationVisualization = new javax.swing.JCheckBox();
        invocationDelayTitle = new javax.swing.JLabel();
        invocationSlider = new javax.swing.JSlider();
        delayLabel = new javax.swing.JLabel();
        visualizeParamEvaluationCheckBox = new javax.swing.JCheckBox();
        jPanel12 = new javax.swing.JPanel();
        showDebugMenu = new javax.swing.JCheckBox();
        showOutCheckBox = new javax.swing.JCheckBox();
        showErrCheckBox = new javax.swing.JCheckBox();
        jPanel4 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jPanel8 = new javax.swing.JPanel();
        filler5 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
        jButton3 = new javax.swing.JButton();
        filler6 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
        jPanel5 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jPanel6 = new javax.swing.JPanel();
        filler3 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
        jButton2 = new javax.swing.JButton();
        filler4 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
        jButton1 = new javax.swing.JButton();
        filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0));
        jLabel3 = new javax.swing.JLabel();
        preferenceFolderLocation = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Preferences");
        setResizable(false);

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("General"));
        jPanel9.setOpaque(false);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Main Window"));

        restoreWinPosOnStartCheckBox.setText("Restore Window Position on Start");
        restoreWinPosOnStartCheckBox.setToolTipText("Defines whether to restore the last position of the main window");
        restoreWinPosOnStartCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                restoreWinPosOnStartCheckBoxActionPerformed(evt);
            }
        });

        showDialogOnStartCheckBox.setSelected(true);
        showDialogOnStartCheckBox.setText("Show Start-Dialog");
        showDialogOnStartCheckBox.setToolTipText("Defines whether to show a start-dialog that allows to create and load projects");
        showDialogOnStartCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showDialogOnStartCheckBoxActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(restoreWinPosOnStartCheckBox)
                    .addComponent(showDialogOnStartCheckBox))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(restoreWinPosOnStartCheckBox)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(showDialogOnStartCheckBox)
                .addContainerGap(35, Short.MAX_VALUE))
        );

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Load/Save"));

        indicateSaveCheckbox.setText("Visually Indicate Save");
        indicateSaveCheckbox.setToolTipText("If enabled the window will turn dark while saving");
        indicateSaveCheckbox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                indicateSaveCheckboxActionPerformed(evt);
            }
        });

        compileOnDemandCheckBox.setSelected(true);
        compileOnDemandCheckBox.setText("Compile on Demand");
        compileOnDemandCheckBox.setToolTipText("Only compiles visual sessions on demand and not once for each save operation");
        compileOnDemandCheckBox.setEnabled(false);
        compileOnDemandCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                compileOnDemandCheckBoxActionPerformed(evt);
            }
        });

        createVersionOnSaveCheckBox.setSelected(true);
        createVersionOnSaveCheckBox.setText("Automatically Create Version");
        createVersionOnSaveCheckBox.setToolTipText("If enabled versions will not be created automatically when saving the project");
        createVersionOnSaveCheckBox.setEnabled(false);
        createVersionOnSaveCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                createVersionOnSaveCheckBoxActionPerformed(evt);
            }
        });

        flushOnSaveCheckBox.setSelected(true);
        flushOnSaveCheckBox.setText("Write Changes to Archive");
        flushOnSaveCheckBox.setToolTipText("Writes Changes To Archive. Disabling this option increases the possibility of data loss!");
        flushOnSaveCheckBox.setEnabled(false);
        flushOnSaveCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                flushOnSaveCheckBoxActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(createVersionOnSaveCheckBox)
                    .addComponent(indicateSaveCheckbox))
                .addGap(42, 42, 42)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(flushOnSaveCheckBox)
                    .addComponent(compileOnDemandCheckBox))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(indicateSaveCheckbox)
                    .addComponent(flushOnSaveCheckBox))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(createVersionOnSaveCheckBox)
                    .addComponent(compileOnDemandCheckBox))
                .addContainerGap(35, Short.MAX_VALUE))
        );

        enableAdvancedOptionsCheckBox.setText("Unlock Advanced Options (experimental, increases the possibility of data loss!)");
        enableAdvancedOptionsCheckBox.setToolTipText("Only unlock advanced options if you know exactly what you do!");
        enableAdvancedOptionsCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                enableAdvancedOptionsCheckBoxActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(enableAdvancedOptionsCheckBox, javax.swing.GroupLayout.DEFAULT_SIZE, 656, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 164, Short.MAX_VALUE)
                .addComponent(enableAdvancedOptionsCheckBox)
                .addContainerGap())
        );

        jTabbedPane1.addTab("General", jPanel9);

        jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder("Updates"));
        jPanel13.setOpaque(false);

        jPanel14.setOpaque(false);
        jPanel14.setLayout(new javax.swing.BoxLayout(jPanel14, javax.swing.BoxLayout.LINE_AXIS));
        jPanel14.add(filler7);
        jPanel14.add(filler8);

        jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder("Check for Updates"));

        checkForUpdatesOnStartupItem.setSelected(true);
        checkForUpdatesOnStartupItem.setText("Check for updates on startup");
        checkForUpdatesOnStartupItem.setToolTipText("Defines whether to restore the last position of the main window");
        checkForUpdatesOnStartupItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkForUpdatesOnStartupItemActionPerformed(evt);
            }
        });

        jPanel16.setOpaque(false);
        jPanel16.setLayout(new javax.swing.BoxLayout(jPanel16, javax.swing.BoxLayout.LINE_AXIS));
        jPanel16.add(filler9);

        checkForUpdatesBtn.setText("Check for Updates Now");
        checkForUpdatesBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkForUpdatesBtnActionPerformed(evt);
            }
        });
        jPanel16.add(checkForUpdatesBtn);
        jPanel16.add(filler10);

        javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15);
        jPanel15.setLayout(jPanel15Layout);
        jPanel15Layout.setHorizontalGroup(
            jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel15Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(checkForUpdatesOnStartupItem)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addComponent(jPanel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel15Layout.setVerticalGroup(
            jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel15Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(checkForUpdatesOnStartupItem)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE)
                .addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jPanel17.setBorder(javax.swing.BorderFactory.createTitledBorder("Update Source"));

        updateSourceURLLabel.setText("http://vrl-studio.mihosoft.eu/updates/");
        updateSourceURLLabel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                updateSourceURLLabelActionPerformed(evt);
            }
        });

        jLabel5.setText("URL:");

        jPanel18.setOpaque(false);
        jPanel18.setLayout(new javax.swing.BoxLayout(jPanel18, javax.swing.BoxLayout.LINE_AXIS));
        jPanel18.add(filler11);

        setURLBtn.setText("Set URL");
        setURLBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                setURLBtnActionPerformed(evt);
            }
        });
        jPanel18.add(setURLBtn);
        jPanel18.add(filler12);

        javax.swing.GroupLayout updateSourceLogPanelLayout = new javax.swing.GroupLayout(updateSourceLogPanel);
        updateSourceLogPanel.setLayout(updateSourceLogPanelLayout);
        updateSourceLogPanelLayout.setHorizontalGroup(
            updateSourceLogPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        updateSourceLogPanelLayout.setVerticalGroup(
            updateSourceLogPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 132, Short.MAX_VALUE)
        );

        jLabel6.setText("Public Key:");

        updateSourceKeyLabel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                updateSourceKeyLabelActionPerformed(evt);
            }
        });

        chooseUpdateKyFileBtn.setText("...");
        chooseUpdateKyFileBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chooseUpdateKyFileBtnActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel17Layout = new javax.swing.GroupLayout(jPanel17);
        jPanel17.setLayout(jPanel17Layout);
        jPanel17Layout.setHorizontalGroup(
            jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel17Layout.createSequentialGroup()
                .addComponent(updateSourceLogPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(jPanel17Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel18, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel17Layout.createSequentialGroup()
                        .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                            .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(10, 10, 10)
                        .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel17Layout.createSequentialGroup()
                                .addComponent(updateSourceKeyLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(chooseUpdateKyFileBtn))
                            .addComponent(updateSourceURLLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 552, Short.MAX_VALUE))
                        .addContainerGap())))
        );
        jPanel17Layout.setVerticalGroup(
            jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel17Layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(updateSourceURLLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addGap(18, 18, 18)
                .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(updateSourceKeyLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)
                    .addComponent(chooseUpdateKyFileBtn))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(updateSourceLogPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout.setHorizontalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel13Layout.setVerticalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel13Layout.createSequentialGroup()
                .addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jTabbedPane1.addTab("Updates", jPanel13);

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder("Control Flow & Invocation"));

        enableInvokationVisualization.setText("Enable Invocation Visualization");
        enableInvokationVisualization.setToolTipText("Methods are darkened until invokation is finished");
        enableInvokationVisualization.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                enableInvokationVisualizationActionPerformed(evt);
            }
        });

        invocationDelayTitle.setText("Invocation Delay:");

        invocationSlider.setMajorTickSpacing(1000);
        invocationSlider.setMaximum(10000);
        invocationSlider.setMinorTickSpacing(500);
        invocationSlider.setPaintTicks(true);
        invocationSlider.setSnapToTicks(true);
        invocationSlider.setToolTipText("Delay Invokation of each Method for Debugging Purposes");
        invocationSlider.setValue(0);
        invocationSlider.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                invocationSliderMouseReleased(evt);
            }
        });
        invocationSlider.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                invocationSliderStateChanged(evt);
            }
        });

        delayLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        delayLabel.setText("0 ms");

        visualizeParamEvaluationCheckBox.setSelected(true);
        visualizeParamEvaluationCheckBox.setText("Visualize Parameter Evaluation");
        visualizeParamEvaluationCheckBox.setToolTipText("Parameter flash green/yellow or red depending on whether evaluation was successful");
        visualizeParamEvaluationCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                visualizeParamEvaluationCheckBoxActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addComponent(enableInvokationVisualization)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 242, Short.MAX_VALUE)
                        .addComponent(visualizeParamEvaluationCheckBox))
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addGap(22, 22, 22)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel11Layout.createSequentialGroup()
                                .addComponent(invocationDelayTitle)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(delayLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addComponent(invocationSlider, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(enableInvokationVisualization)
                    .addComponent(visualizeParamEvaluationCheckBox))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(invocationDelayTitle)
                    .addComponent(delayLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(invocationSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30))
        );

        jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder("Debug"));

        showDebugMenu.setText("Show Debug Menu");
        showDebugMenu.setToolTipText("The Debug Menu gives access to GC and allows UI Debugging");
        showDebugMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showDebugMenuActionPerformed(evt);
            }
        });

        showOutCheckBox.setText("<html>Show <b>System.out</b> in Log</html>");
        showOutCheckBox.setToolTipText("Defines whether to show System.out in Log");
        showOutCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showOutCheckBoxActionPerformed(evt);
            }
        });

        showErrCheckBox.setText("<html>Show <b>System.err</b> in Log</html>");
        showErrCheckBox.setToolTipText("Defines whether to show System.err in Log");
        showErrCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showErrCheckBoxActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(showDebugMenu)
                    .addComponent(showOutCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(showErrCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(showDebugMenu)
                .addGap(29, 29, 29)
                .addComponent(showOutCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(showErrCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(190, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel12, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Development", jPanel10);

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Bundled Software"));

        jLabel4.setText("<html><p><b>Description:</b></p><br><p>Bundled software and resources (plugins, project templates etc.) can be automatically installed. If the software is already installed it will be overwritten. It is necessary to restart VRL-Studio to finish this operation.</p></html>");

        jPanel8.setOpaque(false);
        jPanel8.setLayout(new javax.swing.BoxLayout(jPanel8, javax.swing.BoxLayout.LINE_AXIS));
        jPanel8.add(filler5);

        jButton3.setText("Install Bundled Software");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        jPanel8.add(jButton3);
        jPanel8.add(filler6);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 670, Short.MAX_VALUE)
                    .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, 670, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 340, Short.MAX_VALUE)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jTabbedPane1.addTab("Bundled Software", jPanel4);

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Plugin Cache"));
        jPanel5.setOpaque(false);

        jLabel2.setText("<html><p><b>Description:</b></p><br><p>The plugin cache contains plugin/library information that can improves startup time. On some systems the cache may cause problems with newly installled plugins. Delete the plugin cache if newly installed plugins are not detected and restart VRL-Studio.</p></html>");

        jPanel6.setOpaque(false);
        jPanel6.setLayout(new javax.swing.BoxLayout(jPanel6, javax.swing.BoxLayout.LINE_AXIS));
        jPanel6.add(filler3);

        jButton2.setText("Delete Plugin Cache");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        jPanel6.add(jButton2);
        jPanel6.add(filler4);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, 682, Short.MAX_VALUE)
            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 682, Short.MAX_VALUE)
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 340, Short.MAX_VALUE)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jTabbedPane1.addTab("Plugin Cache", jPanel5);

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Preference Folder"));
        jPanel2.setOpaque(false);

        jLabel1.setText("<html><p><b>Description:</b></p><br><p>The preference folder contains cached versions of recently opened files, a project template, plugins and user preferences. Deleting the preference folder is useful if default preferences shall be used or if the program shall be uninstalled.</p></html>");

        jPanel3.setOpaque(false);
        jPanel3.setLayout(new javax.swing.BoxLayout(jPanel3, javax.swing.BoxLayout.LINE_AXIS));
        jPanel3.add(filler1);

        jButton1.setText("Delete Preference Folder");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jPanel3.add(jButton1);
        jPanel3.add(filler2);

        jLabel3.setText("Location:");

        preferenceFolderLocation.setEditable(false);
        preferenceFolderLocation.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                preferenceFolderLocationActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 682, Short.MAX_VALUE)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 676, Short.MAX_VALUE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(preferenceFolderLocation, javax.swing.GroupLayout.DEFAULT_SIZE, 612, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(preferenceFolderLocation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 301, Short.MAX_VALUE)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jTabbedPane1.addTab("Property Folder", jPanel2);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    public void setPreferenceFolderLocation(String s) {
        preferenceFolderLocation.setText(s);
        preferenceFolderLocation.setToolTipText("Location: " + s);
    }

    public void initConfig(File configFile) {
        config = IOUtil.newConfigurationFile(configFile);

        showDebugMenu.setSelected(studio.getDebugMenu().isVisible());

        // return if loading is not possible: nothing to initialize
        if (!config.load()) {
            return;
        }

        if (config.containsProperty(RESTORE_WIN_POS_KEY)) {
            restoreWinPosOnStartCheckBox.setSelected(
                    Boolean.parseBoolean(
                    config.getProperty(RESTORE_WIN_POS_KEY)));
        }

        if (config.containsProperty(LoggingController.SHOW_OUT_LOG_KEY)) {
            showOutCheckBox.setSelected(
                    Boolean.parseBoolean(
                    config.getProperty(LoggingController.SHOW_OUT_LOG_KEY)));
        }

        if (config.containsProperty(LoggingController.SHOW_ERR_LOG_KEY)) {
            showErrCheckBox.setSelected(
                    Boolean.parseBoolean(
                    config.getProperty(LoggingController.SHOW_ERR_LOG_KEY)));
        }

        if (config.containsProperty(DIALOG_ON_START_KEY)) {
            showDialogOnStartCheckBox.setSelected(
                    Boolean.parseBoolean(
                    config.getProperty(DIALOG_ON_START_KEY)));
        }


        if (config.containsProperty(CanvasConfig.SHOW_INVOCATION_KEY)) {
            enableInvokationVisualization.setSelected(
                    Boolean.parseBoolean(
                    config.getProperty(CanvasConfig.SHOW_INVOCATION_KEY)));
        }

        if (config.containsProperty(CanvasConfig.INVOCATION_DELAY_KEY)) {
            invocationSlider.setValue(
                    Integer.parseInt(
                    config.getProperty(CanvasConfig.INVOCATION_DELAY_KEY)));
            delayLabel.setText(invocationSlider.getValue() + " ms");
        }

        if (config.containsProperty(CanvasConfig.PARAM_EVALUATION_KEY)) {
            Boolean b = Boolean.parseBoolean(
                    config.getProperty(CanvasConfig.PARAM_EVALUATION_KEY));
            visualizeParamEvaluationCheckBox.setSelected(b);
        }

        if (config.containsProperty(CanvasConfig.VISUAL_SAVE_KEY)) {
            Boolean b = Boolean.parseBoolean(
                    config.getProperty(CanvasConfig.VISUAL_SAVE_KEY));
            indicateSaveCheckbox.setSelected(b);
        }

        // enable/disable ui
        invocationSlider.setEnabled(enableInvokationVisualization.isSelected());

        if (!enableInvokationVisualization.isSelected()) {
            invocationSlider.setValue(0);
        }

        delayLabel.setEnabled(enableInvokationVisualization.isSelected());
        invocationDelayTitle.setEnabled(enableInvokationVisualization.isSelected());


        if (config.containsProperty(CanvasConfig.CREATE_VERSION_ON_SAVE_KEY)) {
            Boolean b = Boolean.parseBoolean(
                    config.getProperty(CanvasConfig.CREATE_VERSION_ON_SAVE_KEY));
            createVersionOnSaveCheckBox.setSelected(b);
        }

        if (config.containsProperty(CanvasConfig.FLUSH_ON_SAVE_KEY)) {
            Boolean b = Boolean.parseBoolean(
                    config.getProperty(CanvasConfig.FLUSH_ON_SAVE_KEY));
            flushOnSaveCheckBox.setSelected(b);
        }

        if (config.containsProperty(CHECK_FOR_UPDATES_ON_STARTUP_KEY)) {
            Boolean b = Boolean.parseBoolean(
                    config.getProperty(CHECK_FOR_UPDATES_ON_STARTUP_KEY));
            checkForUpdatesOnStartupItem.setSelected(b);
        }

        if (config.containsProperty(UPDATE_URL_KEY)) {
            String url =
                    config.getProperty(UPDATE_URL_KEY);
            updateSourceURLLabel.setText(url);
        }

        if (config.containsProperty(UPDATE_KEY_KEY)) {
            String key =
                    config.getProperty(UPDATE_KEY_KEY);
            updateSourceKeyLabel.setText(key);
        }
    }

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        //
        int answer = JOptionPane.showConfirmDialog(this,
                "Do you want to delete the preference folder?\n"
                + "All plugins and custom preferences will be deleted.\n"
                + "This cannot be undone!",
                "Delete Preference Folder?",
                JOptionPane.YES_NO_OPTION);

        if (answer == JOptionPane.YES_OPTION) {
            try {
                VRL.getPropertyFolderManager().remove();
                setVisible(false);
            } catch (IOException ex) {
                Logger.getLogger(PreferenceWindow.class.getName()).
                        log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        //

        PluginCacheController.deleteAllCaches();

        setVisible(false);

    }//GEN-LAST:event_jButton2ActionPerformed

    private void preferenceFolderLocationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_preferenceFolderLocationActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_preferenceFolderLocationActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        //
        int answer = JOptionPane.showConfirmDialog(this,
                "Do you want to install bundled software?\n"
                + "If the bundled software is already installed it will be overwritten.\n"
                + "This cannot be undone!",
                "Install Bundled Software?",
                JOptionPane.YES_NO_OPTION);

        if (answer == JOptionPane.YES_OPTION) {
            try {
                VRL.getPropertyFolderManager().installBundledSoftwareAndResources();
                setVisible(false);
            } catch (IOException ex) {
                Logger.getLogger(PreferenceWindow.class.getName()).
                        log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_jButton3ActionPerformed

    private void showErrCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showErrCheckBoxActionPerformed
        //
        config.setProperty(
                LoggingController.SHOW_ERR_LOG_KEY, "" + showErrCheckBox.isSelected());
        config.save();

        studio.getLoggingController().setStdErrEnabled(
                showErrCheckBox.isSelected());
    }//GEN-LAST:event_showErrCheckBoxActionPerformed

    private void showOutCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showOutCheckBoxActionPerformed
        //
        config.setProperty(
                LoggingController.SHOW_OUT_LOG_KEY, "" + showOutCheckBox.isSelected());
        config.save();

        studio.getLoggingController().setStdOutEnabled(
                showOutCheckBox.isSelected());
    }//GEN-LAST:event_showOutCheckBoxActionPerformed

    private void showDebugMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showDebugMenuActionPerformed
        //
        studio.getDebugMenu().setVisible(showDebugMenu.isSelected());
    }//GEN-LAST:event_showDebugMenuActionPerformed

    private void enableInvokationVisualizationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enableInvokationVisualizationActionPerformed
        //
        config.setProperty(
                CanvasConfig.SHOW_INVOCATION_KEY, ""
                + enableInvokationVisualization.isSelected());
        config.save();

        CanvasConfig canvasConfig = new CanvasConfig(studio.getCurrentCanvas());
        canvasConfig.configChanged(CanvasConfig.SHOW_INVOCATION_KEY,
                "" + enableInvokationVisualization.isSelected());

        delayLabel.setEnabled(enableInvokationVisualization.isSelected());
        invocationDelayTitle.setEnabled(enableInvokationVisualization.isSelected());

        if (!enableInvokationVisualization.isSelected()) {
            invocationSlider.setValue(0);
        }

        invocationSlider.setEnabled(enableInvokationVisualization.isSelected());
    }//GEN-LAST:event_enableInvokationVisualizationActionPerformed

    private void invocationSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_invocationSliderStateChanged
        //

        CanvasConfig canvasConfig = new CanvasConfig(studio.getCurrentCanvas());
        canvasConfig.configChanged(CanvasConfig.INVOCATION_DELAY_KEY,
                "" + invocationSlider.getValue());

        delayLabel.setText(invocationSlider.getValue() + " ms");
    }//GEN-LAST:event_invocationSliderStateChanged

    private void visualizeParamEvaluationCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_visualizeParamEvaluationCheckBoxActionPerformed
        //
        config.setProperty(
                CanvasConfig.PARAM_EVALUATION_KEY, ""
                + visualizeParamEvaluationCheckBox.isSelected());
        config.save();

        CanvasConfig canvasConfig = new CanvasConfig(studio.getCurrentCanvas());
        canvasConfig.configChanged(CanvasConfig.PARAM_EVALUATION_KEY,
                "" + visualizeParamEvaluationCheckBox.isSelected());
    }//GEN-LAST:event_visualizeParamEvaluationCheckBoxActionPerformed

    private void invocationSliderMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_invocationSliderMouseReleased
        //
        config.setProperty(
                CanvasConfig.INVOCATION_DELAY_KEY, ""
                + invocationSlider.getValue());
        config.save();
    }//GEN-LAST:event_invocationSliderMouseReleased

    private void flushOnSaveCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_flushOnSaveCheckBoxActionPerformed
        //
        config.setProperty(
                CanvasConfig.FLUSH_ON_SAVE_KEY, ""
                + flushOnSaveCheckBox.isSelected());
        config.save();

        CanvasConfig canvasConfig = new CanvasConfig(studio.getCurrentCanvas());
        canvasConfig.configChanged(CanvasConfig.FLUSH_ON_SAVE_KEY,
                "" + flushOnSaveCheckBox.isSelected());
    }//GEN-LAST:event_flushOnSaveCheckBoxActionPerformed

    private void createVersionOnSaveCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createVersionOnSaveCheckBoxActionPerformed
        //
        config.setProperty(
                CanvasConfig.CREATE_VERSION_ON_SAVE_KEY, ""
                + createVersionOnSaveCheckBox.isSelected());
        config.save();

        CanvasConfig canvasConfig = new CanvasConfig(studio.getCurrentCanvas());
        canvasConfig.configChanged(CanvasConfig.CREATE_VERSION_ON_SAVE_KEY,
                "" + createVersionOnSaveCheckBox.isSelected());
    }//GEN-LAST:event_createVersionOnSaveCheckBoxActionPerformed

    private void compileOnDemandCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_compileOnDemandCheckBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_compileOnDemandCheckBoxActionPerformed

    private void indicateSaveCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_indicateSaveCheckboxActionPerformed
        //
        config.setProperty(
                CanvasConfig.VISUAL_SAVE_KEY, ""
                + indicateSaveCheckbox.isSelected());
        config.save();

        CanvasConfig canvasConfig = new CanvasConfig(studio.getCurrentCanvas());
        canvasConfig.configChanged(CanvasConfig.VISUAL_SAVE_KEY,
                "" + indicateSaveCheckbox.isSelected());
    }//GEN-LAST:event_indicateSaveCheckboxActionPerformed

    private void showDialogOnStartCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showDialogOnStartCheckBoxActionPerformed
        //
        config.setProperty(
                DIALOG_ON_START_KEY, ""
                + showDialogOnStartCheckBox.isSelected());
        config.save();
    }//GEN-LAST:event_showDialogOnStartCheckBoxActionPerformed

    private void restoreWinPosOnStartCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_restoreWinPosOnStartCheckBoxActionPerformed
        //
        config.setProperty(
                RESTORE_WIN_POS_KEY, "" + restoreWinPosOnStartCheckBox.isSelected());
        config.save();
    }//GEN-LAST:event_restoreWinPosOnStartCheckBoxActionPerformed

    private void enableAdvancedOptionsCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enableAdvancedOptionsCheckBoxActionPerformed
        //

        createVersionOnSaveCheckBox.setEnabled(enableAdvancedOptionsCheckBox.isSelected());
        flushOnSaveCheckBox.setEnabled(enableAdvancedOptionsCheckBox.isSelected());
    }//GEN-LAST:event_enableAdvancedOptionsCheckBoxActionPerformed

    private void checkForUpdatesOnStartupItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkForUpdatesOnStartupItemActionPerformed
        //
        config.setProperty(
                CHECK_FOR_UPDATES_ON_STARTUP_KEY, ""
                + checkForUpdatesOnStartupItem.isSelected());
        config.save();

        CanvasConfig canvasConfig = new CanvasConfig(studio.getCurrentCanvas());
        canvasConfig.configChanged(CHECK_FOR_UPDATES_ON_STARTUP_KEY,
                "" + checkForUpdatesOnStartupItem.isSelected());
    }//GEN-LAST:event_checkForUpdatesOnStartupItemActionPerformed

    private void checkForUpdatesBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkForUpdatesBtnActionPerformed
        //
        studio.checkForUpdates();
        close();
    }//GEN-LAST:event_checkForUpdatesBtnActionPerformed

    private void updateSourceKeyLabelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateSourceKeyLabelActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_updateSourceKeyLabelActionPerformed

    private void setURLBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_setURLBtnActionPerformed
        //
        // validate URL
        URL url = null;
        boolean validURL = true;
        try {
            url = new URL(updateSourceURLLabel.getText());
        } catch (MalformedURLException ex) {
            validURL = false;
        }

        if (!validURL) {
            JOptionPane.showMessageDialog(this, "Specified URL is invalid!");
            return;
        }

        // validate Key Path
        File keyPath = null;

        if (!updateSourceKeyLabel.getText().trim().isEmpty()) {
            keyPath = new File(updateSourceKeyLabel.getText());

            boolean validKeyPath = keyPath.isFile();

            if (!validKeyPath) {
                JOptionPane.showMessageDialog(this, "Specified Key Path is invalid!");
                return;
            }
        }

        config.setProperty(
                UPDATE_URL_KEY, updateSourceURLLabel.getText());
        config.setProperty(
                UPDATE_KEY_KEY, updateSourceKeyLabel.getText());
        config.save();

        CanvasConfig canvasConfig =
                new CanvasConfig(studio.getCurrentCanvas());
        canvasConfig.configChanged(UPDATE_URL_KEY,
                updateSourceURLLabel.getText());
        canvasConfig.configChanged(UPDATE_KEY_KEY,
                updateSourceKeyLabel.getText());

        studio.setUpateSource(url);
        studio.setUpdateKeyPath(keyPath);
        studio.checkForUpdates();
       
        close();
    }//GEN-LAST:event_setURLBtnActionPerformed

    private void updateSourceURLLabelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateSourceURLLabelActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_updateSourceURLLabelActionPerformed

    private void chooseUpdateKyFileBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chooseUpdateKyFileBtnActionPerformed
        //
        FileDialogManager fdM = new FileDialogManager();
        File keyPath = fdM.getLoadFile(this, null);

        if (keyPath != null) {
            updateSourceKeyLabel.setText(keyPath.getAbsolutePath());
        }
    }//GEN-LAST:event_chooseUpdateKyFileBtnActionPerformed

    public void close() {
        setVisible(false);
        studio.window = null;
        PreferenceWindow.this.dispose();
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(PreferenceWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(PreferenceWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(PreferenceWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(PreferenceWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new PreferenceWindow().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton checkForUpdatesBtn;
    private javax.swing.JCheckBox checkForUpdatesOnStartupItem;
    private javax.swing.JButton chooseUpdateKyFileBtn;
    private javax.swing.JCheckBox compileOnDemandCheckBox;
    private javax.swing.JCheckBox createVersionOnSaveCheckBox;
    private javax.swing.JLabel delayLabel;
    private javax.swing.JCheckBox enableAdvancedOptionsCheckBox;
    private javax.swing.JCheckBox enableInvokationVisualization;
    private javax.swing.Box.Filler filler1;
    private javax.swing.Box.Filler filler10;
    private javax.swing.Box.Filler filler11;
    private javax.swing.Box.Filler filler12;
    private javax.swing.Box.Filler filler2;
    private javax.swing.Box.Filler filler3;
    private javax.swing.Box.Filler filler4;
    private javax.swing.Box.Filler filler5;
    private javax.swing.Box.Filler filler6;
    private javax.swing.Box.Filler filler7;
    private javax.swing.Box.Filler filler8;
    private javax.swing.Box.Filler filler9;
    private javax.swing.JCheckBox flushOnSaveCheckBox;
    private javax.swing.JCheckBox indicateSaveCheckbox;
    private javax.swing.JLabel invocationDelayTitle;
    private javax.swing.JSlider invocationSlider;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField preferenceFolderLocation;
    private javax.swing.JCheckBox restoreWinPosOnStartCheckBox;
    private javax.swing.JButton setURLBtn;
    private javax.swing.JCheckBox showDebugMenu;
    private javax.swing.JCheckBox showDialogOnStartCheckBox;
    private javax.swing.JCheckBox showErrCheckBox;
    private javax.swing.JCheckBox showOutCheckBox;
    private javax.swing.JTextField updateSourceKeyLabel;
    private javax.swing.JPanel updateSourceLogPanel;
    private javax.swing.JTextField updateSourceURLLabel;
    private javax.swing.JCheckBox visualizeParamEvaluationCheckBox;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the studio
     */
    public Studio getStudio() {
        return studio;
    }

    /**
     * @param studio the studio to set
     */
    public void setStudio(Studio studio) {
        this.studio = studio;
    }
}
TOP

Related Classes of eu.mihosoft.vrlstudio.main.PreferenceWindow

TOP
Copyright © 2018 www.massapi.com. 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.