# JUDE API User Guide

## [Add, Update and Delete Reference Project]

Reference project function of JUDE API is not available in JUDE/Community.

#### Add reference project

Reference projects can be added as follows:

1. Open a project file.
2. Add reference projects.
3. Save as a JUDE project file.

    import com.change_vision.jude.api.inf.project.ProjectAccessor;
    import com.change_vision.jude.api.inf.project.ProjectAccessorFactory;

    public class Test {
      public static void main(String[] args) {
        try {
            ProjectAccessor prjAccessor = ProjectAccessorFactory.getProjectAccessor();

            prjAccessor.open("C:\\API\\pro305.jude");
            prjAccessor.addReferenceProject("C:\\API\\pro305_ref.jude");

            prjAccessor.saveAs("C:\\API\\pro305_2.jude");

            prjAccessor.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
      }
    }

#### Update reference project

Reference projects can be updated as follows:

1. Open a project file.
2. Update reference project.
3. Save as a JUDE project file.

    import com.change_vision.jude.api.inf.project.ProjectAccessor;
    import com.change_vision.jude.api.inf.project.ProjectAccessorFactory;

    public class Test {
      public static void main(String[] args) {
        try {
            ProjectAccessor prjAccessor = ProjectAccessorFactory.getProjectAccessor();

            prjAccessor.open("C:\\API\\pro305.jude");

            String path = "C:\\API\\pro305_ref.jude";
            int status = prjAccessor.getReferenceProjectStatus(path);
            if (status == ProjectAccessor.REFERENCE_PROJECT_STATUS_NEED_UPDATE) {
                prjAccessor.updateReferenceProject(path);
            }
            prjAccessor.saveAs("C:\\API\\pro305_2.jude");

            prjAccessor.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
      }
    }

#### Delete reference project

Reference projects can be deleted as follows:

1. Open a project file.
2. Delete reference projects.
3. Save as a JUDE project file.

    import com.change_vision.jude.api.inf.project.ProjectAccessor;
    import com.change_vision.jude.api.inf.project.ProjectAccessorFactory;

    public class Test {
      public static void main(String[] args) {
        try {
            ProjectAccessor prjAccessor = ProjectAccessorFactory.getProjectAccessor();

            prjAccessor.open("C:\\API\\pro305.jude");
            prjAccessor.removeReferenceProject("C:\\API\\pro305_ref.jude");

            prjAccessor.saveAs("C:\\API\\pro305_2.jude");

            prjAccessor.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
      }
    }

#### Clear reference project

Reference projects can be cleared as follows:

1. Open a project file.
2. Clear reference projects.
3. Save as a JUDE Project file.

    import com.change_vision.jude.api.inf.project.ProjectAccessor;
    import com.change_vision.jude.api.inf.project.ProjectAccessorFactory;

    public class Test {
      public static void main(String[] args) {
        try {
            ProjectAccessor prjAccessor = ProjectAccessorFactory.getProjectAccessor();

            prjAccessor.open("C:\\API\\pro305.jude");
            prjAccessor.clearReferenceProject("C:\\API\\pro305_ref.jude");

            prjAccessor.saveAs("C:\\API\\pro305_2.jude");

            prjAccessor.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
      }
    }

#### Change path of reference project

Path of reference projects can be changed as follows:

1. Open a project file.
2. Change a path of reference projects.
3. Save as a JUDE project file.

    import com.change_vision.jude.api.inf.project.ProjectAccessor;
    import com.change_vision.jude.api.inf.project.ProjectAccessorFactory;

    public class Test {
      public static void main(String[] args) {
        try {
            ProjectAccessor prjAccessor = ProjectAccessorFactory.getProjectAccessor();

            prjAccessor.open("C:\\API\\pro305.jude");
            prjAccessor.changeReferenceProject("C:\\API\\pro305_ref.jude","C:\\API2\\pro305_ref.jude");

            prjAccessor.saveAs("C:\\API\\pro305_2.jude");

            prjAccessor.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
      }
    }

Home