Search in sources :

Example 1 with CommandStackEventListener

use of org.eclipse.gef.commands.CommandStackEventListener in project tdi-studio-se by Talend.

the class DynamicTabbedPropertySection method registerListenerForRefreshingSection.

/**
     * amaumont Comment method "registerListenerForRefreshingSection".
     */
public void registerListenerForRefreshingSection() {
    if (commandStackEventListener == null) {
        DynamicTabbedPropertySection.commandStackEventListener = new CommandStackEventListener() {

            @Override
            public void stackChanged(CommandStackEvent event) {
                int detail = event.getDetail();
                if (lastPropertyUsed != null) {
                    if ((lastPropertyUsed.getElement() instanceof org.talend.designer.core.ui.editor.connections.Connection) && (event.getCommand() instanceof ChangeMetadataCommand) && (//
                    0 != (detail & CommandStack.POST_EXECUTE) || 0 != (detail & CommandStack.POST_REDO) || 0 != (detail & CommandStack.POST_REDO))) {
                        lastPropertyUsed.addComponents(true);
                        lastPropertyUsed.refresh();
                    }
                    if (0 != (detail & CommandStack.POST_UNDO) || 0 != (detail & CommandStack.POST_REDO)) {
                        if (event.getCommand() instanceof IExtendedTableCommand) {
                            lastPropertyUsed.refresh();
                        }
                    }
                }
            }
        };
        getCommandStack().addCommandStackEventListener(DynamicTabbedPropertySection.commandStackEventListener);
    }
}
Also used : IExtendedTableCommand(org.talend.commons.ui.swt.advanced.dataeditor.commands.IExtendedTableCommand) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) SalesforceSchemaConnection(org.talend.core.model.metadata.builder.connection.SalesforceSchemaConnection) GenericSchemaConnection(org.talend.core.model.metadata.builder.connection.GenericSchemaConnection) PositionalFileConnection(org.talend.core.model.metadata.builder.connection.PositionalFileConnection) RegexpFileConnection(org.talend.core.model.metadata.builder.connection.RegexpFileConnection) IConnection(org.talend.core.model.process.IConnection) DelimitedFileConnection(org.talend.core.model.metadata.builder.connection.DelimitedFileConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) HeaderFooterConnection(org.talend.core.model.metadata.builder.connection.HeaderFooterConnection) XmlFileConnection(org.talend.core.model.metadata.builder.connection.XmlFileConnection) QueriesConnection(org.talend.core.model.metadata.builder.connection.QueriesConnection) LDAPSchemaConnection(org.talend.core.model.metadata.builder.connection.LDAPSchemaConnection) FileExcelConnection(org.talend.core.model.metadata.builder.connection.FileExcelConnection) ChangeMetadataCommand(org.talend.designer.core.ui.editor.cmd.ChangeMetadataCommand) CommandStackEventListener(org.eclipse.gef.commands.CommandStackEventListener) CommandStackEvent(org.eclipse.gef.commands.CommandStackEvent)

Example 2 with CommandStackEventListener

use of org.eclipse.gef.commands.CommandStackEventListener in project tdi-studio-se by Talend.

the class ProjectSettingMultipleThreadDynamicComposite method getCommandStack.

@Override
public CommandStack getCommandStack() {
    if (cs == null) {
        // fixed bug 12476
        cs = new CommandStack();
        cs.addCommandStackEventListener(new CommandStackEventListener() {

            public void stackChanged(CommandStackEvent event) {
                if (event.getDetail() == CommandStack.POST_EXECUTE) {
                    isCommandExcute = true;
                    // when show connection param ,update it if needed
                    updateConnectionFromRepository();
                }
            }
        });
    }
    return cs;
}
Also used : CommandStack(org.eclipse.gef.commands.CommandStack) CommandStackEventListener(org.eclipse.gef.commands.CommandStackEventListener) CommandStackEvent(org.eclipse.gef.commands.CommandStackEvent)

Aggregations

CommandStackEvent (org.eclipse.gef.commands.CommandStackEvent)2 CommandStackEventListener (org.eclipse.gef.commands.CommandStackEventListener)2 CommandStack (org.eclipse.gef.commands.CommandStack)1 IExtendedTableCommand (org.talend.commons.ui.swt.advanced.dataeditor.commands.IExtendedTableCommand)1 Connection (org.talend.core.model.metadata.builder.connection.Connection)1 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)1 DelimitedFileConnection (org.talend.core.model.metadata.builder.connection.DelimitedFileConnection)1 FileExcelConnection (org.talend.core.model.metadata.builder.connection.FileExcelConnection)1 GenericSchemaConnection (org.talend.core.model.metadata.builder.connection.GenericSchemaConnection)1 HeaderFooterConnection (org.talend.core.model.metadata.builder.connection.HeaderFooterConnection)1 LDAPSchemaConnection (org.talend.core.model.metadata.builder.connection.LDAPSchemaConnection)1 PositionalFileConnection (org.talend.core.model.metadata.builder.connection.PositionalFileConnection)1 QueriesConnection (org.talend.core.model.metadata.builder.connection.QueriesConnection)1 RegexpFileConnection (org.talend.core.model.metadata.builder.connection.RegexpFileConnection)1 SalesforceSchemaConnection (org.talend.core.model.metadata.builder.connection.SalesforceSchemaConnection)1 XmlFileConnection (org.talend.core.model.metadata.builder.connection.XmlFileConnection)1 IConnection (org.talend.core.model.process.IConnection)1 ChangeMetadataCommand (org.talend.designer.core.ui.editor.cmd.ChangeMetadataCommand)1