• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TaskAttribute类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.mylyn.tasks.core.data.TaskAttribute的典型用法代码示例。如果您正苦于以下问题:Java TaskAttribute类的具体用法?Java TaskAttribute怎么用?Java TaskAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TaskAttribute类属于org.eclipse.mylyn.tasks.core.data包,在下文中一共展示了TaskAttribute类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: persistAttachments

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
private void persistAttachments (NbTaskDataModel model, TaskData td) {
    if (unsavedAttachments != null) {
        TaskAttribute parentTA = td.getRoot().getAttribute(IssueField.ATTACHMENTS.getKey());
        if (parentTA == null) {
            parentTA = td.getRoot().createAttribute(IssueField.ATTACHMENTS.getKey());
        }
        if (!unsavedAttachments.isEmpty()) {
            boolean copyToCentral = askCopyToCentralStorage(unsavedAttachments.size());
            for (AttachmentInfo att : unsavedAttachments) {
                File file = att.getFile();
                if (file != null) {
                    String desc = att.getDescription();
                    String contentType = att.getContentType();
                    boolean isPatch = att.isPatch();
                    addAttachment(model, parentTA, file, desc, contentType, isPatch, copyToCentral);
                }
            }
            unsavedAttachments.clear();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:LocalTask.java


示例2: removeTaskReference

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
void removeTaskReference (String repositoryId, String taskId) {
    NbTaskDataModel model = getModel();
    TaskData taskData = model == null ? null : model.getLocalTaskData();
    if (taskData != null) {
        TaskAttribute parentTA = taskData.getRoot().getAttribute(IssueField.REFERENCES.getKey());
        if (parentTA != null) {
            for (TaskAttribute ta : parentTA.getAttributes().values()) {
                if (ta.getId().startsWith(NB_TASK_REFERENCE)) {
                    TaskReference ref = TaskReference.createFrom(ta);
                    if (repositoryId.equals(ref.getRepositoryId()) && taskId.equals(ref.getTaskId())) {
                        parentTA.removeAttribute(ta.getId());
                        break;
                    }
                }
            }
        }
        model.attributeChanged(parentTA);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:LocalTask.java


示例3: attachPatch

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
public void attachPatch (final File file, final String description) {
    if (file != null) {
        runWithModelLoaded(new Runnable() {

            @Override
            public void run () {
                NbTaskDataModel model = getModel();
                TaskData td = model == null ? null : model.getLocalTaskData();
                if (td != null) {
                    TaskAttribute parentTA = td.getRoot().getAttribute(IssueField.ATTACHMENTS.getKey());
                    if (parentTA == null) {
                        parentTA = td.getRoot().createAttribute(IssueField.ATTACHMENTS.getKey());
                    }
                    addAttachment(model, parentTA, file, description, null, true, true);
                    save();
                    modelStateChanged(false);
                    if (controller != null) {
                        controller.refreshViewData();
                    }
                }
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:LocalTask.java


示例4: hasIncomingChanges

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
public boolean hasIncomingChanges (TaskAttribute taskAttribute, boolean includeConflicts) {
    TaskData repositoryData = workingCopy.getRepositoryData();
    if (repositoryData == null) {
        return false;
    }
    taskAttribute = repositoryData.getRoot().getMappedAttribute(taskAttribute.getPath());
    if (taskAttribute == null) {
        return false;
    }
    boolean incoming = delegateModel.hasIncomingChanges(taskAttribute);
    if (includeConflicts && !incoming && delegateModel.hasOutgoingChanges(taskAttribute)) {
        TaskData lastReadData = workingCopy.getLastReadData();
        if (lastReadData == null) {
            return true;
        }
        TaskAttribute oldAttribute = lastReadData.getRoot().getMappedAttribute(taskAttribute.getPath());
        if (oldAttribute == null) {
            return true;
        }
        return !repositoryData.getAttributeMapper().equals(taskAttribute, oldAttribute);
    }
    return incoming;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:NbTaskDataModel.java


示例5: refresh

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
/**
 * Updates the model and all taskdata to keep track with external taskdata
 * changes (such as a task refresh)
 * @throws CoreException 
 */
public void refresh () throws CoreException {
    // refresh reverts all taskdata to the state on disk
    delegateModel.refresh(null);
    // also clear unsaved changes in the mylyn model
    // this is needed because after refresh() the unsaved changes no longer
    // belong to the local taskdata (they're reinstantiated)
    delegateModel.revert();
    if (workingCopy instanceof TaskDataState && workingCopy.getLastReadData() == null) {
        ((TaskDataState) workingCopy).setLastReadData(workingCopy.getRepositoryData());
    }
    Set<TaskAttribute> changedAttributes;
    synchronized (unsavedChangedAttributes) {
        changedAttributes = new HashSet<TaskAttribute>(unsavedChangedAttributes);
    }
    for (TaskAttribute ta : changedAttributes) {
        // there are still local unsaved changes, keep them in local taskdata
        TaskData td = getLocalTaskData();
        td.getRoot().deepAddCopy(ta);
        TaskAttribute attribute = td.getRoot().getAttribute(ta.getId());
        // now refill the unsaved changes so they belong to the correct local TD
        attributeChanged(attribute);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:NbTaskDataModel.java


示例6: save

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
public void save (IProgressMonitor monitor) throws CoreException {
    // clear delegate model changes
    delegateModel.save(monitor);
    // now bit of hacking
    // task attributes with same values as local changes must be reverted
    TaskData editsData = workingCopy.getEditsData();
    TaskData repositoryData = workingCopy.getRepositoryData();
    synchronized (unsavedChangedAttributes) {
        if (editsData != null && repositoryData != null) {
            for (Iterator<TaskAttribute> it = unsavedChangedAttributes.iterator(); it.hasNext(); ) {
                TaskAttribute ta = it.next();
                if (!editsDiffer(ta, repositoryData)) {
                    editsData.getRoot().removeAttribute(ta.getId());
                    it.remove();
                }
            }
        }
        // are there any edits 
        boolean noChanges = unsavedChangedAttributes.isEmpty() && !hasOutgoingChanged();
        if (noChanges) {
            task.discardLocalEdits();
        }
        delegateModel.revert();
        unsavedChangedAttributes.clear();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:NbTaskDataModel.java


示例7: attachmentAttributesDiffer

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
protected static boolean attachmentAttributesDiffer (TaskAttribute ta1, TaskAttribute ta2) {
    if (ta2 == null) {
        return true;
    }
    String value1 = ta1.getValue();
    String value2 = ta2.getValue();
    boolean changes = !value1.equals(value2);
    if (!changes) {
        // is a child attribue changed??
        for (TaskAttribute childTA : ta1.getAttributes().values()) {
            if (attachmentAttributesDiffer(childTA, ta2.getAttribute(childTA.getId()))) {
                changes = true;
                break;
            }
        }
    }
    return changes;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:AbstractNbTaskWrapper.java


示例8: toString

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
@Override
public String toString() {
    if(stringValue == null) {
        StringBuilder sb = new StringBuilder();
        sb.append("AddAttachmentCommand [repository=");                     // NOI18N
        sb.append(repository.getUrl());
        sb.append(",id=");                                                  // NOI18N
        sb.append(id);
        sb.append(",comment=");                                             // NOI18N
        sb.append(comment);
        sb.append(",file=");                                                // NOI18N
        sb.append(file.getAbsolutePath());
        sb.append(",desc=");                                                // NOI18N
        TaskAttribute ta = attAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_DESCRIPTION);
        sb.append(ta != null ? ta.getValue() : "");                         // NOI18N
        sb.append(",patch=");                                               // NOI18N
        ta = attAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_IS_PATCH);
        sb.append(ta != null ? ta.getValue() : "");                         // NOI18N
        sb.append(",contentType=");                                         // NOI18N
        ta = attAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_CONTENT_TYPE);
        sb.append(ta != null ? ta.getValue() : "");                         // NOI18N
        sb.append("]");                                                     // NOI18N
        stringValue = sb.toString();
    }
    return stringValue;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:AddAttachmentCommand.java


示例9: getFieldValue

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
private static String getFieldValue (TaskData taskData, IssueField f) {
    if (taskData == null) {
        return "";
    }
    if(f.isSingleAttribute()) {
        TaskAttribute a = taskData.getRoot().getMappedAttribute(f.getKey());
        if(a != null && a.getValues().size() > 1) {
            return listValues(a);
        }
        return a != null ? a.getValue() : ""; // NOI18N
    } else {
        List<TaskAttribute> attrs = taskData.getAttributeMapper().getAttributesByType(taskData, f.getKey());
        // returning 0 would set status MODIFIED instead of NEW
        return "" + ( attrs != null && attrs.size() > 0 ?  attrs.size() : ""); // NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:BugzillaIssue.java


示例10: listValues

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
/**
 * Returns a comma separated list created
 * from the values returned by TaskAttribute.getValues()
 *
 * @param a
 * @return
 */
private static String listValues(TaskAttribute a) {
    if(a == null) {
        return "";                                                          // NOI18N
    }
    StringBuilder sb = new StringBuilder();
    List<String> l = a.getValues();
    for (int i = 0; i < l.size(); i++) {
        String s = l.get(i);
        sb.append(s);
        if(i < l.size() -1) {
            sb.append(",");                                                 // NOI18N
        }
    }
    return sb.toString();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:BugzillaIssue.java


示例11: getFieldValues

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
private static List<String> getFieldValues(TaskData taskData, IssueField f) {
    if (taskData == null) {
        return Collections.<String>emptyList();
    }
    if(f.isSingleAttribute()) {
        TaskAttribute a = taskData.getRoot().getMappedAttribute(f.getKey());
        if(a != null) {
            return a.getValues();
        } else {
            return Collections.emptyList();
        }
    } else {
        List<String> ret = new ArrayList<>();
        ret.add(getFieldValue(taskData, f));
        return ret;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:BugzillaIssue.java


示例12: getFieldStatus

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
/**
 * Returns a status value for the given field<br>
 * <ul>
 *  <li>{@link #FIELD_STATUS_IRELEVANT} - issue wasn't seen yet
 *  <li>{@link #FIELD_STATUS_UPTODATE} - field value wasn't changed
 *  <li>{@link #FIELD_STATUS_MODIFIED} - field value was changed in repository
 *  <li>{@link #FIELD_STATUS_OUTGOING} - field value was changed locally
 *  <li>{@link #FIELD_STATUS_CONFLICT} - field value was changed both locally and remotely
 * </ul>
 * @param f IssueField
 * @return a status value
 */
public int getFieldStatus(IssueField f) {
    NbTaskDataModel m = getModel();
    if (m == null) {
        return FIELD_STATUS_UPTODATE;
    }
    TaskAttribute ta = m.getLocalTaskData().getRoot().getMappedAttribute(f.getKey());
    boolean incoming = ta != null && m.hasIncomingChanges(ta, true);
    boolean outgoing = ta != null && m.hasOutgoingChanges(ta);
    if (ta == null) {
        return FIELD_STATUS_UPTODATE;
    } else if (incoming & outgoing) {
        return FIELD_STATUS_CONFLICT;
    } else if (incoming) {
        return FIELD_STATUS_MODIFIED;
    } else if (outgoing) {
        return FIELD_STATUS_OUTGOING;
    }
    return FIELD_STATUS_UPTODATE;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:BugzillaIssue.java


示例13: canReassign

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
boolean canReassign() {
    NbTaskDataModel m = getModel();
    if (m == null) {
        return false;
    }
    BugzillaConfiguration rc = getRepository().getConfiguration();
    final BugzillaVersion installedVersion = rc != null ? rc.getInstalledVersion() : null;
    boolean oldRepository = installedVersion != null ? installedVersion.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_3_2) < 0 : false;
    if (oldRepository) {
        TaskAttribute rta = m.getLocalTaskData().getRoot();
        TaskAttribute ta = rta.getMappedAttribute(BugzillaOperation.reassign.getInputId());
        return (ta != null);
    } else {
        return true;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:BugzillaIssue.java


示例14: canAssignToDefault

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
boolean canAssignToDefault() {
    NbTaskDataModel m = getModel();
    if (m == null) {
        return false;
    }
    BugzillaConfiguration rc = getRepository().getConfiguration();
    final BugzillaVersion installedVersion = rc != null ? rc.getInstalledVersion() : null;
    boolean pre4 = installedVersion != null ? installedVersion.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_3_0) <= 0 : false;
    TaskData taskData = m.getLocalTaskData();
    if(pre4) {
        return BugzillaOperation.reassignbycomponent.getInputId() != null ? 
                    taskData.getRoot().getMappedAttribute(BugzillaOperation.reassignbycomponent.getInputId()) != null :
                    false;
    } else {
        TaskAttribute ta = taskData.getRoot().getAttribute(BugzillaAttribute.SET_DEFAULT_ASSIGNEE.getKey()); 
        return ta != null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:BugzillaIssue.java


示例15: getComments

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
Comment[] getComments() {
    final List<Comment> comments = new ArrayList<>();
    runWithModelLoaded(new Runnable() {
        @Override
        public void run() {
            NbTaskDataModel m = getModel();
            List<TaskAttribute> attrs = m == null ? null : m.getLocalTaskData()
                    .getAttributeMapper().getAttributesByType(m.getLocalTaskData(), TaskAttribute.TYPE_COMMENT);
            if (attrs != null) {
                for (TaskAttribute taskAttribute : attrs) {
                    comments.add(new Comment(taskAttribute));
                }
            }
        }
    });
    return comments.toArray(new Comment[comments.size()]);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:BugzillaIssue.java


示例16: addComment

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
public void addComment (final String comment) {
    if(comment != null && !comment.isEmpty()) {
        runWithModelLoaded(new Runnable() {
            @Override
            public void run () {
                Bugzilla.LOG.log(Level.FINER, "adding comment [{0}] to issue #{1}", new Object[]{comment, getID()});
                TaskAttribute ta = getModel().getLocalTaskData().getRoot().getMappedAttribute(IssueField.COMMENT.getKey());
                String value = ta.getValue();
                if (value == null || value.trim().isEmpty()) {
                    value = comment;
                } else {
                    value += "\n\n" + comment; //NOI18N
                }
                setValue(getModel(), ta, value);
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:BugzillaIssue.java


示例17: getAvailableOperations

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
/**
 * Returns available operations for this issue
 * @return
 */
Map<String, TaskOperation> getAvailableOperations () {
    if (availableOperations == null) {
        HashMap<String, TaskOperation> operations = new HashMap<String, TaskOperation>(5);
        NbTaskDataModel model = getModel();
        List<TaskAttribute> allOperations = model.getLocalTaskData().getAttributeMapper().getAttributesByType(model.getLocalTaskData(), TaskAttribute.TYPE_OPERATION);
        for (TaskAttribute operation : allOperations) {
            // the test must be here, 'operation' (applying writable action) is also among allOperations
            if (operation.getId().startsWith(TaskAttribute.PREFIX_OPERATION)) {
                operations.put(operation.getId().substring(TaskAttribute.PREFIX_OPERATION.length()), TaskOperation.createFrom(operation));
            }
        }
        availableOperations = operations;
    }

    return availableOperations;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:BugzillaIssue.java


示例18: setValue

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
private void setValue (NbTaskDataModel model, TaskAttribute ta, String value) {
    TaskData repositoryTaskData = model.getRepositoryTaskData();
    if (value.isEmpty() && repositoryTaskData != null) {
        // should be empty or set to ""???
        TaskAttribute a = repositoryTaskData.getRoot().getAttribute(ta.getId());
        if (a == null || a.getValues().isEmpty()) {
            // repository value is also empty list, so let's set to the same
            ta.clearValues();
        } else {
            ta.setValue(value);
        }
    } else {
        ta.setValue(value);
    }
    model.attributeChanged(ta);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:BugzillaIssue.java


示例19: makeExternalChange

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
private void makeExternalChange (NbTask task, String newSummary) throws CoreException {
    MylynSupport supp = MylynSupport.getInstance();
    TaskData taskData = task.getTaskDataState().getRepositoryData();
    
    // edit the task externally
    TaskAttribute rta = taskData.getRoot();
    // now make an external change in summary
    TaskData external = new TaskData(taskData.getAttributeMapper(),
            taskData.getConnectorKind(),
            taskData.getRepositoryUrl(),
            taskData.getTaskId());
    external.setVersion(taskData.getVersion());
    for (TaskAttribute child : rta.getAttributes().values()) {
        external.getRoot().deepAddCopy(child);
    }
    external.getRoot().getMappedAttribute(TaskAttribute.SUMMARY).setValue(newSummary);
    SubmitCommand submitCmd = new SubmitCommand(Bugzilla.getInstance().getRepositoryConnector(), btr, external);
    br.getExecutor().execute(submitCmd);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:MylynStorageTest.java


示例20: closeTask

import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入依赖的package包/类
private void closeTask (String resolution) {
    TaskOperation taskOperation = null;
    TaskAttribute opAttr = model.getLocalTaskData().getRoot().getMappedAttribute(TaskAttribute.OPERATION);
    for (TaskOperation op : model.getLocalTaskData().getAttributeMapper().getTaskOperations(opAttr)) {
        if (BugzillaOperation.resolve.getLabel().equals(op.getLabel())) {
            taskOperation = op;
            break;
        }
    }
    assertNotNull(taskOperation);
    assertFalse(task.isCompleted());
    model.getLocalTaskData().getAttributeMapper().setTaskOperation(opAttr, taskOperation);
    model.attributeChanged(opAttr);
    TaskAttribute resolutionAttr = model.getLocalTaskData().getRoot().getMappedAttribute(BugzillaOperation.resolve.getInputId());
    resolutionAttr.setValue(resolution);
    model.attributeChanged(resolutionAttr);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:MylynStorageTest.java



注:本文中的org.eclipse.mylyn.tasks.core.data.TaskAttribute类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AuditService类代码示例发布时间:2022-05-23
下一篇:
Java AnnotationEntry类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap