first, need get the project,then coding like this:
Plan plan = (Plan)PlanHelper.service.getPlan(ObjectReference.newObjectReference(project));
PlanActivity activity = PlanActivity.newPlanActivity(WTContainerRef.newWTContainerRef(project));
activity.setName("name");
activity.setLineNumber(4); //this is important to display the PlanActivity
activity = (PlanActivity)PlanHelper.service.addToPlan(activity, plan);