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

Java TaskData类代码示例

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

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



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

示例1: persistAttachments

import org.eclipse.mylyn.tasks.core.data.TaskData; //导入依赖的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.TaskData; //导入依赖的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.TaskData; //导入依赖的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.TaskData; //导入依赖的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.TaskData; //导入依赖的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.TaskData; //导入依赖的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: createSubtask

import org.eclipse.mylyn.tasks.core.data.TaskData; //导入依赖的package包/类
public NbTask createSubtask (NbTask parentTask) throws CoreException {
    ensureTaskListLoaded();
    TaskRepository taskRepository = taskRepositoryManager.getRepository(parentTask.getDelegate().getRepositoryUrl());
    if (taskRepository == null || parentTask.isUnsubmittedRepositoryTask()) {
        throw new IllegalStateException("Task repository: " + parentTask.getDelegate().getRepositoryUrl()
                + " - parent: " + parentTask.isUnsubmittedRepositoryTask());
    }
    AbstractTask task = createNewTask(taskRepository);
    AbstractRepositoryConnector repositoryConnector = taskRepositoryManager.getRepositoryConnector(taskRepository.getConnectorKind());
    AbstractTaskDataHandler taskDataHandler = repositoryConnector.getTaskDataHandler();
    
    TaskAttributeMapper attributeMapper = repositoryConnector.getTaskDataHandler().getAttributeMapper(taskRepository);
    TaskData taskData = new TaskData(attributeMapper, repositoryConnector.getConnectorKind(), taskRepository.getRepositoryUrl(), "");
    taskDataHandler.initializeSubTaskData(taskRepository, taskData, parentTask.getTaskDataState().getRepositoryData(), new NullProgressMonitor());
    initializeTask(repositoryConnector, taskData, task, taskRepository);        
    return MylynSupport.getInstance().toNbTask(task);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:MylynSupport.java


示例8: initializeTask

import org.eclipse.mylyn.tasks.core.data.TaskData; //导入依赖的package包/类
private void initializeTask (AbstractRepositoryConnector repositoryConnector, TaskData taskData, AbstractTask task, TaskRepository taskRepository) throws CoreException {
    ITaskMapping mapping = repositoryConnector.getTaskMapping(taskData);
    String taskKind = mapping.getTaskKind();
    if (taskKind != null && taskKind.length() > 0) {
        task.setTaskKind(taskKind);
    }
    ITaskDataWorkingCopy workingCopy = taskDataManager.createWorkingCopy(task, taskData);
    workingCopy.save(null, null);
    repositoryConnector.updateNewTaskFromTaskData(taskRepository, task, taskData);
    String summary = mapping.getSummary();
    if (summary != null && summary.length() > 0) {
        task.setSummary(summary);
    }
    if (taskRepository == localTaskRepository) {
        taskList.addTask(task);
    } else {
        taskList.addTask(task, taskList.getUnsubmittedContainer(task.getAttribute(ITasksCoreConstants.ATTRIBUTE_OUTGOING_NEW_REPOSITORY_URL)));
    }
    task.setAttribute(AbstractNbTaskWrapper.ATTR_NEW_UNREAD, Boolean.TRUE.toString());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:MylynSupport.java


示例9: AbstractNbTaskWrapper

import org.eclipse.mylyn.tasks.core.data.TaskData; //导入依赖的package包/类
/** PRIVATE TASK ATTRIBUTES **/

    public AbstractNbTaskWrapper (NbTask task) {
        this.task = task;
        this.repositoryDataRef = new SoftReference<TaskData>(null);
        support = new PropertyChangeSupport(this);
        repositoryTaskDataLoaderTask = RP.create(new Runnable() {
            @Override
            public void run () {
                loadRepositoryTaskData();
            }
        });
        MylynSupport mylynSupp = MylynSupport.getInstance();
        taskDataListener = new TaskDataListenerImpl();
        mylynSupp.addTaskDataListener(WeakListeners.create(TaskDataListener.class, taskDataListener, mylynSupp));
        taskListener = new TaskListenerImpl();
        task.addNbTaskListener(WeakListeners.create(NbTaskListener.class, taskListener, mylynSupp));
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:AbstractNbTaskWrapper.java


示例10: loadRepositoryTaskData

import org.eclipse.mylyn.tasks.core.data.TaskData; //导入依赖的package包/类
private TaskData loadRepositoryTaskData () {
    // this method is time consuming
    assert !EventQueue.isDispatchThread();
    TaskData td = repositoryDataRef.get();
    if (td != null) {
        return td;
    }
    try {
        NbTaskDataState taskDataState = task.getTaskDataState();
        if (taskDataState != null) {
            td = taskDataState.getRepositoryData();
            repositoryDataRef = new SoftReference<TaskData>(td);
            repositoryTaskDataLoaded(td);
        }
    } catch (CoreException ex) {
        LOG.log(Level.WARNING, null, ex);
    }
    return td;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:AbstractNbTaskWrapper.java


示例11: taskDataUpdated

import org.eclipse.mylyn.tasks.core.data.TaskData; //导入依赖的package包/类
@Override
public void taskDataUpdated (TaskDataListener.TaskDataEvent event) {
    if (event.getTask() == task) {
        if (event.getTaskData() != null && !event.getTaskData().isPartial()) {
            repositoryDataRef = new SoftReference<TaskData>(event.getTaskData());
        }
        if (event.getTaskDataUpdated()) {
            NbTaskDataModel m = model;
            if (m != null) {
                try {
                    m.refresh();
                } catch (CoreException ex) {
                    LOG.log(Level.INFO, null, ex);
                }
            }
            AbstractNbTaskWrapper.this.taskDataUpdated();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:AbstractNbTaskWrapper.java


示例12: getFieldValue

import org.eclipse.mylyn.tasks.core.data.TaskData; //导入依赖的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


示例13: getFieldValues

import org.eclipse.mylyn.tasks.core.data.TaskData; //导入依赖的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


示例14: canAssignToDefault

import org.eclipse.mylyn.tasks.core.data.TaskData; //导入依赖的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: setValue

import org.eclipse.mylyn.tasks.core.data.TaskData; //导入依赖的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


示例16: makeExternalChange

import org.eclipse.mylyn.tasks.core.data.TaskData; //导入依赖的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


示例17: readComment

import org.eclipse.mylyn.tasks.core.data.TaskData; //导入依赖的package包/类
private void readComment(TaskData data, BugzillaRepositoryConnector brc, TaskRepository repository, String comment) throws CoreException {
    // refresh
    data = brc.getTaskData(repository, data.getTaskId(), nullProgressMonitor);

    List<TaskAttribute> attributes = data.getAttributeMapper().getAttributesByType(data, TaskAttribute.TYPE_COMMENT);
    assertNotNull(attributes);
    
    boolean fail = true;
    for (TaskAttribute ta : attributes) {
        if(ta.getMappedAttribute(TaskAttribute.COMMENT_TEXT).getValue().equals(comment)) {
            fail = false;
            break;
        }
    }
    if(fail) {
        fail("Couldn't find comment text [" + comment + "] for taskdata [" + data.getTaskId() + "]");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:BugzillaTest.java


示例18: updateTaskData

import org.eclipse.mylyn.tasks.core.data.TaskData; //导入依赖的package包/类
private void updateTaskData(TaskData data, BugzillaRepositoryConnector brc, TaskRepository repository) throws CoreException {
      data = brc.getTaskData(repository, data.getTaskId(), nullProgressMonitor);
TaskAttribute attrModification1 = data.getRoot().getMappedAttribute(TaskAttribute.DATE_MODIFICATION);

      TaskAttribute rta = data.getRoot();
      TaskAttribute ta = rta.getMappedAttribute(TaskAttribute.USER_ASSIGNED);
      ta = rta.getMappedAttribute(TaskAttribute.SUMMARY);
      String val = ta.getValue();
      ta.setValue(val + " updated");
      Set<TaskAttribute> attrs = new HashSet<TaskAttribute>();
      attrs.add(ta);
      RepositoryResponse rr = brc.getTaskDataHandler().postTaskData(repository, data, attrs, new NullProgressMonitor());
      assertEquals(rr.getReposonseKind(), RepositoryResponse.ResponseKind.TASK_UPDATED);

      data = brc.getTaskData(repository, data.getTaskId(), nullProgressMonitor);
      rta = data.getRoot();
      ta = rta.getMappedAttribute(TaskAttribute.SUMMARY);
      assertEquals(val + " updated", ta.getValue());

      TaskAttribute attrModification2 = data.getRoot().getMappedAttribute(TaskAttribute.DATE_MODIFICATION);
      assertNotSame(attrModification1, attrModification2);

  }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:BugzillaTest.java


示例19: addAttachement

import org.eclipse.mylyn.tasks.core.data.TaskData; //导入依赖的package包/类
private TaskData addAttachement(TaskData data,  BugzillaRepositoryConnector brc, TaskRepository repository, String comment, String desc, String content) throws Exception {
//        Task task = new Task(getRepository().getRepositoryUrl(), getRepository().getConnectorKind(), key, taskId, "");
        File f = getAttachmentFile(content);

        FileTaskAttachmentSource attachmentSource = new FileTaskAttachmentSource(f);
        attachmentSource.setContentType("text/plain");

//        List<TaskAttribute> attributes = data.getAttributeMapper().getAttributesByType(data, TaskAttribute.TYPE_ATTACHMENT);
        TaskAttribute attAttribute = new TaskAttribute(data.getRoot(),  TaskAttribute.TYPE_ATTACHMENT);
        TaskAttribute a = attAttribute.createMappedAttribute(TaskAttribute.ATTACHMENT_DESCRIPTION);
        a.setValue(desc);
        String bugId = data.getTaskId();
        brc.getClientManager().getClient(repository, nullProgressMonitor)
                .postAttachment(bugId, comment, attachmentSource, attAttribute, nullProgressMonitor);

        data = brc.getTaskData(repository, data.getTaskId(), nullProgressMonitor);
        List<TaskAttribute> attributes = data.getAttributeMapper().getAttributesByType(data, TaskAttribute.TYPE_ATTACHMENT);
        assertTrue(attributes.size() > 0);
        return data;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:BugzillaTest.java


示例20: readAttachement

import org.eclipse.mylyn.tasks.core.data.TaskData; //导入依赖的package包/类
private void readAttachement(TaskData data,  BugzillaRepositoryConnector brc, TaskRepository repository, String content) throws Exception {
        // refresh
        data = brc.getTaskData(repository, data.getTaskId(), nullProgressMonitor);

        List<TaskAttribute> attributes = data.getAttributeMapper().getAttributesByType(data, TaskAttribute.TYPE_ATTACHMENT);
        TaskAttribute attribute = attributes.get(0);
        TaskAttachmentMapper attachment = TaskAttachmentMapper.createFrom(attribute);
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        InputStream is = brc.getClientManager().getClient(repository, nullProgressMonitor).getAttachmentData(attachment.getAttachmentId(), nullProgressMonitor);
        FileUtils.copyStream(is, os);

        try {
//          byte[] d = new byte[4];
//          os.read(d);
			assertEquals(content, os.toString());
        } finally {
			if(os != null) os.close();
		}
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:BugzillaTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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