本文整理汇总了Java中org.eclipse.mylyn.tasks.core.data.TaskData类的典型用法代码示例。如果您正苦于以下问题:Java TaskData类的具体用法?Java TaskData怎么用?Java TaskData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TaskData类属于org.eclipse.mylyn.tasks.core.data包,在下文中一共展示了TaskData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
}
示例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);
}
}
示例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();
}
}
}
});
}
}
示例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;
}
示例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);
}
}
示例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();
}
}
示例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);
}
示例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());
}
示例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));
}
示例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;
}
示例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();
}
}
}
示例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
}
}
示例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;
}
}
示例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;
}
}
示例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);
}