Examples of TaskAttribute


Examples of org.eclipse.mylyn.tasks.core.data.TaskAttribute

   
  }
 
  public void addWatcher(IRepositoryPerson person) {
    User user = users.getByLogin(person.getPersonId());
    TaskAttribute attribute = getTaskAttribute().getAttribute(RedmineAttribute.WATCHERS_ADD.getTaskKey());
    if (user!=null && attribute!=null) {
     
      String userId = ""+user.getId(); //$NON-NLS-1$
      if (!attribute.getValues().contains(userId) && !getTaskAttribute().getValues().contains(userId)) {
        attribute.addValue(userId);
       
        TableItem item = new TableItem(table, SWT.NONE);
        item.setText(COLUMN_IDX_ID, userId);
        item.setText(COLUMN_IDX_NAME, RedmineUtil.formatUserPresentation(user.getLogin(), user.getName()));
       
View Full Code Here

Examples of org.eclipse.mylyn.tasks.core.data.TaskAttribute

     
    }
  }
 
  private boolean markForRemove(String userId) {
    TaskAttribute attribute = getTaskAttribute().getAttribute(RedmineAttribute.WATCHERS_ADD.getTaskKey());
    if(attribute!=null && attribute.getValues().contains(userId)) {
      attribute.removeValue(userId);
      return true;
    } else {
      attribute = getTaskAttribute().getAttribute(RedmineAttribute.WATCHERS_REMOVE.getTaskKey());
      if (attribute!=null && !attribute.getValues().contains(userId)) {
        attribute.addValue(userId);
      }
    }
    return false;
  }
View Full Code Here

Examples of org.eclipse.mylyn.tasks.core.data.TaskAttribute

    }
    return false;
  }
 
  private void unmarkFromRemove(String userId) {
    TaskAttribute attribute = getTaskAttribute().getAttribute(RedmineAttribute.WATCHERS_REMOVE.getTaskKey());
    if (attribute!=null && attribute.getValues().contains(userId)) {
      attribute.removeValue(userId);
    }
   
  }
View Full Code Here

Examples of org.eclipse.mylyn.tasks.core.data.TaskAttribute

    }
   
  }
 
  private void updateMarker() {
    TaskAttribute addAttribute = getTaskAttribute().getAttribute(RedmineAttribute.WATCHERS_ADD.getTaskKey());
    TaskAttribute removeAttribute = getTaskAttribute().getAttribute(RedmineAttribute.WATCHERS_REMOVE.getTaskKey());
   
    for(TableItem item : table.getItems()) {
      String userId = item.getText(COLUMN_IDX_ID);
      if(userId==null || userId.isEmpty()) {
        continue;
      }
     
      if (addAttribute!=null && addAttribute.getValues().contains(userId)) {
        item.setText(COLUMN_IDX_MARKER, "(+)");
      } else if (removeAttribute!=null && removeAttribute.getValues().contains(userId)) {
        item.setText(COLUMN_IDX_MARKER, "(-)");
      } else {
        item.setText(COLUMN_IDX_MARKER, "");
      }
    }
View Full Code Here

Examples of org.eclipse.mylyn.tasks.core.data.TaskAttribute

      editor.createControl(composite, toolkit);
      layoutHelper.setLayoutData(editor);
      getTaskEditorPage().getAttributeEditorToolkit().adapt(editor);
    }
   
    TaskAttribute attribute = getTaskData().getRoot().getMappedAttribute(RedmineAttribute.WATCHERS.getTaskKey());
    if (attribute!=null && (editor = createAttributeEditor(attribute))!=null && editor instanceof RedmineWatchersEditor ) {
     
      attribute = attribute.getAttribute(RedmineAttribute.WATCHERS_ADD.getTaskKey());
      if (attribute != null) {
       
        RedminePersonEditor personEditor = new RedminePersonEditor(getModel(), attribute) {
          @Override
          public void setValue(String value) {
View Full Code Here

Examples of org.eclipse.mylyn.tasks.core.data.TaskAttribute

      formHyperlink.setBackground(null);
      formHyperlink.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
      StringBuilder sb = new StringBuilder();

      //Author
      TaskAttribute authorAttribute = RedmineTaskTimeEntryMapper.getAuthorAttribute(attribute);
      if(authorAttribute != null) {
        TaskAttributeMapper attributeMapper = attribute.getTaskData().getAttributeMapper();
        IRepositoryPerson author = attributeMapper.getRepositoryPerson(authorAttribute);
        formHyperlink.setImage(Images.getImage(Images.PERSON_NARROW));
        if (author != null) {
View Full Code Here

Examples of org.eclipse.mylyn.tasks.core.data.TaskAttribute

    GridData gd = new GridData();
    gd.horizontalSpan = 4;
    composite.setLayoutData(gd);

    AttributeEditorToolkit editorToolkit = getTaskEditorPage().getAttributeEditorToolkit();
    TaskAttribute root = getTaskData().getRoot();
    AbstractAttributeEditor attributeEditor;
    TaskAttribute attribute;
    AttributePartLayoutHelper layoutHelper = new AttributePartLayoutHelper(composite, toolkit, true);

    attribute = root.getAttribute(RedmineAttribute.TIME_ENTRY_HOURS.getTaskKey());
    if (attribute != null) {
      //TODO WORKAROUND - remove later
      if (!attribute.getMetaData().getType().equals(IRedmineConstants.EDITOR_TYPE_DURATION)) {
        attribute.getMetaData().setType(IRedmineConstants.EDITOR_TYPE_DURATION);
      }
      attributeList.add(attribute.getId());
      attributeEditor = createAttributeEditor(attribute);
      attributeEditor.createLabelControl(composite, toolkit);
      attributeEditor.createControl(composite, toolkit);
      attributeEditor.setDecorationEnabled(false);
      layoutHelper.setLayoutData(attributeEditor);
      editorToolkit.adapt(attributeEditor);
     
      attributeEditor.getControl();
    }
   

    attribute = root.getAttribute(RedmineAttribute.TIME_ENTRY_ACTIVITY.getTaskKey());
    if (attribute != null) {
      attributeList.add(attribute.getId());
      attributeEditor = createAttributeEditor(attribute);
      attributeEditor.createLabelControl(composite, toolkit);
      attributeEditor.createControl(composite, toolkit);
      attributeEditor.setDecorationEnabled(false);
      layoutHelper.setLayoutData(attributeEditor);
      editorToolkit.adapt(attributeEditor);
    }
   
    attribute = root.getAttribute(RedmineAttribute.TIME_ENTRY_COMMENTS.getTaskKey());
    if (attribute != null) {
      attributeList.add(attribute.getId());
      attributeEditor = createAttributeEditor(attribute);
      attributeEditor.createLabelControl(composite, toolkit);
      attributeEditor.createControl(composite, toolkit);
      attributeEditor.setDecorationEnabled(false);
      layoutHelper.setLayoutData(attributeEditor);
View Full Code Here

Examples of org.eclipse.mylyn.tasks.core.data.TaskAttribute

        descriptors.remove(taskEditorPartDescriptor);
        break;
      }
    }

    TaskAttribute rootAttribute = getModel().getTaskData().getRoot();
   
    descriptors.add(new TaskEditorPartDescriptor(PlanningEditorPart.PART_ID) {
      @Override
      public AbstractTaskEditorPart createPart() {
        return new PlanningEditorPart();
      }
    }.setPath(PATH_ATTRIBUTES));

    if (rootAttribute.getAttribute(RedmineAttribute.TIME_ENTRY_TOTAL.getTaskKey())!=null) {
      descriptors.add(new TaskEditorPartDescriptor(TimeEntryEditorPart.PART_ID) {
        @Override
        public AbstractTaskEditorPart createPart() {
          return new TimeEntryEditorPart();
        }
      }.setPath(PATH_COMMENTS));
    }

    if (!getModel().getTask().isCompleted() && rootAttribute.getAttribute(RedmineAttribute.TIME_ENTRY_HOURS.getTaskKey())!=null) {
      descriptors.add(new TaskEditorPartDescriptor(NewTimeEntryEditorPart.PART_ID) {
        @Override
        public AbstractTaskEditorPart createPart() {
          return new NewTimeEntryEditorPart();
        }
View Full Code Here

Examples of org.eclipse.mylyn.tasks.core.data.TaskAttribute

      }
    }
  }
 
  private void refreshCustomFieldsComposite() {
    TaskAttribute rootAttribute = getModel().getTaskData().getRoot();
    TaskAttribute trackerAttribute = rootAttribute.getAttribute(RedmineAttribute.TRACKER.getTaskKey());
    Composite parent =  attributeEditors.get(trackerAttribute).getControl().getParent();

    //remove old CutomFields from Form
    for (TaskAttribute attribute : new ArrayList<TaskAttribute>(attributeEditors.keySet())) {
      if(attribute.getId().startsWith(IRedmineConstants.TASK_KEY_PREFIX_ISSUE_CF)) {
        removeEditor(attribute);
      }
    }
   
    //remove empty labels
    for(Control control : parent.getChildren()) {
      if(control instanceof Label && ((Label)control).getText().isEmpty()) {
        control.dispose();
      }
    }
   
    getEditorComposite().layout();
     
    //create and add new CustomFields
    AttributePartLayoutHelper layoutHelper = new AttributePartLayoutHelper(parent, getManagedForm().getToolkit());
   
    for (CustomField cf : customFields.values()) {
      TaskAttribute cfAttribute = rootAttribute.getAttribute(IRedmineConstants.TASK_KEY_PREFIX_ISSUE_CF + cf.getId());
      if (cfAttribute!=null) {
        AbstractAttributeEditor cfEditor = getAttributeEditorFactory().createEditor(cfAttribute.getMetaData().getType(), cfAttribute);

        cfEditor.createLabelControl(parent, getManagedForm().getToolkit());
        cfEditor.createControl(parent, getManagedForm().getToolkit());
        layoutHelper.setLayoutData(cfEditor);
       
View Full Code Here

Examples of org.eclipse.mylyn.tasks.core.data.TaskAttribute

   
  }

  private int getAttributeId(RedmineAttribute attribute) {
    int id =-1;
    TaskAttribute taskAttribute = getModel().getTaskData().getRoot().getAttribute(attribute.getTaskKey());
    if(taskAttribute==null) {
      IStatus status = new Status(IStatus.ERROR, RedmineUiPlugin.PLUGIN_ID, Messages.ERRMSG_INVALID_ATTRIBUTE+attribute.name());
      StatusHandler.fail(status);
    } else {
      try {
        if(!taskAttribute.getValue().isEmpty()) {
          id = Integer.parseInt(taskAttribute.getValue());
        }
      } catch (NumberFormatException e) {
        IStatus status = RedmineUiPlugin.toStatus(e, Messages.ERRMSG_INVALID_ATTRIBUTE_ID_X_X, attribute.name(), taskAttribute.getValue());
        StatusHandler.fail(status);
        getTaskEditor().setMessage(Messages.ERRMSG_UPDATING_ATTRIBUTES_FAILED, IMessageProvider.ERROR);
      }
    }
    return id;
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.