0

i would like to check a combobox, if the Layer is "LVS" or "PRJ". If one of these is selected, i want to return a Path as a String, but the function always return "null". Can someone help me maybe?

private String getGroovyPath(MyTitleAreaDialog dialog)
{
    String LayerLVS = "lvs/dev/scripts/123/aderf/de/lock/clt/Simplescript.groovy";
    String LayerPRJ = "prj/dev/scripts/123/aderf/de/lock/clt/Simplescript.groovy"";

    if(dialog.getLayer() == "LVS")
    {
        return LayerLVS;
    }
    else if(dialog.getLayer() == "PRJ")
    {
        return LayerPRJ;
    }
    return null;
}
spirit
  • 3,265
  • 2
  • 14
  • 29
MBauer
  • 39
  • 2

1 Answers1

0

in java you should use equals() or equalsIgnoreCase() function to compare two string. try code bellow:

private String getGroovyPath(MyTitleAreaDialog dialog)
{
String LayerLVS =     "lvs/dev/scripts/123/aderf/de/lock/clt/Simplescript.groovy";
String LayerPRJ = "prj/dev/scripts/123/aderf/de/lock/clt/Simplescript.groovy"";

if(dialog.getLayer().equalsIgnoreCase("LVS"))
{
    return LayerLVS;
}
else if(dialog.getLayer().equalsIgnoreCase("PRJ"))
{
    return LayerPRJ;
}
return null;
}
pouyan
  • 3,445
  • 4
  • 26
  • 44