Search in sources :

Example 1 with PageletTab

use of com.centurylink.mdw.plugin.designer.properties.PageletTab in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method getImportAttributeActions.

private List<IAction> getImportAttributeActions(IStructuredSelection selection) {
    List<IAction> importAttributesActions = new ArrayList<>();
    if (selection != null && selection.getFirstElement() instanceof WorkflowElement) {
        // bam
        IAction action = new Action() {

            @Override
            public void run() {
                if (!importAttributesApplies(getSelection()))
                    return;
                view.setFocus();
                actionHandler.importAttributes(WorkAttributeConstant.BAM_ATTR_PREFIX, (WorkflowElement) getSelection().getFirstElement());
            }
        };
        action.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.monitoring");
        action.setText("Monitoring...");
        importAttributesActions.add(action);
        // simulation
        action = new Action() {

            @Override
            public void run() {
                if (!importAttributesApplies(getSelection()))
                    return;
                view.setFocus();
                actionHandler.importAttributes(WorkAttributeConstant.SIMULATION_ATTR_PREFIX, (WorkflowElement) getSelection().getFirstElement());
            }
        };
        action.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.simulation");
        action.setText("Simulation...");
        importAttributesActions.add(action);
        // pagelet-driven attributes
        WorkflowProject project = ((WorkflowElement) selection.getFirstElement()).getProject();
        List<PageletTab> pageletTabs = project.getPageletTabs();
        if (pageletTabs != null) {
            for (PageletTab pageletTab : pageletTabs) {
                final String prefix = pageletTab.getOverrideAttributePrefix();
                action = new Action() {

                    @Override
                    public void run() {
                        if (!importAttributesApplies(getSelection()))
                            return;
                        view.setFocus();
                        actionHandler.importAttributes(prefix, (WorkflowElement) getSelection().getFirstElement());
                    }
                };
                action.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.attributes." + prefix);
                action.setText(pageletTab.getLabel() + "...");
                importAttributesActions.add(action);
            }
        }
    }
    return importAttributesActions;
}
Also used : WebLaunchAction(com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction) IAction(org.eclipse.jface.action.IAction) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) ArrayList(java.util.ArrayList) PageletTab(com.centurylink.mdw.plugin.designer.properties.PageletTab) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 2 with PageletTab

use of com.centurylink.mdw.plugin.designer.properties.PageletTab in project mdw-designer by CenturyLinkCloud.

the class WorkflowProject method findWorkflowAssets.

/**
 * Returns the workflow assets belonging to a package version.
 */
private List<WorkflowAsset> findWorkflowAssets(WorkflowPackage aPackage) {
    List<WorkflowAsset> assets = new ArrayList<>();
    if (!aPackage.isDefaultPackage()) {
        for (RuleSetVO ruleSetVO : getDataAccess().getRuleSets(false)) {
            if (aPackage.getPackageVO().containsRuleSet(ruleSetVO.getId())) {
                WorkflowAsset asset = WorkflowAssetFactory.createAsset(ruleSetVO, aPackage);
                if (asset != null) {
                    asset.addElementChangeListener(this);
                    if (!asset.isArchived())
                        WorkflowAssetFactory.registerAsset(asset);
                    assets.add(asset);
                    if (RuleSetVO.PAGELET.equals(asset.getLanguage()) && // BAM's
                    !BAM_PAGELET.equals(asset.getName())) // special
                    {
                        if (pageletTabs == null)
                            pageletTabs = new ArrayList<>();
                        String name = asset.getName();
                        if (name.indexOf('.') >= 0)
                            name = name.substring(0, name.lastIndexOf('.'));
                        PageletTab pageletTab = new PageletTab(name, designerProxy.loadWorkflowAsset(asset).getContent());
                        // check if already added from a later package
                        // version
                        boolean already = false;
                        for (PageletTab existing : pageletTabs) {
                            if (existing.getId().equals(pageletTab.getId())) {
                                already = true;
                                break;
                            }
                        }
                        if (!already)
                            pageletTabs.add(pageletTab);
                    }
                }
            }
        }
        Collections.sort(assets);
    }
    return assets;
}
Also used : WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) ArrayList(java.util.ArrayList) PageletTab(com.centurylink.mdw.plugin.designer.properties.PageletTab) RuleSetVO(com.centurylink.mdw.model.value.attribute.RuleSetVO)

Example 3 with PageletTab

use of com.centurylink.mdw.plugin.designer.properties.PageletTab in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method getExportAttributeActions.

private List<IAction> getExportAttributeActions(IStructuredSelection selection) {
    List<IAction> exportAttributesActions = new ArrayList<>();
    if (selection != null && selection.getFirstElement() instanceof WorkflowElement) {
        // bam
        IAction action = new Action() {

            @Override
            public void run() {
                if (!exportAttributesApplies(getSelection()))
                    return;
                view.setFocus();
                actionHandler.exportAttributes(WorkAttributeConstant.BAM_ATTR_PREFIX, (WorkflowElement) getSelection().getFirstElement());
            }
        };
        action.setId(MdwMenuManager.MDW_MENU_PREFIX + "export.monitoring");
        action.setText("Monitoring...");
        exportAttributesActions.add(action);
        // simulation
        action = new Action() {

            @Override
            public void run() {
                if (!exportAttributesApplies(getSelection()))
                    return;
                view.setFocus();
                actionHandler.exportAttributes(WorkAttributeConstant.SIMULATION_ATTR_PREFIX, (WorkflowElement) getSelection().getFirstElement());
            }
        };
        action.setId(MdwMenuManager.MDW_MENU_PREFIX + "export.simulation");
        action.setText("Simulation...");
        exportAttributesActions.add(action);
        // pagelet-driven attributes
        WorkflowProject project = ((WorkflowElement) selection.getFirstElement()).getProject();
        List<PageletTab> pageletTabs = project.getPageletTabs();
        if (pageletTabs != null) {
            for (PageletTab pageletTab : pageletTabs) {
                final String prefix = pageletTab.getOverrideAttributePrefix();
                action = new Action() {

                    @Override
                    public void run() {
                        if (!exportAttributesApplies(getSelection()))
                            return;
                        view.setFocus();
                        actionHandler.exportAttributes(prefix, (WorkflowElement) getSelection().getFirstElement());
                    }
                };
                action.setId(MdwMenuManager.MDW_MENU_PREFIX + "export.attributes." + prefix);
                action.setText(pageletTab.getLabel() + "...");
                exportAttributesActions.add(action);
            }
        }
    }
    return exportAttributesActions;
}
Also used : WebLaunchAction(com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction) IAction(org.eclipse.jface.action.IAction) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) ArrayList(java.util.ArrayList) PageletTab(com.centurylink.mdw.plugin.designer.properties.PageletTab) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Aggregations

PageletTab (com.centurylink.mdw.plugin.designer.properties.PageletTab)3 ArrayList (java.util.ArrayList)3 WebLaunchAction (com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction)2 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)2 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)2 Action (org.eclipse.jface.action.Action)2 IAction (org.eclipse.jface.action.IAction)2 IWorkbenchAction (org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)2 RuleSetVO (com.centurylink.mdw.model.value.attribute.RuleSetVO)1 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)1