Package net.sf.rej.files

Examples of net.sf.rej.files.ClassLocator


  public void gotoMethodDefinition(String className, String methodName,
      Descriptor desc) {
    try {
      ClassIndex ci = SystemFacade.getInstance().getClassIndex();
      ClassLocator cl = ci.getLocator(className);
      if (cl != null && cl.getFileSet().equals(this.openProject.getFileSet())) {
        ClassFile cf = SystemFacade.getInstance().getClassFile(cl);
        List methods = cf.getMethods();
        Method method = null;
        for (int i = 0; i < methods.size(); i++) {
          Method m = (Method) methods.get(i);
          if (m.getName().equals(methodName)
              && m.getDescriptor().equals(desc)) {
            method = m;
            break;
          }
        }

        if (method != null) {
          Link link = new Link();
              link.setText("Method definition : " + className + "." + methodName);
              link.setAnchor(Link.ANCHOR_METHOD_DEF);
              link.setProject(this.openProject);
              link.setFile(cl.getFile());
              link.setTab(Tab.EDITOR);
              link.setMethod(method);

          SystemFacade.getInstance().goTo(link);
        }
View Full Code Here


  public void gotoFieldDefinition(String className, String fieldName,
      Descriptor desc) {
    try {
      ClassIndex ci = SystemFacade.getInstance().getClassIndex();
      ClassLocator cl = ci.getLocator(className);
      if (cl != null && cl.getFileSet().equals(this.openProject.getFileSet())) {
        ClassFile cf = SystemFacade.getInstance().getClassFile(cl);
        List fields = cf.getFields();
        Field field = null;
        for (int i = 0; i < fields.size(); i++) {
          Field f = (Field) fields.get(i);
          if (f.getName().equals(fieldName)
              && f.getDescriptor().equals(desc)) {
            field = f;
            break;
          }
        }

        if (field != null) {
          Link link = new Link();
          link.setText("Field definition : " + className + "." + fieldName);
          link.setAnchor(Link.ANCHOR_FIELD_DEF);
          link.setProject(this.openProject);
          link.setFile(cl.getFile());
          link.setTab(Tab.EDITOR);
          link.setField(field);
          SystemFacade.getInstance().goTo(link);
        }
      }
View Full Code Here

  }

  public void gotoClassDefinition(String className) {
    try {
      ClassIndex ci = SystemFacade.getInstance().getClassIndex();
      ClassLocator cl = ci.getLocator(className);

      if (cl != null && cl.getFileSet().equals(this.openProject.getFileSet())) {
        ClassFile cf = SystemFacade.getInstance().getClassFile(cl);
        Link link = new Link();
        link.setText("Class definition : " + cf.getFullClassName());
        link.setAnchor(Link.ANCHOR_CLASS_DEF);
        link.setProject(this.openProject);
        link.setFile(cl.getFile());
        link.setTab(Tab.EDITOR);
        SystemFacade.getInstance().goTo(link);
      } else {
        SystemFacade.getInstance().setStatus("No class definition found in project for class " + className);
      }
View Full Code Here

      addButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
                ClassIndex cpIndex = SystemFacade.getInstance().getClassIndex();
                ClassChooseDialog ccd = new ClassChooseDialog(MainWindow.getInstance(), cpIndex);
                ccd.invoke();
                ClassLocator cl = ccd.getSelected();
                if (cl != null) {
                    ClassEditor.this.interfaceModel.addElement(cl.getFullName());
                    ClassEditor.this.interfaceList.setSelectedValue(cl.getFullName(), true);
                }
        }
      });
    }
    return addButton;
View Full Code Here

      addButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
                ClassIndex cpIndex = SystemFacade.getInstance().getClassIndex();
                ClassChooseDialog ccd = new ClassChooseDialog(ExceptionChooseDialog.this, cpIndex);
                ccd.invoke();
                ClassLocator cl = ccd.getSelected();
                if (cl != null) {
            ExceptionChooseDialog.this.model.addElement(cl.getFullName());
                }
        }
      });
    }
    return addButton;
View Full Code Here

          if (obj != null) {
            int index = ExceptionChooseDialog.this.paramList.getSelectedIndex();
                  ClassIndex cpIndex = SystemFacade.getInstance().getClassIndex();
                  ClassChooseDialog ccd = new ClassChooseDialog(ExceptionChooseDialog.this, cpIndex);
                  ccd.invoke();
                  ClassLocator cl = ccd.getSelected();
                  if (cl != null) {
              ExceptionChooseDialog.this.model.remove(index);
              ExceptionChooseDialog.this.model.add(index, cl.getFullName());
                  }
            ExceptionChooseDialog.this.paramList.setSelectedIndex(index);
          }
        }
      });
View Full Code Here

      typeChooserButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
                ClassIndex cpIndex = SystemFacade.getInstance().getClassIndex();
                ClassChooseDialog ccd = new ClassChooseDialog(TypeChooseDialog.this, cpIndex);
                ccd.invoke();
                ClassLocator cl = ccd.getSelected();
                if (cl != null) {
                    TypeChooseDialog.this.typeModel.addElement(cl);
                    TypeChooseDialog.this.typeCombo.setSelectedItem(cl);
                }
        }
View Full Code Here

    Object item = this.typeCombo.getSelectedItem();
    String name = null;
    if (item instanceof String ) {
      name = (String)item;
    } else {
      ClassLocator cl = (ClassLocator)item;
      name = cl.getFullName();
    }

    int dimensions = 0;
    String arrayString = (String)this.arrayCombo.getSelectedItem();
    if ("None".equals(arrayString)) {
View Full Code Here

    int value = 0;
    // TODO: calls to addClassRef cannot be done outside of undo
    if (o instanceof String) {
      return o;
    } else if (o instanceof ClassLocator) {
      ClassLocator cl = (ClassLocator) o;
      return cl.getFullName();
    } else {
      ClassInfo ci = (ClassInfo) ((Wrapper) o).getContent();
      value = this.cp.optionalAdd(ci);
    }
View Full Code Here

        try {
            ClassFile cf = null;
            if (obj instanceof String) {
                // TODO: let user type his own class name?
            } else if (obj instanceof ClassLocator) {
                ClassLocator cl = (ClassLocator) obj;
                cf = SystemFacade.getInstance().getClassFile(cl);
            }

            // cf will be null if referenced class is not in project classpath
            if (cf != null) {
View Full Code Here

TOP

Related Classes of net.sf.rej.files.ClassLocator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.