Search in sources :

Example 1 with ComponentExternalModulesDialog

use of org.talend.librariesmanager.ui.dialogs.ComponentExternalModulesDialog in project tdi-studio-se by Talend.

the class ModulesInstallerUtil method forceInstallModules.

public static void forceInstallModules(Shell shell, IComponent component, List<ModuleNeeded> modules) {
    //$NON-NLS-1$
    String text = Messages.getString("ModulesInstaller_text1", component.getName());
    //$NON-NLS-1$
    String title = Messages.getString("ModulesInstaller_title1") + component.getName();
    String name = component.getName();
    if (name == null) {
        return;
    }
    boolean opened = false;
    if (!modules.isEmpty()) {
        // added by dlin fix bug https://jira.talendforge.org/browse/TDI-27679
        Shell[] shells = PlatformUI.getWorkbench().getDisplay().getShells();
        for (Shell shell2 : shells) {
            Object currentDialog = shell2.getData();
            if (currentDialog instanceof ComponentExternalModulesDialog) {
                String componentName = ((ComponentExternalModulesDialog) currentDialog).getCoponentName();
                if (componentName == null) {
                    return;
                }
                if (name.equalsIgnoreCase(componentName)) {
                    // one downloading dialog for one kind of component is enough only need to resopen instead of
                    // create a new one
                    opened = true;
                    // setMaximized is mandatory .or after you minmizing the dialog .only setSize cann't bring the
                    // dialog foreground .
                    shell2.setMaximized(true);
                    shell2.setSize(1050, 400);
                    break;
                }
            }
        }
        if (!opened) {
            ComponentExternalModulesDialog dialog = new ComponentExternalModulesDialog(shell, text, title);
            dialog.showDialog(true, modules);
        }
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ComponentExternalModulesDialog(org.talend.librariesmanager.ui.dialogs.ComponentExternalModulesDialog)

Example 2 with ComponentExternalModulesDialog

use of org.talend.librariesmanager.ui.dialogs.ComponentExternalModulesDialog in project tdi-studio-se by Talend.

the class ModulesInstallerUtil method installModules.

public static void installModules(Shell shell, List<IComponent> components) {
    if (!LibManagerUiPlugin.getDefault().getPreferenceStore().getBoolean(ExternalModulesInstallDialog.DO_NOT_SHOW_EXTERNALMODULESINSTALLDIALOG)) {
        //$NON-NLS-1$
        String text = Messages.getString("ModulesInstaller_text2");
        //$NON-NLS-1$
        String title = Messages.getString("ModulesInstaller_title2");
        List<ModuleNeeded> needed = new ArrayList<ModuleNeeded>();
        for (IComponent component : components) {
            needed.addAll(component.getModulesNeeded());
        }
        if (!needed.isEmpty()) {
            ComponentExternalModulesDialog dialog = new ComponentExternalModulesDialog(shell, text, title);
            dialog.showDialog(true, needed);
        }
    }
}
Also used : ComponentExternalModulesDialog(org.talend.librariesmanager.ui.dialogs.ComponentExternalModulesDialog) IComponent(org.talend.core.model.components.IComponent) ArrayList(java.util.ArrayList) ModuleNeeded(org.talend.core.model.general.ModuleNeeded)

Aggregations

ComponentExternalModulesDialog (org.talend.librariesmanager.ui.dialogs.ComponentExternalModulesDialog)2 ArrayList (java.util.ArrayList)1 Shell (org.eclipse.swt.widgets.Shell)1 IComponent (org.talend.core.model.components.IComponent)1 ModuleNeeded (org.talend.core.model.general.ModuleNeeded)1