Search in sources :

Example 1 with IWorkbenchPropertyPage

use of org.eclipse.ui.IWorkbenchPropertyPage in project dbeaver by serge-rider.

the class EditConnectionWizard method saveSettings.

@Override
protected void saveSettings(DataSourceDescriptor dataSource) {
    if (isPageActive(pageSettings)) {
        pageSettings.saveSettings(dataSource);
    }
    pageGeneral.saveSettings(dataSource);
    pageInit.saveSettings(dataSource);
    pageEvents.saveSettings(dataSource);
    for (IDialogPage page : getPages()) {
        if (page instanceof WizardPrefPage) {
            page = ((WizardPrefPage) page).getPreferencePage();
        }
        if (page instanceof IWorkbenchPropertyPage) {
            ((IWorkbenchPropertyPage) page).setElement(dataSource);
        }
    }
    super.savePrefPageSettings();
    // Reset password if "Save password" was disabled
    if (!dataSource.isSavePassword()) {
        dataSource.getConnectionConfiguration().setUserPassword(null);
    }
}
Also used : IWorkbenchPropertyPage(org.eclipse.ui.IWorkbenchPropertyPage) IDialogPage(org.eclipse.jface.dialogs.IDialogPage)

Example 2 with IWorkbenchPropertyPage

use of org.eclipse.ui.IWorkbenchPropertyPage in project dbeaver by serge-rider.

the class ActiveWizard method createPreferencePage.

protected WizardPrefPage createPreferencePage(IPreferencePage prefPage, String title, String description) {
    WizardPrefPage wizardPage = new WizardPrefPage(prefPage, title, description);
    prefPages.add(wizardPage);
    if (prefPage instanceof IWorkbenchPropertyPage) {
        ((IWorkbenchPropertyPage) prefPage).setElement(getActiveElement());
    }
    return wizardPage;
}
Also used : WizardPrefPage(org.jkiss.dbeaver.ui.preferences.WizardPrefPage) IWorkbenchPropertyPage(org.eclipse.ui.IWorkbenchPropertyPage)

Example 3 with IWorkbenchPropertyPage

use of org.eclipse.ui.IWorkbenchPropertyPage in project dbeaver by dbeaver.

the class ActiveWizard method createPreferencePage.

protected WizardPrefPage createPreferencePage(IPreferencePage prefPage, String title, String description) {
    WizardPrefPage wizardPage = new WizardPrefPage(prefPage, title, description);
    prefPages.add(wizardPage);
    if (prefPage instanceof IWorkbenchPropertyPage) {
        ((IWorkbenchPropertyPage) prefPage).setElement(getActiveElement());
    }
    return wizardPage;
}
Also used : WizardPrefPage(org.jkiss.dbeaver.ui.preferences.WizardPrefPage) IWorkbenchPropertyPage(org.eclipse.ui.IWorkbenchPropertyPage)

Example 4 with IWorkbenchPropertyPage

use of org.eclipse.ui.IWorkbenchPropertyPage in project dbeaver by dbeaver.

the class EditConnectionWizard method saveSettings.

@Override
protected void saveSettings(DataSourceDescriptor dataSource) {
    if (isPageActive(pageSettings)) {
        pageSettings.saveSettings(dataSource);
    }
    pageGeneral.saveSettings(dataSource);
    pageInit.saveSettings(dataSource);
    pageEvents.saveSettings(dataSource);
    for (IDialogPage page : getPages()) {
        if (page instanceof WizardPrefPage) {
            page = ((WizardPrefPage) page).getPreferencePage();
        }
        if (page instanceof IWorkbenchPropertyPage) {
            ((IWorkbenchPropertyPage) page).setElement(dataSource);
        }
    }
    super.savePrefPageSettings();
    // Reset password if "Save password" was disabled
    if (!dataSource.isSavePassword()) {
        dataSource.getConnectionConfiguration().setUserPassword(null);
    }
}
Also used : IWorkbenchPropertyPage(org.eclipse.ui.IWorkbenchPropertyPage) IDialogPage(org.eclipse.jface.dialogs.IDialogPage)

Example 5 with IWorkbenchPropertyPage

use of org.eclipse.ui.IWorkbenchPropertyPage in project dbeaver by serge-rider.

the class WizardPrefPage method addSubPage.

public WizardPrefPage addSubPage(String pageId, Class<?> ownerBundleClass, IPreferencePage page) {
    String pageName = pageId, pageDescription = pageId;
    try {
        Bundle pageBundle = FrameworkUtil.getBundle(ownerBundleClass);
        ResourceBundle resourceBundle = Activator.getDefault().getLocalization(pageBundle, Locale.getDefault().getLanguage());
        try {
            pageName = resourceBundle.getString("page." + pageId + ".name");
        } catch (Exception e) {
            pageName = pageId;
        }
        try {
            pageDescription = resourceBundle.getString("page." + pageId + ".description");
        } catch (Exception e) {
            pageDescription = pageName;
        }
    } catch (Exception e) {
    // Ignore
    }
    WizardPrefPage wizardPrefPage = new WizardPrefPage(page, pageName, pageDescription);
    subPages.add(wizardPrefPage);
    // Sety the same element to sub page
    if (preferencePage instanceof IWorkbenchPropertyPage && page instanceof IWorkbenchPropertyPage) {
        ((IWorkbenchPropertyPage) page).setElement(((IWorkbenchPropertyPage) preferencePage).getElement());
    }
    return wizardPrefPage;
}
Also used : IWorkbenchPropertyPage(org.eclipse.ui.IWorkbenchPropertyPage) ResourceBundle(java.util.ResourceBundle) Bundle(org.osgi.framework.Bundle) ResourceBundle(java.util.ResourceBundle)

Aggregations

IWorkbenchPropertyPage (org.eclipse.ui.IWorkbenchPropertyPage)6 ResourceBundle (java.util.ResourceBundle)2 IDialogPage (org.eclipse.jface.dialogs.IDialogPage)2 WizardPrefPage (org.jkiss.dbeaver.ui.preferences.WizardPrefPage)2 Bundle (org.osgi.framework.Bundle)2