Commit e52ad884 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Working on view menu to start multiple targets for the same tool

parent 02c3694d
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -22,8 +22,7 @@ import java.util.ArrayList;
import java.util.Iterator;

import com.elphel.vdt.core.tools.config.ConfigException;


//TODO: Andrey: Now Parameter has file name
public class Checks {
    public static void checkCyclicInheritance(Inheritable inheritanceChainMember, String entityName)
        throws ConfigException
+58 −17
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ import com.elphel.vdt.core.tools.config.*;
import com.elphel.vdt.core.tools.contexts.*;
import com.elphel.vdt.core.tools.menu.*;
import com.elphel.vdt.ui.MessageUI;
import com.elphel.vdt.veditor.VerilogPlugin;
import com.elphel.vdt.veditor.preference.PreferenceStrings;


public class XMLConfig extends Config {
@@ -98,6 +100,11 @@ public class XMLConfig extends Config {
    static final String CONTEXT_TOOL_SHELL_ATTR = "shell";
    static final String CONTEXT_TOOL_EXTENSIONS_LIST_TAG = "extensions-list";
    static final String CONTEXT_TOOL_EXTENSION_TAG = "extension";
    static final String CONTEXT_TOOL_ACTION_LIST_TAG = "action-menu";
    static final String CONTEXT_TOOL_ACTION_TAG = "action";
    static final String CONTEXT_TOOL_ACTION_LABEL = "label";
    static final String CONTEXT_TOOL_ACTION_RESOURCE = "resource";
    
    static final String CONTEXT_TOOL_EXTENSION_MASK_ATTR = "mask";
    static final String CONTEXT_TOOL_SYNTAX_ERRORS =  "errors";
    static final String CONTEXT_TOOL_SYNTAX_WARNINGS= "warnings";
@@ -374,6 +381,7 @@ public class XMLConfig extends Config {
                                                        SAXException, 
                                                        IOException  
    {
        if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
            System.out.println("Reading file '" + configFile + "'");
        
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
@@ -424,6 +432,7 @@ public class XMLConfig extends Config {
        List<DesignMenu> menuComponents = readDesignMenu(document);

        designMenuManager.addDesignMenuComponents(menuComponents);
        if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
        	System.out.println("Done reading file '" + configFile + "'");

    }
@@ -567,15 +576,19 @@ public class XMLConfig extends Config {
//                if(toolShell == null) toolShell="";
                    
                List<String> toolExtensionsList = readToolExtensionsList(contextNode, contextName);
                List<RunFor> toolRunfor=  readToolRunForList(contextNode, contextName);
                
                
                if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
                	System.out.println("contextNode.getNodeValue()="+contextNode.getNodeValue());
                	System.out.println("toolPackage="+toolPackage);
                	System.out.println("toolProject="+toolProject);
                	System.out.println("toolExe="+toolExe);
                	System.out.println("toolShell="+toolShell);
                
                List<Tool.RunFor> toolRunfor=     readToolRunForList(contextNode, contextName);
                	if (toolRunfor!=null){
                		System.out.println("got toolRunfor.size()="+toolRunfor.size());
                	}
                }
                
                context = new Tool(contextName,
                                   contextInterfaceName, 
@@ -610,9 +623,11 @@ public class XMLConfig extends Config {
        List<CommandLinesBlock> contextCommandLinesBlocks = readCommandLinesBlocks(contextNode, context);  // Correct? for "project_parameters" in /vdt/tools/Verilog/IVerilog.xml
        // Each of contextParams (3 total, correct) has null context. Probably OK, same for the tool context
        ContextInputDefinition contextInputDefinition = readContextInputDefinition(contextNode, context);
        if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
        	if (contextKind==ContextKind.PROJECT){
        		System.out.println("processing project context");
        	}
        }
        context.setParams(contextParams);
        context.setParamGroups(contextInputDefinition.getParamGroups()); // "Project Properties", "General"
        context.setInputDialogLabel(contextInputDefinition.getLabel());
@@ -943,11 +958,37 @@ public class XMLConfig extends Config {
    }
    
    
    private  List<Tool.RunFor> readToolRunForList(Node toolNode, String toolName){
    	if (toolNode.getNodeValue()==null) return null;
    	System.out.println("FIXME: readToolRunForList("+toolNode.getNodeName()  +", "+toolName+")"+
    		    " rootNode="+rootNode.getNodeName()+" filename="+currentConfigFileName);
    private  List<RunFor> readToolRunForList(Node toolNode, String toolName)
        throws ConfigException 
    {
        String toolInfo = "Tool '" + toolName + "'";
        
        List<RunFor> runForList = new ArrayList<RunFor>();
        List<Node> runForNodesList = findChildNodes(toolNode, CONTEXT_TOOL_ACTION_LIST_TAG);
        
        if(runForNodesList.isEmpty())
            return null;
        if(runForNodesList.size() > 1)
            throw new ConfigException(toolInfo + 
                                      " definition cannot contain several '" + 
                                      CONTEXT_OUTPUT_SECTION_TAG + 
                                      "' nodes");
                
        Node runForNode = runForNodesList.get(0);
        List<Node> runForNodes = findChildNodes(runForNode, CONTEXT_TOOL_ACTION_TAG);
        
        for(Iterator<Node> n = runForNodes.iterator(); n.hasNext();) {
        	Node node = (Node)n.next();
        	String label = getAttributeValue(node, CONTEXT_TOOL_ACTION_LABEL);
        	if (label == null)
        		throw new ConfigException(toolInfo + ": Attribute '" + CONTEXT_TOOL_ACTION_LABEL + "' is absent");
        	String resource = getAttributeValue(node, CONTEXT_TOOL_ACTION_RESOURCE);
        	if (resource == null)
        		throw new ConfigException(toolInfo + ": Attribute '" + CONTEXT_TOOL_ACTION_RESOURCE + "' is absent");
        	runForList.add(new RunFor(label, resource));
        }
        
        return runForList;
    }

    private List<Parameter> readParameters(Node node, Context context)
+9 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ public abstract class AbstractGenerator {
    protected final String prefix, suffix;
    protected String separator;
    private final boolean forcedMultiline;
    private boolean menuMode=false; // managing menu items, not running tool

    public AbstractGenerator() {
        this(false);
@@ -60,6 +61,13 @@ public abstract class AbstractGenerator {
        separator = separator.replace("\\n", "\n");
        separator = separator.replace("\\t", "\t");
    }
    public void setMenuMode(boolean menuMode){
    	this.menuMode=menuMode;
    }
    public boolean getMenuMode(){
    	return menuMode;
    }

    
    public abstract String getName();
    
+17 −3
Original line number Diff line number Diff line
@@ -19,19 +19,33 @@ package com.elphel.vdt.core.tools.generators;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.ui.IPageLayout;

import com.elphel.vdt.VDT;
import com.elphel.vdt.ui.variables.SelectedResourceManager;

public class CurrentFileGenerator extends AbstractGenerator {
    private static final String NAME = VDT.GENERATOR_ID_CURRENT_FILE;
//    private boolean menuMode=false; // managing menu items, not running tool

    public String getName() {
        return NAME;
    }
    
 /*   
    public CurrentFileGenerator(boolean menuMode){
    	super();
    	this.menuMode=menuMode;
    }
*/
    /*
    public void setMenuMode(boolean menuMode){
    	this.menuMode=menuMode;
    }
    */
    protected String[] getStringValues() {
        IResource resource = SelectedResourceManager.getDefault().getSelectedResource();
    	IResource resource;
    	if (getMenuMode()) resource = SelectedResourceManager.getDefault().getViewSelectedResource(IPageLayout.ID_RES_NAV);
    	else          resource = SelectedResourceManager.getDefault().getSelectedResource();
        
        if((resource != null) && (resource.getType() == IResource.FILE))
            return new String[] { ((IFile)resource).getLocation().toOSString() };
+1 −5
Original line number Diff line number Diff line
@@ -23,11 +23,7 @@ import com.elphel.vdt.core.tools.Updateable;
import com.elphel.vdt.core.tools.config.ConfigException;

public class EntityUtilsMarkChildren {
// Updating tool context (to) from project context (from), items in to have now null context, in from - ProjectContext
/*
 * Andrey: Seems there should be only one instance of each parameter, no cloning?
 */
		
//Andrey debugging: Updating tool context (to) from project context (from), items in to have now null context, in from - ProjectContext
    public static <T extends Updateable> void update(List<Parameter> from, List<Parameter> to)
        throws ConfigException 
    {
Loading