Search in sources :

Example 1 with DynamicModuleGroupData

use of org.talend.repository.hadoopcluster.ui.dynamic.DynamicModuleGroupData in project tbd-studio-se by Talend.

the class ModuleGroupDetailsForm method onAddBtnSelected.

protected void onAddBtnSelected() {
    DynamicModuleGroupData moduleGroupData = getModuleGroupData();
    String groupTemplateId = moduleGroupData.getGroupTemplateId();
    DynamicPluginAdapter pluginAdapter = moduleGroupData.getPluginAdapter();
    IDynamicConfiguration moduleGroup = pluginAdapter.getModuleGroupByTemplateId(groupTemplateId);
    // IDynamicPluginConfiguration pluginConfiguration = pluginAdapter.getPluginConfiguration();
    // String id = pluginConfiguration.getId();
    // String moduleName = "Not set"; //$NON-NLS-1$
    // String runtimeId = DynamicDistributionUtils.getPluginKey("USER", "GENERATED", id, moduleName); //$NON-NLS-1$
    // //$NON-NLS-2$
    // $NON-NLS-1$
    String runtimeId = "";
    IDynamicConfiguration dynamicLibrary = DynamicModuleGroupAdapter.createDynamicLibrary(runtimeId);
    List<IDynamicConfiguration> childConfigurations = moduleGroup.getChildConfigurations();
    childConfigurations.add(dynamicLibrary);
    groupDetailsViewer.refresh();
}
Also used : IDynamicConfiguration(org.talend.core.runtime.dynamic.IDynamicConfiguration) DynamicPluginAdapter(org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter) DynamicModuleGroupData(org.talend.repository.hadoopcluster.ui.dynamic.DynamicModuleGroupData)

Example 2 with DynamicModuleGroupData

use of org.talend.repository.hadoopcluster.ui.dynamic.DynamicModuleGroupData in project tbd-studio-se by Talend.

the class ModuleGroupDetailsForm method getMavenUri.

protected String getMavenUri(Object element) {
    if (element instanceof IDynamicConfiguration) {
        try {
            String id = (String) ((IDynamicConfiguration) element).getAttribute(DynamicModuleGroupAdapter.ATTR_LIBRARY_ID);
            DynamicModuleGroupData moduleGroupData = getModuleGroupData();
            DynamicPluginAdapter pluginAdapter = moduleGroupData.getPluginAdapter();
            IDynamicConfiguration moduleById = pluginAdapter.getModuleById(id);
            String mvnUri = null;
            if (moduleById == null) {
                // should be an existing module in studio, or a bad one
                ModuleNeeded moduleNeeded = HadoopDistributionPlugin.getInstance().getExistingModuleMap().get(id);
                if (moduleNeeded != null) {
                    mvnUri = moduleNeeded.getMavenUri();
                } else {
                    mvnUri = id;
                }
            } else {
                mvnUri = (String) moduleById.getAttribute(DynamicModuleAdapter.ATTR_MVN_URI);
            }
            return mvnUri;
        } catch (Exception e) {
            ExceptionHandler.process(e);
        }
    }
    // $NON-NLS-1$
    return "";
}
Also used : IDynamicConfiguration(org.talend.core.runtime.dynamic.IDynamicConfiguration) DynamicPluginAdapter(org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter) ModuleNeeded(org.talend.core.model.general.ModuleNeeded) DynamicModuleGroupData(org.talend.repository.hadoopcluster.ui.dynamic.DynamicModuleGroupData)

Example 3 with DynamicModuleGroupData

use of org.talend.repository.hadoopcluster.ui.dynamic.DynamicModuleGroupData in project tbd-studio-se by Talend.

the class ModuleGroupDetailsForm method initData.

protected void initData() {
    try {
        DynamicModuleGroupData moduleGroupData = getModuleGroupData();
        String groupTemplateId = moduleGroupData.getGroupTemplateId();
        groupTemplateIdLabel.setText(// $NON-NLS-1$
        Messages.getString("ModuleGroupDetailsForm.groupDetails.label.groupTemplateId", groupTemplateId));
        DynamicPluginAdapter pluginAdapter = moduleGroupData.getPluginAdapter();
        IDynamicConfiguration moduleGroup = pluginAdapter.getModuleGroupByTemplateId(groupTemplateId);
        List<IDynamicConfiguration> childConfigurations = moduleGroup.getChildConfigurations();
        if (childConfigurations != null) {
            Collections.sort(childConfigurations, new DynamicAttributeComparator());
        }
        groupDetailsViewer.setInput(childConfigurations);
    } catch (Exception e) {
        ExceptionHandler.process(e);
    }
}
Also used : IDynamicConfiguration(org.talend.core.runtime.dynamic.IDynamicConfiguration) DynamicPluginAdapter(org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter) DynamicModuleGroupData(org.talend.repository.hadoopcluster.ui.dynamic.DynamicModuleGroupData) DynamicAttributeComparator(org.talend.hadoop.distribution.dynamic.comparator.DynamicAttributeComparator)

Example 4 with DynamicModuleGroupData

use of org.talend.repository.hadoopcluster.ui.dynamic.DynamicModuleGroupData in project tbd-studio-se by Talend.

the class ModuleGroupDetailsForm method onDeleteBtnSelected.

protected void onDeleteBtnSelected() {
    IStructuredSelection selection = (IStructuredSelection) groupDetailsViewer.getSelection();
    IDynamicConfiguration firstElement = (IDynamicConfiguration) selection.getFirstElement();
    DynamicModuleGroupData moduleGroupData = getModuleGroupData();
    String groupTemplateId = moduleGroupData.getGroupTemplateId();
    DynamicPluginAdapter pluginAdapter = moduleGroupData.getPluginAdapter();
    IDynamicConfiguration moduleGroup = pluginAdapter.getModuleGroupByTemplateId(groupTemplateId);
    List<IDynamicConfiguration> childConfigurations = moduleGroup.getChildConfigurations();
    childConfigurations.remove(firstElement);
    groupDetailsViewer.refresh();
}
Also used : IDynamicConfiguration(org.talend.core.runtime.dynamic.IDynamicConfiguration) DynamicPluginAdapter(org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) DynamicModuleGroupData(org.talend.repository.hadoopcluster.ui.dynamic.DynamicModuleGroupData)

Aggregations

IDynamicConfiguration (org.talend.core.runtime.dynamic.IDynamicConfiguration)4 DynamicPluginAdapter (org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter)4 DynamicModuleGroupData (org.talend.repository.hadoopcluster.ui.dynamic.DynamicModuleGroupData)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 ModuleNeeded (org.talend.core.model.general.ModuleNeeded)1 DynamicAttributeComparator (org.talend.hadoop.distribution.dynamic.comparator.DynamicAttributeComparator)1