Search in sources :

Example 6 with EmfComponent

use of org.talend.designer.core.model.components.EmfComponent in project tesb-studio-se by Talend.

the class OpenTalendJobRefAction method calculateEnabled.

/* Check if this action enable. Will ensure the cTalendJob was selected and has legal value.
     * @see org.eclipse.gef.ui.actions.WorkbenchPartAction#calculateEnabled()
     * 
     */
@Override
protected boolean calculateEnabled() {
    List<?> selectedObjects = getSelectedObjects();
    if (selectedObjects.size() != 1) {
        //not select one object.
        return false;
    }
    Object select = selectedObjects.get(0);
    if (!(select instanceof NodePart)) {
        //not select a node.
        return false;
    }
    NodePart nodePart = (NodePart) select;
    Node node = (Node) nodePart.getModel();
    if (!(node.getComponent() instanceof EmfComponent)) {
        //not select a component.
        return false;
    }
    EmfComponent component = (EmfComponent) node.getComponent();
    if (!C_TALEND_JOB_COMPONENT_NAME.equals(component.getName())) {
        //not cTalendJob component.
        return false;
    }
    Boolean isRepositoryJob = (Boolean) node.getElementParameter(NODE_PARAM_FROM_REPOSITORY_JOB).getValue();
    if (isRepositoryJob == null || !isRepositoryJob) {
        //not from repository job.
        return false;
    }
    String selectedJobName = (String) node.getElementParameter(NODE_PARAM_SELECTED_JOB_NAME).getValue();
    if (selectedJobName == null || selectedJobName.equals("")) {
        //no reference job been choice.
        return false;
    }
    return true;
}
Also used : Node(org.talend.designer.core.ui.editor.nodes.Node) EmfComponent(org.talend.designer.core.model.components.EmfComponent) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart)

Aggregations

EmfComponent (org.talend.designer.core.model.components.EmfComponent)6 ArrayList (java.util.ArrayList)3 IComponent (org.talend.core.model.components.IComponent)3 EList (org.eclipse.emf.common.util.EList)2 HL7Connection (org.talend.core.model.metadata.builder.connection.HL7Connection)2 HL7ConnectionItem (org.talend.core.model.properties.HL7ConnectionItem)2 IBrandingService (org.talend.core.ui.branding.IBrandingService)2 File (java.io.File)1 FileFilter (java.io.FileFilter)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 ResourceBundle (java.util.ResourceBundle)1 Pattern (java.util.regex.Pattern)1 Path (org.eclipse.core.runtime.Path)1 Bundle (org.osgi.framework.Bundle)1 BundleContext (org.osgi.framework.BundleContext)1 ServiceReference (org.osgi.framework.ServiceReference)1 PackageAdmin (org.osgi.service.packageadmin.PackageAdmin)1