Package org.eclipse.mylyn.tasks.core.data

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


  private class StatusTaskDataModelListener extends TaskDataModelListener {

    @Override
    public void attributeChanged(TaskDataModelEvent event) {
      TaskAttribute changedAttribute = event.getTaskAttribute();
     
      if(changedAttribute.getId().equals(RedmineAttribute.STATUS_CHG.getTaskKey())) {
        TaskDataModel model = event.getModel();
       
        TaskAttribute markasOperation = model.getTaskData().getRoot().getAttribute(TaskAttribute.PREFIX_OPERATION + RedmineOperation.markas.toString());
        if(markasOperation!=null) {
          TaskAttribute operation = model.getTaskData().getRoot().getAttribute(TaskAttribute.OPERATION);
          model.getTaskData().getAttributeMapper().setValue(operation, RedmineOperation.markas.toString());
          model.attributeChanged(operation);
         
          AbstractAttributeEditor statusChgEditor = attributeEditors.get(changedAttribute);
          if(statusChgEditor!=null) {
View Full Code Here


  private class ProjectTaskDataModelListener extends TaskDataModelListener {
   
    @Override
    public void attributeChanged(TaskDataModelEvent event) {
      TaskAttribute root = getModel().getTaskData().getRoot();
      TaskAttribute changedAttribute = event.getTaskAttribute();
      if(changedAttribute.getId().equals(RedmineAttribute.PROJECT.getTaskKey())) {
       
        Project project = cfg.getProjects().getById(getAttributeId(RedmineAttribute.PROJECT));
       
        if(project==null) {
          getTaskEditor().setMessage(Messages.ERRMSG_UPDATING_ATTRIBUTES_FAILED, IMessageProvider.ERROR);
        } else {
         
          TaskAttribute taskAttribute = null;
          Map<RedmineAttribute, List<?extends Property>> projectSpecific = new HashMap<RedmineAttribute, List<? extends Property>>(4);
          projectSpecific.put(RedmineAttribute.TRACKER, cfg.getTrackers().getById(project.getTrackerIds()));
          projectSpecific.put(RedmineAttribute.CATEGORY, cfg.getIssueCategories().getById(project.getIssueCategoryIds()));
          projectSpecific.put(RedmineAttribute.VERSION, cfg.getVersions().getById(project.getVersionIds()));
          projectSpecific.put(RedmineAttribute.ASSIGNED_TO, cfg.getUsers().getById(project.getAssignableMemberIds()));
         
          for (Entry<RedmineAttribute, List<?extends Property>> entry : projectSpecific.entrySet()) {
            taskAttribute = root.getAttribute(entry.getKey().getTaskKey());
           
            if(taskAttribute!=null) {
              taskAttribute.clearOptions();
              if(!entry.getKey().isRequired()) {
                taskAttribute.putOption("", ""); //$NON-NLS-1$ //$NON-NLS-2$
              }
              for(Property property : entry.getValue()) {
                taskAttribute.putOption(""+property.getId(), property.getName()); //$NON-NLS-1$
              }
              if(entry.getKey().isRequired() && entry.getValue().size()==1) {
                taskAttribute.setValue(""+entry.getValue().get(0).getId()); //$NON-NLS-1$
              }
             
              refreshEditor(taskAttribute);
            }
          }
View Full Code Here

  private class TrackerTaskDataModelListener extends TaskDataModelListener {
   
    @Override
    public void attributeChanged(TaskDataModelEvent event) {
      TaskAttribute changedAttribute = event.getTaskAttribute();
      if(changedAttribute.getId().equals(RedmineAttribute.TRACKER.getTaskKey())) {
       
        Project project = cfg.getProjects().getById(getAttributeId(RedmineAttribute.PROJECT));
        int trackerId = getAttributeId(RedmineAttribute.TRACKER);
       
        if(project!=null && trackerId>0) {
View Full Code Here

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

    AttributeEditorToolkit editorToolkit = getTaskEditorPage().getAttributeEditorToolkit();
    TaskAttribute rootAttribute = getTaskData().getRoot();
    AbstractAttributeEditor attributeEditor;
    TaskAttribute attribute;

    attribute = rootAttribute.getAttribute(RedmineAttribute.DATE_START.getTaskKey());
    if (attribute != null) {
      attributeEditor = createAttributeEditor(attribute);
      attributeEditor.createLabelControl(timeComposite, toolkit);
View Full Code Here

  @Override
  public void commit(boolean onSave) {
    ITask task = getModel().getTask();
    Assert.isNotNull(task);

    TaskAttribute rootAttribute = getTaskData().getRoot();
    TaskAttribute attribute = null;

    attribute = rootAttribute.getAttribute(RedmineAttribute.DATE_DUE.getTaskKey());
    if(getModel().getChangedAttributes().contains(attribute)) {
      String dueValue = attribute.getValue();

      //Updating the Due-Date in Task-List
      if (dueValue.isEmpty()) {
        task.setDueDate(null);
      } else {
View Full Code Here

        }
      }
    };
    getModel().addModelListener(modelListener);

    TaskAttribute rootAttribute = getTaskData().getRoot();
    for (RedmineAttribute redmineAttribute : PLANNING_ATTRIBUTES) {
      TaskAttribute attribute = rootAttribute.getAttribute(redmineAttribute.getTaskKey());
      if (attribute != null && getModel().hasIncomingChanges(attribute)) {
        hasIncoming = true;
        break;
      }
    }
View Full Code Here

    section = createSection(parent, toolkit, hasIncoming);

    StringBuilder nameDetail = new StringBuilder(section.getText());
   
    int iHours = 0, iMinutes = 0;
    TaskAttribute totalAttribute = getTaskData().getRoot().getAttribute(RedmineAttribute.TIME_ENTRY_TOTAL.getTaskKey());
    if(totalAttribute!=null && !totalAttribute.getValue().isEmpty()) {

      if (!totalAttribute.getValue().isEmpty()) {
        float fHours = Float.parseFloat(totalAttribute.getValue());
       
        iMinutes = (int)(60.f * (fHours - (int)fHours));
        iHours = (int)fHours;
      }

View Full Code Here

     
    }
  }

  private static TaskAttribute createAttribute(TaskData taskData, CustomField customField, String prefix) {
    TaskAttribute attr = taskData.getRoot().createAttribute(prefix + customField.getId());
    attr.getMetaData().setType(RedmineUtil.getTaskAttributeType(customField));
    attr.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
    attr.getMetaData().setLabel(customField.getName());
    attr.getMetaData().setReadOnly(false);
    return attr;
  }
View Full Code Here

    attr.getMetaData().setReadOnly(false);
    return attr;
  }
 
  private static TaskAttribute createAttribute(TaskData taskData, IRedmineExtensionField  additionalField, String prefix) {
    TaskAttribute attr = taskData.getRoot().createAttribute(prefix + additionalField.getTaskKey());
    attr.getMetaData().setType(additionalField.getEditorType());
    attr.getMetaData().setLabel(additionalField.getLabel());
    attr.getMetaData().setReadOnly(false);
   
    if (additionalField.getOptions()!=null) {
      if (!additionalField.isRequired()) {
        attr.putOption("", ""); //$NON-NLS-1$ //$NON-NLS-2$
      }
      for (Entry<String, String> entry : additionalField.getOptions().entrySet()) {
        attr.putOption(entry.getKey(), entry.getValue());
      }
     
    }
    return attr;
  }
View Full Code Here

   
    createOperation(taskData, RedmineOperation.markas, null);
  }

  private static TaskAttribute createOperation(TaskData taskData, RedmineOperation operation, String defaultValue, Object... labelArgs) {
    TaskAttribute operationAttrib = taskData.getRoot().getAttribute(TaskAttribute.OPERATION);
    if(operationAttrib==null) {
      operationAttrib = taskData.getRoot().createAttribute(TaskAttribute.OPERATION);
      TaskOperation.applyTo(operationAttrib, operation.toString(), null);
    }

    TaskAttribute attribute = taskData.getRoot().createAttribute(TaskAttribute.PREFIX_OPERATION + operation.getTaskKey());
    TaskOperation.applyTo(attribute, operation.getTaskKey(), operation.getLabel(labelArgs));
   
    if(operation.isAssociated()) {
      attribute.getMetaData().putValue(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID, operation.getInputId());
    } else if(operation.needsRestoreValue() && defaultValue!=null && defaultValue!=""){ //$NON-NLS-1$
      attribute.getMetaData().putValue(IRedmineConstants.TASK_ATTRIBUTE_OPERATION_RESTORE, defaultValue);
    }

    return attribute;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.mylyn.tasks.core.data.TaskAttribute

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.