Class ReasonerPreferencePage

  • All Implemented Interfaces:
    org.eclipse.jface.dialogs.IDialogPage, org.eclipse.jface.dialogs.IMessageProvider, org.eclipse.jface.preference.IPreferencePage, org.eclipse.swt.widgets.Listener, org.eclipse.ui.IWorkbenchPreferencePage

    public class ReasonerPreferencePage
    extends org.eclipse.jface.preference.PreferencePage
    implements org.eclipse.ui.IWorkbenchPreferencePage, org.eclipse.swt.widgets.Listener
    Implements the preference page.
    Author:
    Holger Eichelberger
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static boolean DEBUG  
      private static ReasonerDescriptor[] DEBUG_REASONERS  
      private org.eclipse.swt.widgets.Button dir  
      private org.eclipse.swt.widgets.Button file  
      private ReasonerFrontend frontend  
      private org.eclipse.swt.widgets.Text license  
      private org.eclipse.swt.widgets.Text licenseRestriction  
      private org.eclipse.swt.widgets.Table reasoners  
      private org.eclipse.swt.widgets.Button setDefault  
      private static java.lang.String UNKNOWN  
      private org.eclipse.swt.widgets.Button upgrade  
      private org.eclipse.swt.widgets.Text url  
      private org.eclipse.swt.widgets.Text version  
      • Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider

        ERROR, INFORMATION, NONE, WARNING
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static int availableRows​(org.eclipse.swt.widgets.Composite parent)
      Return the number of rows available in the current display using the current font.
      protected org.eclipse.swt.widgets.Control createContents​(org.eclipse.swt.widgets.Composite parent)
      private void createReasonerDescriptionComponents​(org.eclipse.swt.widgets.Composite pageComponent)
      Creates the components for describing a reasoner.
      private org.eclipse.swt.widgets.Composite createUpgradeButtons​(org.eclipse.swt.widgets.Composite pageComponent)
      Creates a formatted component for the upgrade buttons.
      private void displayDirDialog()
      Display the directory dialog for choosing the URL source.
      private void displayFileDialog()
      Display the file dialog for choosing the URL source.
      private void displayReasonerData()
      Displays the data of the currently selected reasoner and switches the enabled states accordingly.
      private ReasonerDescriptor getReasonerDescriptor​(int index)
      Returns the specified reasoner descriptor.
      private int getReasonersCount()
      Returns the number of available reasoner descriptors.
      private ReasonerDescriptor getSelected()
      Returns the currently selected reasoner.
      void handleEvent​(org.eclipse.swt.widgets.Event event)
      void init​(org.eclipse.ui.IWorkbench workbench)
      private void initializeReasonersList()
      Initializes the list of reasoners.
      private static java.lang.String toSafeString​(java.lang.String string)
      Turns a string into a safe (empty) string.
      private void upgrade()
      Performs the upgrade of the selected reasoner.
      • Methods inherited from class org.eclipse.jface.preference.PreferencePage

        applyData, applyDialogFont, computeSize, contributeButtons, createControl, createDescriptionLabel, createNoteComposite, doComputeSize, doGetPreferenceStore, getApplyButton, getContainer, getDefaultsButton, getPreferenceStore, isValid, noDefaultAndApplyButton, noDefaultButton, okToLeave, performApply, performCancel, performDefaults, performHelp, performOk, setContainer, setErrorMessage, setMessage, setPreferenceStore, setSize, setTitle, setValid, toString, updateApplyButton
      • Methods inherited from class org.eclipse.jface.dialogs.DialogPage

        convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, dispose, getControl, getDescription, getDialogFontName, getErrorMessage, getFont, getImage, getMessage, getMessageType, getShell, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, setButtonLayoutData, setControl, setDescription, setImageDescriptor, setMessage, setVisible
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.eclipse.jface.dialogs.IDialogPage

        createControl, dispose, getControl, getDescription, getErrorMessage, getImage, getMessage, getTitle, performHelp, setDescription, setImageDescriptor, setTitle, setVisible
      • Methods inherited from interface org.eclipse.jface.preference.IPreferencePage

        computeSize, isValid, okToLeave, performCancel, performOk, setContainer, setSize
    • Field Detail

      • reasoners

        private org.eclipse.swt.widgets.Table reasoners
      • license

        private org.eclipse.swt.widgets.Text license
      • licenseRestriction

        private org.eclipse.swt.widgets.Text licenseRestriction
      • version

        private org.eclipse.swt.widgets.Text version
      • url

        private org.eclipse.swt.widgets.Text url
      • file

        private org.eclipse.swt.widgets.Button file
      • dir

        private org.eclipse.swt.widgets.Button dir
      • upgrade

        private org.eclipse.swt.widgets.Button upgrade
      • setDefault

        private org.eclipse.swt.widgets.Button setDefault
    • Constructor Detail

      • ReasonerPreferencePage

        public ReasonerPreferencePage()
    • Method Detail

      • init

        public void init​(org.eclipse.ui.IWorkbench workbench)
        Specified by:
        init in interface org.eclipse.ui.IWorkbenchPreferencePage
      • createContents

        protected org.eclipse.swt.widgets.Control createContents​(org.eclipse.swt.widgets.Composite parent)
        Specified by:
        createContents in class org.eclipse.jface.preference.PreferencePage
      • createReasonerDescriptionComponents

        private void createReasonerDescriptionComponents​(org.eclipse.swt.widgets.Composite pageComponent)
        Creates the components for describing a reasoner.
        Parameters:
        pageComponent - the parent page component
      • createUpgradeButtons

        private org.eclipse.swt.widgets.Composite createUpgradeButtons​(org.eclipse.swt.widgets.Composite pageComponent)
        Creates a formatted component for the upgrade buttons.
        Parameters:
        pageComponent - the parent page component
        Returns:
        the created component
      • getReasonersCount

        private int getReasonersCount()
        Returns the number of available reasoner descriptors. This method transparently uses any virtual reasoner defined in this class for debugging the UI.
        Returns:
        the number of available reasoners
      • getReasonerDescriptor

        private ReasonerDescriptor getReasonerDescriptor​(int index)
        Returns the specified reasoner descriptor. This method transparently uses any virtual reasoner defined in this class for debugging the UI.
        Parameters:
        index - the index of the reasoner to return
        Returns:
        the reasoner
        Throws:
        java.lang.IndexOutOfBoundsException - if index<0 || index>={getReasonersCount()}
      • initializeReasonersList

        private void initializeReasonersList()
        Initializes the list of reasoners.
      • availableRows

        public static int availableRows​(org.eclipse.swt.widgets.Composite parent)
        Return the number of rows available in the current display using the current font.
        Parameters:
        parent - The Composite whose Font will be queried.
        Returns:
        the result of the display size divided by the font size.
      • handleEvent

        public void handleEvent​(org.eclipse.swt.widgets.Event event)
        Specified by:
        handleEvent in interface org.eclipse.swt.widgets.Listener
      • toSafeString

        private static final java.lang.String toSafeString​(java.lang.String string)
        Turns a string into a safe (empty) string.
        Parameters:
        string - the string to be considered
        Returns:
        string or an empty string if string = null
      • displayReasonerData

        private void displayReasonerData()
        Displays the data of the currently selected reasoner and switches the enabled states accordingly.
      • getSelected

        private ReasonerDescriptor getSelected()
        Returns the currently selected reasoner.
        Returns:
        the currently selected reasoner
      • displayFileDialog

        private void displayFileDialog()
        Display the file dialog for choosing the URL source.
      • displayDirDialog

        private void displayDirDialog()
        Display the directory dialog for choosing the URL source.
      • upgrade

        private void upgrade()
        Performs the upgrade of the selected reasoner.