Search in sources :

Example 1 with MessagesWithActionComposite

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

the class MissingSettingsMultiThreadDynamicComposite method afterCreateMessagesComposite.

@Override
public void afterCreateMessagesComposite(MessagesComposite messComposite) {
    final Element ele = this.getElement();
    if (ele instanceof Node && isVisibleTopMessages()) {
        final IComponent component = ((Node) ele).getComponent();
        messComposite.updateTopMessages(//$NON-NLS-1$
        Messages.getString(//$NON-NLS-1$
        "MissingSettingsMultiThreadDynamicComposite_missingModulesMessages", component.getName()), IStatus.WARNING);
        if (messComposite instanceof MessagesWithActionComposite) {
            MessagesWithActionComposite messWithActionComposite = (MessagesWithActionComposite) messComposite;
            messWithActionComposite.updateActionButton(//$NON-NLS-1$
            Messages.getString("MissingSettingsMultiThreadDynamicComposite.installName") + "...", //$NON-NLS-1$
            null);
            messWithActionComposite.addActionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    if (!missModulesNeeded.isEmpty()) {
                        ModulesInstallerUtil.forceInstallModules(getShell(), component, missModulesNeeded);
                        checkVisibleTopMessages();
                    }
                }
            });
        }
    }
    super.afterCreateMessagesComposite(messComposite);
}
Also used : IComponent(org.talend.core.model.components.IComponent) Element(org.talend.core.model.process.Element) Node(org.talend.designer.core.ui.editor.nodes.Node) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MessagesWithActionComposite(org.talend.commons.ui.swt.composites.MessagesWithActionComposite)

Example 2 with MessagesWithActionComposite

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

the class MissingSettingsMultiThreadDynamicComposite method createMessagesComposite.

@Override
protected MessagesComposite createMessagesComposite() {
    MessagesWithActionComposite messagesComposite = new MessagesWithActionComposite(getComposite(), SWT.NONE) {

        @Override
        protected void changeBackgroundColor(int status) {
            switch(status) {
                case IStatus.WARNING:
                    CoreUIPlugin.setCSSId(this, CSS_MESSAGES_WITH_ACTION_COMPOSITE_WARN);
                    break;
                case IStatus.ERROR:
                    CoreUIPlugin.setCSSId(this, CSS_MESSAGES_WITH_ACTION_COMPOSITE_ERROR);
                    break;
                default:
            }
        }
    };
    // CSS
    CoreUIPlugin.setCSSClass(messagesComposite, MessagesWithActionComposite.class.getSimpleName());
    return messagesComposite;
}
Also used : MessagesWithActionComposite(org.talend.commons.ui.swt.composites.MessagesWithActionComposite)

Aggregations

MessagesWithActionComposite (org.talend.commons.ui.swt.composites.MessagesWithActionComposite)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 IComponent (org.talend.core.model.components.IComponent)1 Element (org.talend.core.model.process.Element)1 Node (org.talend.designer.core.ui.editor.nodes.Node)1