Files
Mozilla/mozilla/l10n/tools/mozxlator/fetch/FetchKeybinding.java
tao%netscape.com c72110c027 mt415 from henrik
git-svn-id: svn://10.0.0.236/trunk@79503 18797224-902f-48f8-a5cc-f745e15eee43
2000-09-19 03:04:18 +00:00

97 lines
2.2 KiB
Java

/*
* FetchKaybinding.java
*
* Created on 19. august 2000, 21:07
*/
package org.mozilla.translator.fetch;
import org.mozilla.translator.datamodel.*;
/**
*
* @author Henrik Lynggaard
* @version
*/
public class FetchKeybinding implements Fetcher {
private String localeName;
/** Creates new FetchKaybinding */
public FetchKeybinding(String ln)
{
localeName =ln;
}
public boolean check(Phrase ph)
{
boolean result;
Phrase commandPhrase,accessPhrase;
Translation currentTranslation,commandTranslation,accessTranslation;
String text,key;
result = false;
// find the correct text
currentTranslation = (Translation) ph.getChildByName(localeName);
if (currentTranslation==null)
{
text = ph.getText();
}
else
{
text = currentTranslation.getText();
}
// check for command
commandPhrase = ph.getCommandConnection();
if (commandPhrase!=null)
{
commandTranslation = (Translation) commandPhrase.getChildByName(localeName);
if (commandTranslation ==null)
{
key = commandPhrase.getText();
}
else
{
key = commandTranslation.getText();
}
text = text.toLowerCase();
key = key.toLowerCase();
if (text.indexOf(key)==-1)
{
result=true;
}
}
// check for access
accessPhrase = ph.getAccessConnection();
if (accessPhrase!=null)
{
accessTranslation = (Translation) accessPhrase.getChildByName(localeName);
if (accessTranslation ==null)
{
key = accessPhrase.getText();
}
else
{
key = accessTranslation.getText();
}
text = text.toLowerCase();
key = key.toLowerCase();
if (text.indexOf(key)==-1)
{
result=true;
}
}
return result;
}
}