Search in sources :

Example 6 with ErrorDialogWidthDetailArea

use of org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea in project tdi-studio-se by Talend.

the class FileJSONTableWizard method performFinish.

/**
     * This method determine if the 'Finish' button is enable This method is called when 'Finish' button is pressed in
     * the wizard. We will create an operation and run it using wizard as execution context.
     */
public boolean performFinish() {
    if (tableWizardpage.isPageComplete()) {
        // applyConnectionCopy();
        // update
        RepositoryUpdateManager.updateSingleSchema(connectionItem, metadataTable, oldMetadataTable, oldTableMap);
        IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
        try {
            factory.save(repositoryObject.getProperty().getItem());
            closeLockStrategy();
        } catch (PersistenceException e) {
            String detailError = e.toString();
            new ErrorDialogWidthDetailArea(getShell(), PID, "Access to the data failure ", detailError);
            log.error("Access to the data failure " + "\n" + detailError);
        }
        // metadataTableCopy = null;
        return true;
    } else {
        return false;
    }
}
Also used : PersistenceException(org.talend.commons.exception.PersistenceException) ErrorDialogWidthDetailArea(org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 7 with ErrorDialogWidthDetailArea

use of org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea in project tdi-studio-se by Talend.

the class MetadataImportXmlCommand method execute.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.core.ui.metadata.extended.command.MetadataImportXmlCommand#execute()
     */
@Override
public void execute() {
    try {
        removed = new ArrayList<IMetadataColumn>(extendedTableModel.getBeansList());
        extendedTableModel.removeAll(removed);
        added = MetadataSchema.initializeColumns(file);
        extendedTableModel.addAll(added, true, false);
        if (extendedTableModel.getBeansList() instanceof ListenableList) {
            ListenableList beanList = (ListenableList) extendedTableModel.getBeansList();
            beanList.fireReplacedEvent(0, removed, added, false);
        }
    } catch (Exception e) {
        new ErrorDialogWidthDetailArea(null, XmlMapPlugin.PLUGIN_ID, "Can not import schema from invalid xml", ExceptionUtils.getFullStackTrace(e));
        ExceptionHandler.process(e);
    }
}
Also used : ListenableList(org.talend.commons.utils.data.list.ListenableList) ErrorDialogWidthDetailArea(org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Example 8 with ErrorDialogWidthDetailArea

use of org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea in project tdi-studio-se by Talend.

the class GenericSchemaWizard method performFinish.

/**
     * This method determine if the 'Finish' button is enable This method is called when 'Finish' button is pressed in
     * the wizard. We will create an operation and run it using wizard as execution context.
     */
@Override
public boolean performFinish() {
    if (tableWizardPage.isPageComplete()) {
        IMetadataTable newTable = MetadataToolHelper.convert(metadataTable);
        if (!newTable.sameMetadataAs(oldMetadataTable)) {
            SchemaUtils.updateComponentSchema(metadataTable, connectionItem.getConnection());
        }
        GenericUpdateManager.updateSingleSchema(connectionItem, metadataTable, oldMetadataTable, oldTableMap);
        IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
        try {
            factory.save(connectionItem);
            closeLockStrategy();
        } catch (PersistenceException e) {
            new ErrorDialogWidthDetailArea(getShell(), IGenericConstants.REPOSITORY_PLUGIN_ID, Messages.getString("NoSQLSchemaWizard.persistenceException"), //$NON-NLS-1$
            ExceptionUtils.getFullStackTrace(e));
            ExceptionHandler.process(e);
        }
        return true;
    } else {
        return false;
    }
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) PersistenceException(org.talend.commons.exception.PersistenceException) ErrorDialogWidthDetailArea(org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 9 with ErrorDialogWidthDetailArea

use of org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea in project tdi-studio-se by Talend.

the class UIUtils method checkConnection.

/**
     * Display a error message if the db connection is failed DOC Comment method "checkConnection".
     * 
     * @param parentShell
     * @param imetadataConnection
     */
public static void checkConnection(final Shell parentShell, IMetadataConnection imetadataConnection) {
    // display a error message if the db connection is failed.
    final ManagerConnection managerConnection = new ManagerConnection();
    managerConnection.check(imetadataConnection, true);
    if (!managerConnection.getIsValide()) {
        Display.getDefault().syncExec(new Runnable() {

            @Override
            public void run() {
                new ErrorDialogWidthDetailArea(parentShell, SqlBuilderPlugin.PLUGIN_ID, Messages.getString(//$NON-NLS-1$
                "UIUtils.DBConnectionFailure"), managerConnection.getMessageException());
            }
        });
    }
}
Also used : ManagerConnection(org.talend.metadata.managment.repository.ManagerConnection) ErrorDialogWidthDetailArea(org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea)

Example 10 with ErrorDialogWidthDetailArea

use of org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea in project tdi-studio-se by Talend.

the class LoginAgreementPage method addListeners.

@Override
public void addListeners() {
    acceptButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            try {
                LicenseManagement.acceptLicense();
            } catch (BusinessException e) {
                ErrorDialogWidthDetailArea errorDialog = new ErrorDialogWidthDetailArea(getShell(), RegistrationPlugin.PLUGIN_ID, "", //$NON-NLS-1$
                e.getMessage());
                System.exit(0);
            }
            AbstractActionPage iNextPage = getNextPage();
            if (iNextPage == null) {
                return;
            }
            try {
                gotoNextPage();
            } catch (Throwable e1) {
                CommonExceptionHandler.process(e1);
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // nothing need to do
        }
    });
}
Also used : BusinessException(org.talend.commons.exception.BusinessException) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ErrorDialogWidthDetailArea(org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

ErrorDialogWidthDetailArea (org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea)14 WebserviceStatus (org.talend.designer.components.exchange.util.WebserviceStatus)5 Shell (org.eclipse.swt.widgets.Shell)2 BusinessException (org.talend.commons.exception.BusinessException)2 PersistenceException (org.talend.commons.exception.PersistenceException)2 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)2 IOException (java.io.IOException)1 ResultSet (java.sql.ResultSet)1 ResultSetMetaData (java.sql.ResultSetMetaData)1 ArrayList (java.util.ArrayList)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 Display (org.eclipse.swt.widgets.Display)1 IProgressService (org.eclipse.ui.progress.IProgressService)1 ListenableList (org.talend.commons.utils.data.list.ListenableList)1 ILibrariesService (org.talend.core.model.general.ILibrariesService)1 ELibraryInstallStatus (org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus)1