Examples of DesignerException


Examples of org.eclipse.wb.internal.core.utils.exception.DesignerException

      ClassLoader classLoader = state.getClassLoader();
      // version
      {
        String description = getWrongVersionDescription(classLoader);
        if (description != null) {
          throw new DesignerException(IExceptionConstants.INCORRECT_VERSION,
              VALID_VERSIONS_STRING,
              description);
        }
      }
    }
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.exception.DesignerException

    String templatePathString = templatePath.toPortableString();
    // package
    IPackageFragment uiPackage;
    {
      if (!(m_file.getParent() instanceof IFolder)) {
        throw new DesignerException(IExceptionConstants.NO_FORM_PACKAGE, templatePathString);
      }
      // prepare package
      IFolder uiFolder = (IFolder) m_file.getParent();
      IJavaElement uiElement = JavaCore.create(uiFolder);
      if (!(uiElement instanceof IPackageFragment)) {
        throw new DesignerException(IExceptionConstants.NO_FORM_PACKAGE, templatePathString);
      }
      uiPackage = (IPackageFragment) uiElement;
      // has client package
      if (!Utils.isModuleSourcePackage(uiPackage)) {
        throw new DesignerException(IExceptionConstants.NOT_CLIENT_PACKAGE, templatePathString);
      }
    }
    // binder resource
    m_binderResourceName = uiPackage.getElementName().replace('.', '/') + "/" + m_file.getName();
    // try current package
    {
      String formName = StringUtils.removeEnd(m_file.getName(), ".ui.xml");
      m_formClassName = uiPackage.getElementName() + "." + formName;
      m_formType = m_javaProject.findType(m_formClassName);
      if (m_formType != null) {
        m_formFile = (IFile) m_formType.getCompilationUnit().getUnderlyingResource();
        prepareBinderClass();
        if (m_binderClassName != null) {
          return;
        }
      }
    }
    // try @UiTemplate
    IType uiTemplateType = m_javaProject.findType("com.google.gwt.uibinder.client.UiTemplate");
    List<IJavaElement> references = CodeUtils.searchReferences(uiTemplateType);
    for (IJavaElement reference : references) {
      if (reference instanceof IAnnotation) {
        IAnnotation annotation = (IAnnotation) reference;
        IMemberValuePair[] valuePairs = annotation.getMemberValuePairs();
        if (valuePairs.length == 1 && valuePairs[0].getValue() instanceof String) {
          String templateName = (String) valuePairs[0].getValue();
          // prepare ICompilationUnit
          ICompilationUnit compilationUnit =
              (ICompilationUnit) annotation.getAncestor(IJavaElement.COMPILATION_UNIT);
          // prepare qualified template name
          templateName = StringUtils.removeEnd(templateName, ".ui.xml");
          if (templateName.contains(".")) {
            templateName = templateName.replace('.', '/');
          } else {
            String packageName = compilationUnit.getPackageDeclarations()[0].getElementName();
            templateName = packageName.replace('.', '/') + "/" + templateName;
          }
          templateName += ".ui.xml";
          // if found, initialize "form" element
          if (m_binderResourceName.equals(templateName)) {
            m_formType = (IType) annotation.getParent().getParent();
            m_formClassName = m_formType.getFullyQualifiedName();
            m_formFile = (IFile) m_formType.getCompilationUnit().getUnderlyingResource();
            prepareBinderClass();
            if (m_binderClassName != null) {
              return;
            }
          }
        }
      }
    }
    // no Java form
    throw new DesignerException(IExceptionConstants.NO_FORM_TYPE, m_binderResourceName);
  }
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.exception.DesignerException

        String objectTypeSignature = superSignature.substring(objectTypeBegin, objectTypeEnd + 1);
        String objectTypeName = CodeUtils.getResolvedTypeName(m_formType, objectTypeSignature);
        if (objectTypeName != null) {
          IType objectType = m_javaProject.findType(objectTypeName);
          if (!CodeUtils.isSuccessorOf(objectType, "com.google.gwt.user.client.ui.Widget")) {
            throw new DesignerException(IExceptionConstants.ONLY_WIDGET_BASED,
                m_formClassName,
                objectTypeName);
          }
        }
      }
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.exception.DesignerException

          "    }",
          "  }",
          "}");
      fail();
    } catch (Throwable e) {
      DesignerException de = DesignerExceptionUtils.getDesignerException(e);
      assertEquals(de.getCode(), IExceptionConstants.NOT_CONFIGURED);
      assertTrue(DesignerExceptionUtils.isWarning(e));
    }
  }
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.exception.DesignerException

          "    }",
          "  }",
          "}");
      fail();
    } catch (Throwable e) {
      DesignerException de = DesignerExceptionUtils.getDesignerException(e);
      assertEquals(de.getCode(), IExceptionConstants.INCORRECT_VERSION);
      assertTrue(DesignerExceptionUtils.isWarning(e));
    }
  }
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.exception.DesignerException

          "    }",
          "  }",
          "}");
      fail();
    } catch (Throwable e) {
      DesignerException de = DesignerExceptionUtils.getDesignerException(e);
      assertEquals(de.getCode(), IExceptionConstants.NO_RESOURCES);
      assertTrue(DesignerExceptionUtils.isWarning(e));
    }
  }
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.exception.DesignerException

  public void test_HostedModeException() throws Exception {
    int code = 123;
    Exception nested = new Exception();
    String[] parameters = new String[]{"a", "b", "c"};
    Throwable e = new HostedModeException(code, nested, parameters);
    DesignerException result = (DesignerException) GwtExceptionRewriter.INSTANCE.rewrite(e);
    assertEquals(code, result.getCode());
    assertSame(nested, result.getCause());
    assertSame(parameters, result.getParameters());
  }
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.exception.DesignerException

   * GWT 2.2 breaks binary compatibility.
   */
  public void test_IncompatibleClassChangeError_JClassType() throws Exception {
    Throwable e =
        new IncompatibleClassChangeError("Found interface com.google.gwt.core.ext.typeinfo.JClassType, but class was expected");
    DesignerException result = (DesignerException) GwtExceptionRewriter.INSTANCE.rewrite(e);
    assertEquals(IExceptionConstants.BINARY_INCOMPAT_GWT22, result.getCode());
  }
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.exception.DesignerException

  public void test_NPE_CompiledClass() throws Exception {
    String key = "wbp.GWT_ExceptionRewriter.simulate.CompiledClass";
    try {
      System.setProperty(key, "true");
      Throwable e = new NullPointerException();
      DesignerException result = (DesignerException) GwtExceptionRewriter.INSTANCE.rewrite(e);
      assertEquals(IExceptionConstants.NPE_IN_COMPILED_CLASS, result.getCode());
    } finally {
      System.clearProperty(key);
    }
  }
View Full Code Here

Examples of org.krysalis.jcharts.designer.exceptions.DesignerException

   ********************************************************************************/
  public float getEdgePadding() throws DesignerException
  {
    if( this.padding.getText().trim().equals( "" ) )
    {
      throw new DesignerException( "Edge Padding can not be NULL." );
    }
   
    return Float.parseFloat( this.padding.getText() );
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.