本文整理汇总了Java中org.eclipse.mylyn.tasks.core.ITask.setAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java ITask.setAttribute方法的具体用法?Java ITask.setAttribute怎么用?Java ITask.setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.mylyn.tasks.core.ITask
的用法示例。
在下文中一共展示了ITask.setAttribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: markTaskSeen
import org.eclipse.mylyn.tasks.core.ITask; //导入方法依赖的package包/类
void markTaskSeen (final ITask task, boolean seen) {
ITask.SynchronizationState syncState = task.getSynchronizationState();
taskDataManager.setTaskRead(task, seen);
if (!seen && syncState == task.getSynchronizationState()
&& syncState == ITask.SynchronizationState.OUTGOING
&& task instanceof AbstractTask) {
// mylyn does not set to CONFLICT status
try {
taskList.run(new ITaskListRunnable() {
@Override
public void execute (IProgressMonitor monitor) throws CoreException {
((AbstractTask) task).setSynchronizationState(ITask.SynchronizationState.CONFLICT);
}
});
taskList.notifyElementChanged(task);
} catch (CoreException ex) {
LOG.log(Level.INFO, null, ex);
}
}
task.setAttribute(ATTR_TASK_INCOMING_NEW, null);
}
示例2: getTaskDataModel
import org.eclipse.mylyn.tasks.core.ITask; //导入方法依赖的package包/类
NbTaskDataModel getTaskDataModel (NbTask task) {
assert taskListInitialized;
ITask mylynTask = task.getDelegate();
mylynTask.setAttribute(MylynSupport.ATTR_TASK_INCOMING_NEW, null);
TaskRepository taskRepository = getTaskRepositoryFor(mylynTask);
try {
ITaskDataWorkingCopy workingCopy = taskDataManager.getWorkingCopy(mylynTask);
if (workingCopy instanceof TaskDataState && workingCopy.getLastReadData() == null) {
((TaskDataState) workingCopy).setLastReadData(workingCopy.getRepositoryData());
}
return new NbTaskDataModel(taskRepository, task, workingCopy);
} catch (CoreException ex) {
MylynSupport.LOG.log(Level.INFO, null, ex);
return null;
}
}
示例3: migrate
import org.eclipse.mylyn.tasks.core.ITask; //导入方法依赖的package包/类
/**
* Migrates time tracking data from the Mylyn key-value store to the
* database. A new {@link TrackedTask} will be created and {@link Activity}
* instances for each of the days work has been done on the task.
*/
public void migrate() {
ITask task = (this.task) == null ? TimekeeperPlugin.getDefault().getTask(this) : this.task;
String attribute = task.getAttribute(TimekeeperPlugin.KEY_VALUELIST_ID);
if (attribute == null) {
// nothing to migrate
return;
}
String[] split = attribute.split(";");
for (String string : split) {
if (string.length() > 0) {
String[] kv = string.split("=");
LocalDate parsed = LocalDate.parse(kv[0]);
Activity recordedActivity = new Activity(this, parsed.atStartOfDay());
recordedActivity.setEnd(parsed.atStartOfDay().plus(Long.parseLong(kv[1]), ChronoUnit.SECONDS));
addActivity(recordedActivity);
}
}
// clear values we won't need any longer
task.setAttribute(TimekeeperPlugin.KEY_VALUELIST_ID, null);
task.setAttribute("start", null);
}
示例4: setValue
import org.eclipse.mylyn.tasks.core.ITask; //导入方法依赖的package包/类
/**
* Sets a value in the Mylyn database for the specified task.
*
* @param task
* the task to set a value for
* @param key
* the key for the value
* @param value
* the value associated with the key
*/
public static void setValue(ITask task, String key, String value) {
StringBuilder sb = new StringBuilder();
String attribute = task.getAttribute(KEY_VALUELIST_ID);
if (attribute == null || attribute.length() == 0) {
sb.append(key);
sb.append('=');
sb.append(value);
} else {
String[] split = attribute.split(PAIR_SEPARATOR);
boolean found = false;
for (int i = 0; i < split.length; i++) {
String string = split[i];
String[] kv = string.split(KV_SEPARATOR);
if (kv[0].equals(key)) {
kv[1] = value;
found = true;
}
if (kv.length == 2) {
sb.append(kv[0]);
sb.append('=');
sb.append(kv[1]);
if (i < split.length - 1) {
sb.append(';');
}
}
}
if (!found) {
sb.append(';');
sb.append(key);
sb.append('=');
sb.append(value);
}
}
task.setAttribute(KEY_VALUELIST_ID, sb.toString());
}