Search in sources :

Example 1 with ImportTreeFromRepository

use of org.talend.designer.xmlmap.editor.actions.ImportTreeFromRepository in project tdi-studio-se by Talend.

the class XmlMapEditor method createActions.

/**
     * @see org.eclipse.gef.ui.parts.GraphicalEditor#createActions()
     */
@Override
protected void createActions() {
    ImportTreeFromXml importAction = new ImportTreeFromXml(this, getGraphicalViewer().getControl().getShell());
    importAction.setMapperManager(getMapperManager());
    getActionRegistry().registerAction(importAction);
    getSelectionActions().add(importAction.getId());
    CreateAttributeAction createAttribute = new CreateAttributeAction(this, getGraphicalViewer());
    createAttribute.setMapperManager(getMapperManager());
    getActionRegistry().registerAction(createAttribute);
    getSelectionActions().add(createAttribute.getId());
    CreateElementAction createElement = new CreateElementAction(this, getGraphicalViewer());
    createElement.setMapperManager(getMapperManager());
    getActionRegistry().registerAction(createElement);
    getSelectionActions().add(createElement.getId());
    DeleteTreeNodeAction deleteAction = new DeleteTreeNodeAction(this);
    deleteAction.setMapperManager(getMapperManager());
    getActionRegistry().registerAction(deleteAction);
    getSelectionActions().add(deleteAction.getId());
    SetLoopAction loopAction = new SetLoopAction(this);
    loopAction.setMapperManager(getMapperManager());
    getActionRegistry().registerAction(loopAction);
    getSelectionActions().add(loopAction.getId());
    IAction groupAction = new SetGroupAction(this);
    getActionRegistry().registerAction(groupAction);
    getSelectionActions().add(groupAction.getId());
    ImportTreeFromRepository importFromRepository = new ImportTreeFromRepository(this, getGraphicalViewer().getControl().getShell());
    importFromRepository.setMapperManager(getMapperManager());
    getActionRegistry().registerAction(importFromRepository);
    getSelectionActions().add(importFromRepository.getId());
    CreateNameSpaceAction createNameSpaceInput = new CreateNameSpaceAction(this, getGraphicalViewer());
    createNameSpaceInput.setMapperManager(getMapperManager());
    getActionRegistry().registerAction(createNameSpaceInput);
    getSelectionActions().add(createNameSpaceInput.getId());
    FixValueAction fixValueAction = new FixValueAction(this);
    getActionRegistry().registerAction(fixValueAction);
    getSelectionActions().add(fixValueAction.getId());
    fixValueAction.setMapperManager(getMapperManager());
    SetAggregateAction aggreagteAction = new SetAggregateAction(this);
    aggreagteAction.setMapperManager(getMapperManager());
    getActionRegistry().registerAction(aggreagteAction);
    getSelectionActions().add(aggreagteAction.getId());
    RenameTreeNodeAction renameTreeNodeAction = new RenameTreeNodeAction(this);
    renameTreeNodeAction.setMapperManager(getMapperManager());
    getActionRegistry().registerAction(renameTreeNodeAction);
    getSelectionActions().add(renameTreeNodeAction.getId());
    AddChoiceAction createChoice = new AddChoiceAction(this, getGraphicalViewer());
    createChoice.setMapperManager(getMapperManager());
    getActionRegistry().registerAction(createChoice);
    getSelectionActions().add(createChoice.getId());
    SetSubstitutionAction setSubs = new SetSubstitutionAction(this, getGraphicalViewer());
    setSubs.setMapperManager(getMapperManager());
    getActionRegistry().registerAction(setSubs);
    getSelectionActions().add(setSubs.getId());
    SetLoopOptional setOptional = new SetLoopOptional(this);
    getActionRegistry().registerAction(setOptional);
    getSelectionActions().add(setOptional.getId());
}
Also used : SetLoopAction(org.talend.designer.xmlmap.editor.actions.SetLoopAction) CreateNameSpaceAction(org.talend.designer.xmlmap.editor.actions.CreateNameSpaceAction) IAction(org.eclipse.jface.action.IAction) SetAggregateAction(org.talend.designer.xmlmap.editor.actions.SetAggregateAction) ImportTreeFromXml(org.talend.designer.xmlmap.editor.actions.ImportTreeFromXml) CreateAttributeAction(org.talend.designer.xmlmap.editor.actions.CreateAttributeAction) DeleteTreeNodeAction(org.talend.designer.xmlmap.editor.actions.DeleteTreeNodeAction) SetGroupAction(org.talend.designer.xmlmap.editor.actions.SetGroupAction) AddChoiceAction(org.talend.designer.xmlmap.editor.actions.AddChoiceAction) SetSubstitutionAction(org.talend.designer.xmlmap.editor.actions.SetSubstitutionAction) ImportTreeFromRepository(org.talend.designer.xmlmap.editor.actions.ImportTreeFromRepository) FixValueAction(org.talend.designer.xmlmap.editor.actions.FixValueAction) SetLoopOptional(org.talend.designer.xmlmap.editor.actions.SetLoopOptional) RenameTreeNodeAction(org.talend.designer.xmlmap.editor.actions.RenameTreeNodeAction) CreateElementAction(org.talend.designer.xmlmap.editor.actions.CreateElementAction)

Example 2 with ImportTreeFromRepository

use of org.talend.designer.xmlmap.editor.actions.ImportTreeFromRepository in project tdi-studio-se by Talend.

the class XmlMapEditor method buildContextMenu.

@Override
public void buildContextMenu(IMenuManager menu) {
    // context menu should only display in the document tree
    List selectedEditParts = getGraphicalViewer().getSelectedEditParts();
    if (selectedEditParts != null && !selectedEditParts.isEmpty()) {
        List output = new ArrayList();
        List input = new ArrayList();
        for (Object selected : selectedEditParts) {
            if (selected instanceof OutputTreeNodeEditPart) {
                output.add(selected);
            } else if (selected instanceof TreeNodeEditPart) {
                input.add(selected);
            }
        }
        if (!output.isEmpty() && !input.isEmpty()) {
            return;
        }
        boolean isInput = !input.isEmpty();
        ImportTreeFromXml importAction = (ImportTreeFromXml) getActionRegistry().getAction(ImportTreeFromXml.ID);
        importAction.update(selectedEditParts);
        importAction.setInput(isInput);
        if (importAction.isEnabled()) {
            menu.add(importAction);
        }
        CreateElementAction createElement = (CreateElementAction) getActionRegistry().getAction(CreateElementAction.ID);
        createElement.update(selectedEditParts);
        createElement.setInput(isInput);
        if (createElement.isEnabled()) {
            menu.add(createElement);
        }
        CreateAttributeAction createAttribute = (CreateAttributeAction) getActionRegistry().getAction(CreateAttributeAction.ID);
        createAttribute.update(selectedEditParts);
        createAttribute.setInput(isInput);
        if (createAttribute.isEnabled()) {
            menu.add(createAttribute);
        }
        CreateNameSpaceAction createNameSpace = (CreateNameSpaceAction) getActionRegistry().getAction(CreateNameSpaceAction.ID);
        createNameSpace.update(selectedEditParts);
        createNameSpace.setInput(isInput);
        if (createNameSpace.isEnabled()) {
            menu.add(createNameSpace);
        }
        FixValueAction fixValueAction = (FixValueAction) getActionRegistry().getAction(FixValueAction.ID);
        fixValueAction.update(selectedEditParts);
        if (fixValueAction.isEnabled()) {
            menu.add(fixValueAction);
        }
        AddChoiceAction addChoice = (AddChoiceAction) getActionRegistry().getAction(AddChoiceAction.ID);
        addChoice.update(selectedEditParts);
        addChoice.setInput(isInput);
        if (addChoice.isEnabled()) {
            menu.add(addChoice);
        }
        SetSubstitutionAction setSubs = (SetSubstitutionAction) getActionRegistry().getAction(SetSubstitutionAction.ID);
        setSubs.update(selectedEditParts);
        setSubs.setInput(isInput);
        if (setSubs.isEnabled()) {
            menu.add(setSubs);
        }
        SetLoopAction loopAction = (SetLoopAction) getActionRegistry().getAction(SetLoopAction.ID);
        loopAction.update(selectedEditParts);
        loopAction.setInput(isInput);
        if (loopAction.isEnabled()) {
            menu.add(loopAction);
        }
        SetLoopOptional loopOptinalAction = (SetLoopOptional) getActionRegistry().getAction(SetLoopOptional.ID);
        loopOptinalAction.update(selectedEditParts);
        if (loopOptinalAction.isEnabled()) {
            menu.add(loopOptinalAction);
        }
        SetGroupAction grouptAction = (SetGroupAction) getActionRegistry().getAction(SetGroupAction.ID);
        grouptAction.update(selectedEditParts);
        if (grouptAction.isEnabled()) {
            menu.add(grouptAction);
        }
        ImportTreeFromRepository importFromRepository = (ImportTreeFromRepository) getActionRegistry().getAction(ImportTreeFromRepository.ID);
        importFromRepository.update(selectedEditParts);
        importFromRepository.setInput(isInput);
        if (importFromRepository.isEnabled()) {
            menu.add(importFromRepository);
        }
        SetAggregateAction aggreateAction = (SetAggregateAction) getActionRegistry().getAction(SetAggregateAction.ID);
        aggreateAction.update(selectedEditParts);
        if (aggreateAction.isEnabled()) {
            menu.add(aggreateAction);
        }
        RenameTreeNodeAction renameTreeNodeAction = (RenameTreeNodeAction) getActionRegistry().getAction(RenameTreeNodeAction.ID);
        renameTreeNodeAction.update(selectedEditParts);
        if (renameTreeNodeAction.isEnabled()) {
            menu.add(renameTreeNodeAction);
        }
        DeleteTreeNodeAction action = (DeleteTreeNodeAction) getActionRegistry().getAction(DeleteTreeNodeAction.ID);
        action.update(selectedEditParts);
        action.setInput(isInput);
        if (action.isEnabled()) {
            menu.add(action);
        }
    }
}
Also used : CreateNameSpaceAction(org.talend.designer.xmlmap.editor.actions.CreateNameSpaceAction) SetLoopAction(org.talend.designer.xmlmap.editor.actions.SetLoopAction) SetAggregateAction(org.talend.designer.xmlmap.editor.actions.SetAggregateAction) ImportTreeFromXml(org.talend.designer.xmlmap.editor.actions.ImportTreeFromXml) CreateAttributeAction(org.talend.designer.xmlmap.editor.actions.CreateAttributeAction) ArrayList(java.util.ArrayList) DeleteTreeNodeAction(org.talend.designer.xmlmap.editor.actions.DeleteTreeNodeAction) AddChoiceAction(org.talend.designer.xmlmap.editor.actions.AddChoiceAction) SetGroupAction(org.talend.designer.xmlmap.editor.actions.SetGroupAction) TreeNodeEditPart(org.talend.designer.xmlmap.parts.TreeNodeEditPart) OutputTreeNodeEditPart(org.talend.designer.xmlmap.parts.OutputTreeNodeEditPart) SetSubstitutionAction(org.talend.designer.xmlmap.editor.actions.SetSubstitutionAction) FixValueAction(org.talend.designer.xmlmap.editor.actions.FixValueAction) SetLoopOptional(org.talend.designer.xmlmap.editor.actions.SetLoopOptional) ImportTreeFromRepository(org.talend.designer.xmlmap.editor.actions.ImportTreeFromRepository) RenameTreeNodeAction(org.talend.designer.xmlmap.editor.actions.RenameTreeNodeAction) CreateElementAction(org.talend.designer.xmlmap.editor.actions.CreateElementAction) ArrayList(java.util.ArrayList) List(java.util.List) OutputTreeNodeEditPart(org.talend.designer.xmlmap.parts.OutputTreeNodeEditPart)

Aggregations

AddChoiceAction (org.talend.designer.xmlmap.editor.actions.AddChoiceAction)2 CreateAttributeAction (org.talend.designer.xmlmap.editor.actions.CreateAttributeAction)2 CreateElementAction (org.talend.designer.xmlmap.editor.actions.CreateElementAction)2 CreateNameSpaceAction (org.talend.designer.xmlmap.editor.actions.CreateNameSpaceAction)2 DeleteTreeNodeAction (org.talend.designer.xmlmap.editor.actions.DeleteTreeNodeAction)2 FixValueAction (org.talend.designer.xmlmap.editor.actions.FixValueAction)2 ImportTreeFromRepository (org.talend.designer.xmlmap.editor.actions.ImportTreeFromRepository)2 ImportTreeFromXml (org.talend.designer.xmlmap.editor.actions.ImportTreeFromXml)2 RenameTreeNodeAction (org.talend.designer.xmlmap.editor.actions.RenameTreeNodeAction)2 SetAggregateAction (org.talend.designer.xmlmap.editor.actions.SetAggregateAction)2 SetGroupAction (org.talend.designer.xmlmap.editor.actions.SetGroupAction)2 SetLoopAction (org.talend.designer.xmlmap.editor.actions.SetLoopAction)2 SetLoopOptional (org.talend.designer.xmlmap.editor.actions.SetLoopOptional)2 SetSubstitutionAction (org.talend.designer.xmlmap.editor.actions.SetSubstitutionAction)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 IAction (org.eclipse.jface.action.IAction)1 OutputTreeNodeEditPart (org.talend.designer.xmlmap.parts.OutputTreeNodeEditPart)1 TreeNodeEditPart (org.talend.designer.xmlmap.parts.TreeNodeEditPart)1