public ProgramReceiveTarget(ProgramReceiveIf receiveIf, String name, String targetId) . The receiveIf is you Plugin, the name is the name the user will be see for selection of the target and the targetId is a unique id which is used for identifying the target.getProgramReceiveTargets(). public boolean canReceiveProgramsWithTarget() {
return true;
}
public boolean receivePrograms(Program[] programArr, ProgramReceiveTarget receiveTarget) {
ProgramReceiveTarget[] targets = getSupportedTargets();
if(targets[0].equals(receiveTarget)
showProgramsInDialog(programArr);
else if (targets[1].equals(receiveTarget)
for(Program p : programArr)
p.mark(this);
}
public ProgramReceiveTarget[] getProgramReceiveTargets() {
return getSupportedTargets();
}getSupportedTargets() looks like this:private ProgramReceiveTarget[] getSupportedTargets() {
ProgramReceiveTarget target1 = new ProgramReceiveTarget(this,"Show programs in dialog","showDialog");
ProgramReceiveTarget target2 = new ProgramReceiveTarget(this,"Mark programs for MyPlugin","markPrograms");
return new ProgramReceiveTarget[] {target1,target2};
} | |
| |
| |