Package org.eclipse.wb.internal.core.utils.exception

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


  ////////////////////////////////////////////////////////////////////////////
  @Override
  public Throwable rewriteException(Throwable e) {
    if (isMailExampleException(e)) {
      String userStackTrace = AstEvaluationEngine.getUserStackTrace(e);
      return new DesignerException(IExceptionConstants.MAIL_SAMPLE_GET, e, userStackTrace);
    }
    return null;
  }
View Full Code Here


    // parse using GWTDocumentHandler
    GwtDocumentHandler documentHandler = new GwtDocumentHandler();
    try {
      QParser.parse(new StringReader(contents), documentHandler);
    } catch (Throwable e) {
      throw new DesignerException(IExceptionConstants.INVALID_MODULE_FILE, id);
    }
    // prepare module element
    ModuleElement moduleElement = documentHandler.getModuleElement();
    moduleElement.setId(id);
    moduleElement.finalizeLoading();
View Full Code Here

        }
      } finally {
        context.disconnect();
      }
    } catch (Throwable e) {
      throw new DesignerException(IExceptionConstants.INVALID_WEB_XML,
          e,
          webFile.getFullPath().toPortableString(),
          webFileContent);
    }
    // try to find resource for "welcome-file"
View Full Code Here

        IType type = root.getEditor().getJavaProject().findType(className);
        if (type != null) {
          return ImageBundleContainerInfo.add(root, className);
        }
        // no such ImageBundle
        throw new DesignerException(IExceptionConstants.NO_SUCH_IMAGE_BUNDLE, className);
      }
    });
  }
View Full Code Here

    Throwable e = prepareThrowable();
    assertThat(e.getClass().getName()).isEqualTo(
        "com.google.gwt.core.ext.UnableToCompleteException");
    // try plain
    {
      DesignerException result = (DesignerException) GwtExceptionRewriter.INSTANCE.rewrite(e);
      assertThat(result.getCode()).isEqualTo(HostedModeException.MODULE_LOADING_ERROR2);
      // at testing time we don't have logger
      assertEquals("<none>", result.getParameters()[0]);
    }
    // try wrapped (1 level)
    {
      Throwable wrapper = new RuntimeException(e);
      DesignerException result = (DesignerException) GwtExceptionRewriter.INSTANCE.rewrite(wrapper);
      assertThat(result.getCode()).isEqualTo(HostedModeException.MODULE_LOADING_ERROR2);
    }
    // try wrapped (2 levels)
    {
      Throwable wrapper_1 = new InvocationTargetException(e);
      Throwable wrapper_2 = new RuntimeException(wrapper_1);
      DesignerException result =
          (DesignerException) GwtExceptionRewriter.INSTANCE.rewrite(wrapper_2);
      assertThat(result.getCode()).isEqualTo(HostedModeException.MODULE_LOADING_ERROR2);
    }
  }
View Full Code Here

      editor.getAstUnit().accept(new ASTVisitor() {
        @Override
        public void endVisit(MethodInvocation node) {
          if (isBindInvocation(node)) {
            String unitName = editor.getModelUnit().getElementName();
            throw new DesignerException(IExceptionConstants.DONT_OPEN_JAVA, unitName);
          }
        }

        private boolean isBindInvocation(MethodInvocation invocation) {
          Expression expression = invocation.getExpression();
View Full Code Here

    // validate GWT version
    {
      IJavaProject javaProject = m_context.getJavaProject();
      // has UiBinder support at all
      if (!hasUiBinderSupport(javaProject)) {
        throw new DesignerException(IExceptionConstants.WRONG_VERSION);
      }
      // has support for @UiField(provided) and @UiFactory
      if (!hasUiFieldUiFactorySupport(javaProject)) {
        String formSource = m_context.getFormType().getSource();
        if (formSource.contains("@UiField(provided")) {
          throw new DesignerException(IExceptionConstants.UI_FIELD_FACTORY_FEATURE);
        }
        if (formSource.contains("@UiFactory")) {
          throw new DesignerException(IExceptionConstants.UI_FIELD_FACTORY_FEATURE);
        }
      }
    }
    // prepare for parsing
    GlobalStateXml.setEditorContext(m_context);
View Full Code Here

      String methodName,
      Object[] args) throws Exception {
    try {
      return createObjectInstance(context, methodName, factoryType, args);
    } catch (Throwable e) {
      throw new DesignerException(IExceptionConstants.UI_FACTORY_EXCEPTION,
          e,
          factoryType.getName(),
          methodName);
    }
  }
View Full Code Here

  static Object createProvidedField(UiBinderContext context, Class<?> fieldType, String fieldName)
      throws Exception {
    try {
      return createObjectInstance(context, fieldName, fieldType, ArrayUtils.EMPTY_OBJECT_ARRAY);
    } catch (Throwable e) {
      throw new DesignerException(IExceptionConstants.UI_FIELD_EXCEPTION,
          e,
          fieldType.getName(),
          fieldName);
    }
  }
View Full Code Here

   * Creates <code>@UiField(provided=true)</code> using default Java creation.
   */
  private void createFieldProvided() throws Exception {
    // may be no support for @UiField
    if (!UiBinderParser.hasUiFieldUiFactorySupport(m_context.getJavaProject())) {
      throw new DesignerException(IExceptionConstants.UI_FIELD_FACTORY_FEATURE);
    }
    // prepare AST
    AstEditor editor = getEditor();
    // configure EditorState
    EditorState.get(editor).initialize(
View Full Code Here

TOP

Related Classes of org.eclipse.wb.internal.core.utils.exception.DesignerException

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.