Tuesday, November 30, 2010

Change default layers when comparing code

During the integration of system patches or third-party layers I found it annoying to continually select a certain layer when using the compare tool.  Multiply the time it takes by 400 or more nodes and you get an unhappy developer.
Fixing this problem is very easy.  Just add the following code to the end of the \Classes\SysCompare.initContext() method.


    if (comboBox1.getText(comboBox1.selection()) == comboBox2.getText(comboBox2.selection()) && comboBox2.items() > comboBox2.selection() + 1 )
    {
        comboBox2.selection(comboBox2.selection()+1);

        // 2010.11.30  Change default selectons for code comparison
        if (comboBox1.items() == comboBox2.items() - 1)
        {
            if (comboBox1.items() > 2 && Global::strEndsWith(comboBox2.getText(comboBox2.items() - 1), ' (Washed)')) // english only
            {
                // Compare last two layers (not selecting the washed version)
                comboBox1.selection(comboBox1.items() - 2); // Set first drop down to second-to-last possible option
                comboBox2.selection(comboBox2.items() - 2); // Set second drop down to second-to-last possible option
            }
        }
    }
    // 2010.11.30  Change default selections for code comparison when importing
    else if (comboBox1.items() > 1 && comboBox2.items() == 1 && Global::strEndsWith(comboBox2.getText(1 - 1), ' (xpo)'))
    {
        // Compare last layer to the imported XPO
        comboBox1.selection(comboBox1.items() - 1); // Set first drop down to last possible option
    }

No comments:

Post a Comment