Search in sources :

Example 1 with ExportProjectSettings

use of org.talend.repository.ui.actions.ExportProjectSettings in project tdi-studio-se by Talend.

the class ProjectSettingsPreferenceDialog method importPressed.

private void importPressed() {
    FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN);
    //$NON-NLS-1$
    String[] files = new String[] { "*.xml" };
    fileDialog.setFilterExtensions(files);
    String path = fileDialog.open();
    ImportProjectSettings settings = new ImportProjectSettings(path);
    boolean error = false;
    ExportProjectSettings original = new ExportProjectSettings(TEMP_PRODUCT_SETTING_XML);
    original.saveProjectSettings();
    try {
        settings.updateProjectSettings();
    } catch (Exception e) {
        error = true;
        showErrorMessage();
    }
    // close the projec settings and open it again to get new settings
    if (!error) {
        close();
        ProjectSettingDialog dialog = new ProjectSettingDialog();
        dialog.open();
    }
}
Also used : ImportProjectSettings(org.talend.repository.ui.actions.ImportProjectSettings) ExportProjectSettings(org.talend.repository.ui.actions.ExportProjectSettings) FileDialog(org.eclipse.swt.widgets.FileDialog) PersistenceException(org.talend.commons.exception.PersistenceException)

Example 2 with ExportProjectSettings

use of org.talend.repository.ui.actions.ExportProjectSettings in project tdi-studio-se by Talend.

the class ProjectSettingsPreferenceDialog method exportPressed.

private void exportPressed() {
    saveCurrentSettings();
    FileDialog fileDialog = new FileDialog(getShell(), SWT.SAVE);
    //$NON-NLS-1$
    fileDialog.setFileName("ProjectSettings.xml");
    //$NON-NLS-1$
    String[] files = new String[] { "*.xml" };
    fileDialog.setFilterExtensions(files);
    String path = fileDialog.open();
    if (path != null) {
        if (!new File(path).exists() || MessageDialog.openConfirm(getShell(), //$NON-NLS-1$
        Messages.getString("ProjectSettingsPreferenceDialog.overwriteTitle"), Messages.getString("ProjectSettingsPreferenceDialog.overwriteMessage"))) {
            //$NON-NLS-1$
            ExportProjectSettings settings = new ExportProjectSettings(path);
            settings.saveProjectSettings();
        }
    }
}
Also used : ExportProjectSettings(org.talend.repository.ui.actions.ExportProjectSettings) FileDialog(org.eclipse.swt.widgets.FileDialog) File(java.io.File)

Aggregations

FileDialog (org.eclipse.swt.widgets.FileDialog)2 ExportProjectSettings (org.talend.repository.ui.actions.ExportProjectSettings)2 File (java.io.File)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 ImportProjectSettings (org.talend.repository.ui.actions.ImportProjectSettings)1