Package org.eclipse.e4.ui.model.application.ui

Examples of org.eclipse.e4.ui.model.application.ui.MUIElement


          if (converter != null) {
            Object newValue = converter.convert(value);
            descriptor.getWriteMethod().invoke(data, newValue);
            tableViewer.refresh(data);
          } else {
            throw new XWTException("Converter doesn't exist from \"" + value.getClass().getName() + "\" to \"" + type.getName());
          }
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
View Full Code Here


          try {
            writeMethod.invoke(target, value);
            fireSetPostAction(target, this, value);
          } catch (IllegalArgumentException e) {
            if (value == null) {
              throw new XWTException("Property type " + getName()
                  + " of " + target.getClass().getName()
                  + " cannot be null.", e);
            }
            throw new XWTException("Property type " + getName()
                + " of " + target.getClass().getName()
                + " is mismatch with "
                + value.getClass().getName()
                + " expected type is "
                + parameterTypes[0].getName(), e);
          }
          catch (InvocationTargetException e) {
            throw new XWTException("Problem of invoke " + getName()
                + " of " + target.getClass().getName()
                + " with a value of type "
                + value.getClass().getName(), e);
          }
        }
View Full Code Here

    return null;
  }

  public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
    if (!(value instanceof Style)) {
      throw new XWTException("Style is expected.");
    }
    Style style = (Style) value;
    style.apply(target);
  }
View Full Code Here

      if (!ObjectUtil.isAssignableFrom(fieldType, value.getClass())) {
        IConverter converter = XWT.findConvertor(valueType, fieldType);
        if (converter != null) {
          value = converter.convert(value);
        } else {
          throw new XWTException("Converter " + valueType.getName() + "->" + fieldType.getName());
        }
      }
    }
    field.set(target, value);
    fireSetPostAction(target, this, value);
View Full Code Here

            String className = path.substring(0, index);
            segment = path.substring(index + 1);
            type = dataProvider.getModelService().loadModelType(
                className);
            if (type == null) {
              throw new XWTException("Class " + className
                  + " not found");
            }
            dataProvider = XWT.findDataProvider(type);
          }
        }

        type = dataProvider.getDataType(segment);

        if (type != null) {
          dataProvider = XWT.findDataProvider(type);
          if (dataProvider == null) {
            throw new XWTException(
                "Data probider is not found for the type "
                    + type.toString());
          }
        } else {
          throw new XWTException(
              "Type is not found for the property " + segment);
        }
      }
      String segment = segments[last];

      int length = segment.length();
      if (length > 1 && segment.charAt(0) == '('
          && segment.charAt(length - 1) == ')') {
        // It is class
        String path = segment.substring(1, segment.length() - 1);
        int index = path.lastIndexOf('.');
        if (index != -1) {
          String className = path.substring(0, index);
          segment = path.substring(index + 1);
          type = dataProvider.getModelService().loadModelType(
              className);
          if (type == null) {
            throw new XWTException("Class " + className
                + " not found");
          }
          dataProvider = XWT.findDataProvider(type);
        }
      }
View Full Code Here

              if (type != null) {
                segment = null;
              }
            }
            if (type == null) {
              throw new XWTException("Class " + className
                  + " not found");
            }
            dataProvider = XWT.findDataProvider(type);
          }
        }
      }
      if (currentPath == null) {
        currentPath = segment;
      } else if (segment != null) {
        currentPath = currentPath + '.' + segment;
      }

      IObservable segmentValue = scopeManager.getObservableValue(widget,
          value, currentPath);
      try {
        if (segmentValue == null) {
          if (segment != null) {
            segmentValue = createValueProperty(dataValue, segment,
                type);
            if (segmentValue == null) {
              throw new XWTException(" Property " + segment
                  + " is not found in "
                  + expressionPath.getFullPath());
              // maybe to
              // raise an
              // exception
            }
            scopeManager.addObservableValue(widget, value,
                currentPath, segmentValue);
          } else  if (dataValue instanceof IObservable){
            segmentValue = (IObservable)dataValue;
          }
        }
        else if (segment == null && type != null) {
          if (segmentValue instanceof TypedViewerObservableValueDecorator) {
            TypedViewerObservableValueDecorator typedViewerObservableValueDecorator = (TypedViewerObservableValueDecorator) segmentValue;
            typedViewerObservableValueDecorator.setElementType(type);
          }
        }
      } catch (IllegalArgumentException e) {
        // Property is not found
        String message = e.getMessage();
        if (!message.startsWith("Could not find property with name")) {
          throw e;
        }
        throw new XWTException(" Property " + segment
            + " is not found in " + expressionPath.getFullPath()); // maybe
                                        // to
                                        // raise
                                        // an
        // exception
View Full Code Here

      switch (array[i]) {
      case '}':
        {
          Character character = separators.pop();
          if (character.charValue() != '{') {
            throw new XWTException("Syntax error is binding expression " + value + " at " + i);
          }
        }
        level --;
        break;
      case ']':
        {
          Character character = separators.pop();
          if (character.charValue() != '[') {
            throw new XWTException("Syntax error is binding expression " + value + " at " + i);
          }
        }
        level --;
        break;
      case ')':
        {
          Character character = separators.pop();
          if (character.charValue() != '(') {
            throw new XWTException("Syntax error is binding expression " + value + " at " + i);
          }
        }
        level --;
        if (level == 0) {
          stripEnd = i - 1;
View Full Code Here

      switch (array[i]) {
      case '{':
        {
          Character character = separators.pop();
          if (character.charValue() != '}') {
            throw new XWTException("Syntax error is binding expression " + value + " at " + i);
          }
        }
        level --;
        break;
      case '[':
        {
          Character character = separators.pop();
          if (character.charValue() != '}') {
            throw new XWTException("Syntax error is binding expression " + value + " at " + i);
          }
        }
        level --;
        break;
      case '(':
        {
          Character character = separators.pop();
          if (character.charValue() != ')') {
            throw new XWTException("Syntax error is binding expression " + value + " at " + i);
          }
        }
        level --;
        break;
      case '}':
View Full Code Here

    String className = packageName.length() == 0 ? name : (packageName
        + "." + name);
    // try {
    Class<?> type = ClassLoaderUtil.loadClass(context, className);
    if (type == null) {
      throw new XWTException("Cannot load " + className);
    }
    metaclass = register(type, null);
    // There is no need to mapping a CLR class, since the ClassLoader will
    // be changed.
    nameRegister.remove(type.getSimpleName());
View Full Code Here

      Element element = null;
      if (stream == null) {
        element = manager.load(input, (IBeforeParsingCallback) options.get(IXWTLoader.BEFORE_PARSING_CALLBACK));
      }
      else {
        IBeforeParsingCallback callback = (IBeforeParsingCallback) options.get(IXWTLoader.BEFORE_PARSING_CALLBACK);
        InputStream inputStream = stream;
        if (callback != null) {
          int size = stream.read();
          byte[] buffer = new byte[size];
          stream.read(buffer);
          String content = new String(buffer);
          stream.close();
          content = callback.onParsing(content);
          inputStream = new ByteArrayInputStream(content.getBytes());
          element = manager.load(stream, input);         
        }
        element = manager.load(inputStream, input);
      }
View Full Code Here

TOP

Related Classes of org.eclipse.e4.ui.model.application.ui.MUIElement

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.