本文整理汇总了Java中org.eclipse.mylyn.tasks.core.ITask类的典型用法代码示例。如果您正苦于以下问题:Java ITask类的具体用法?Java ITask怎么用?Java ITask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITask类属于org.eclipse.mylyn.tasks.core包,在下文中一共展示了ITask类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: toString
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
@Override
public String toString() {
if(stringValue == null) {
StringBuilder sb = new StringBuilder();
if (task.getSynchronizationState() == ITask.SynchronizationState.OUTGOING_NEW) {
sb.append("SubmitTaskCommand new issue [repository="); //NOI18N
sb.append(taskRepository.getUrl());
sb.append("]"); //NOI18N
} else {
sb.append("SubmitTaskCommand [task #"); //NOI18N
sb.append(taskData.getTaskId());
sb.append(",repository="); //NOI18N
sb.append(taskRepository.getUrl());
sb.append("]"); //NOI18N
}
stringValue = sb.toString();
}
return stringValue;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:SubmitTaskCommand.java
示例2: execute
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
@Override
public void execute () throws CoreException, IOException, MalformedURLException {
Logger log = Logger.getLogger(this.getClass().getName());
if(log.isLoggable(Level.FINE)) {
log.log(
Level.FINE,
"executing SynchronizeTasksCommand for tasks {0}:{1}", //NOI18N
new Object[] { taskRepository.getUrl(), tasks });
}
Set<ITask> mylynTasks = Accessor.getInstance().toMylynTasks(tasks);
SynchronizeTasksJob job = new SynchronizeTasksJob(taskList,
taskDataManager,
repositoryModel,
repositoryConnector,
taskRepository,
mylynTasks);
job.setUser(user);
job.run(monitor);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:SynchronizeTasksCommand.java
示例3: 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);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:MylynSupport.java
示例4: toNbTask
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
NbTask toNbTask (ITask task) {
NbTask nbTask = null;
if (task != null) {
synchronized (tasks) {
Reference<NbTask> nbTaskRef = tasks.get(task);
if (nbTaskRef != null) {
nbTask = nbTaskRef.get();
}
if (nbTask == null) {
nbTask = new NbTask(task);
tasks.put(task, new SoftReference<NbTask>(nbTask));
}
}
}
return nbTask;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:MylynSupport.java
示例5: 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;
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:MylynSupport.java
示例6: hasTaskChanged
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
@Override
public boolean hasTaskChanged(@NonNull TaskRepository taskRepository, @NonNull ITask task,
@NonNull TaskData taskData) {
Date changedAtTaskData = taskData.getAttributeMapper()
.getDateValue(taskData.getRoot().getAttribute(TaskAttribute.DATE_MODIFICATION));
Date changedAtTask = task.getModificationDate();
if (changedAtTask == null || changedAtTaskData == null)
return true;
if (!changedAtTask.equals(changedAtTaskData))
return true;
return false;
}
开发者ID:theits,项目名称:CharmMylynConnector,代码行数:17,代码来源:CharmRepositoryConnector.java
示例7: getAttachment
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
/**
* Get an attachment it it's origin-format as a byte-array
*
* @param task
* Charm Task of attachment
* @param attachmentAttribute
* attachment Attributes
* @param monitor
* monitor for indicating progress
* @return attachment as byte array
* @throws CharmException
* error while reading attachment
* @throws IOException
*/
public InputStream getAttachment(@NonNull ITask task, @NonNull TaskAttribute attachmentAttribute,
@Nullable IProgressMonitor monitor) throws CharmException {
String attachmentId = attachmentAttribute.getValue();
String taskId = attachmentAttribute.getTaskData().getRoot().getAttribute(CharmTaskAttribute.GUID).getValue();
Response response = buildWebTarget("/task/" + taskId + "/attachment/" + attachmentId + "/download")
.request(MediaType.WILDCARD).get();
if (response.getStatus() == 200) {
return (InputStream) response.getEntity();
} else {
handleError(response);
}
return null;
}
开发者ID:theits,项目名称:CharmMylynConnector,代码行数:32,代码来源:CharmClient.java
示例8: putAttachmentData
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
/**
* Uploads an attachment to the repository
*
* @param task
* attached task
* @param filename
* @param mimeType
* @param description
* @param attachment
* @param monitor
* @throws CharmHttpException
*/
public void putAttachmentData(@NonNull ITask task, String filename, String mimeType, String description,
byte[] attachment, @Nullable IProgressMonitor monitor) throws CharmHttpException {
CharmAttachmentPost charmAttachment = new CharmAttachmentPost();
charmAttachment.setDescription(description);
charmAttachment.setMimeType(mimeType);
charmAttachment.setName(filename);
charmAttachment.setPayload(Base64.getEncoder().encodeToString(attachment));
Response response = buildWebTarget("/task/" + task.getTaskId() + "/attachment", CharmAttachmentPostWriter.class,
CharmErrorMessageBodyReader.class).request(MediaType.APPLICATION_XML)
.post(Entity.entity(charmAttachment, MediaType.APPLICATION_XML));
if (response.getStatus() != 200) {
handleError(response);
}
}
开发者ID:theits,项目名称:CharmMylynConnector,代码行数:31,代码来源:CharmClient.java
示例9: hasTaskChanged
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
@Override
public boolean hasTaskChanged(TaskRepository taskRepository, ITask task, TaskData taskData)
{
TaskMapper mapper = new RedmineTaskMapper(taskData);
if (taskData.isPartial())
{
return mapper.hasChanges(task);
}
else
{
java.util.Date repositoryDate = mapper.getModificationDate();
java.util.Date localDate = task.getModificationDate();
if (repositoryDate != null && repositoryDate.equals(localDate))
{
return false;
}
return true;
}
}
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:22,代码来源:RedmineRepositoryConnector.java
示例10: getContent
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
@Override
public InputStream getContent(TaskRepository repository, ITask task, TaskAttribute attachmentAttribute,
IProgressMonitor monitor) throws CoreException
{
TaskAttachmentMapper mapper = TaskAttachmentMapper.createFrom(attachmentAttribute);
try
{
IRedmineClient client = redmineRepositoryConnector.getClientManager().getClient(repository);
Attachment attachment = client.getAttachmentById(Integer.parseInt(mapper.getAttachmentId()));
return client.downloadAttachment(attachment);
}
catch (RedmineException e)
{
throw new CoreException(new RepositoryStatus(Status.ERROR, RedmineCorePlugin.PLUGIN_ID, RepositoryStatus.ERROR_NETWORK, "Error downloading attachment.",e));
}
}
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:18,代码来源:RedmineTaskAttachmentHandler.java
示例11: postContent
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
@Override
public void postContent(TaskRepository repository, ITask task, AbstractTaskAttachmentSource source, String comment,
TaskAttribute attachmentAttribute, IProgressMonitor monitor) throws CoreException
{
Integer issueId = Integer.parseInt(task.getTaskId());
TaskAttachmentMapper attachment = TaskAttachmentMapper.createFrom(attachmentAttribute);
try
{
IRedmineClient client = redmineRepositoryConnector.getClientManager().getClient(repository);
Issue issue = client.getIssueById(issueId);
client.uploadAttachment(issue, source.getName(),source.getDescription(), source.getContentType(), source.createInputStream(monitor));
}
catch (Exception e)
{
throw new CoreException(new RepositoryStatus(Status.ERROR, RedmineCorePlugin.PLUGIN_ID, RepositoryStatus.ERROR_NETWORK, "Error downloading attachment.",e));
}
}
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:23,代码来源:RedmineTaskAttachmentHandler.java
示例12: fill
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
@Override
public void fill(Menu menu, int index) {
MenuItem submenuItem = new MenuItem(menu, SWT.CASCADE, index);
submenuItem.setText("&Appraise Review Comments");
Menu submenu = new Menu(menu);
submenuItem.setMenu(submenu);
MenuItem reviewCommentMenuItem = new MenuItem(submenu, SWT.CHECK);
reviewCommentMenuItem.setText("New &Review Comment...");
reviewCommentMenuItem.addSelectionListener(createReviewCommentSelectionListener());
MenuItem fileCommentMenuItem = new MenuItem(submenu, SWT.CHECK);
fileCommentMenuItem.setText("New &File Comment...");
fileCommentMenuItem.addSelectionListener(createFileCommentSelectionListener());
MenuItem fileLineCommentMenuItem = new MenuItem(submenu, SWT.CHECK);
fileLineCommentMenuItem.setText("New &Line Comment...");
fileLineCommentMenuItem.addSelectionListener(createFileLineCommentSelectionListener());
// Can only add Appraise comments if there is an active Appraise review task.
ITask activeTask = TasksUi.getTaskActivityManager().getActiveTask();
submenuItem.setEnabled(activeTask != null
&& AppraiseTaskMapper.APPRAISE_REVIEW_TASK_KIND.equals(activeTask.getTaskKind()));
}
开发者ID:google,项目名称:git-appraise-eclipse,代码行数:25,代码来源:TextEditorContextMenuContribution.java
示例13: writeCommentForActiveTask
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
/**
* Helper method to write a comment into the active task. Does nothing if
* there is no active task, or the active task is not a Appraise review.
*/
public void writeCommentForActiveTask(ReviewComment comment) {
ITask activeTask = TasksUi.getTaskActivityManager().getActiveTask();
if (activeTask == null) {
return;
}
if (!AppraiseTaskMapper.APPRAISE_REVIEW_TASK_KIND.equals(activeTask.getTaskKind())) {
return;
}
TaskRepository taskRepository = TasksUi.getRepositoryManager().getRepository(
AppraiseConnectorPlugin.CONNECTOR_KIND, activeTask.getRepositoryUrl());
try {
AppraisePluginReviewClient client = new AppraisePluginReviewClient(taskRepository);
client.writeComment(activeTask.getTaskId(), comment);
} catch (GitClientException e) {
AppraiseUiPlugin.logError("Error writing comment for " + activeTask.getTaskId(), e);
}
}
开发者ID:google,项目名称:git-appraise-eclipse,代码行数:23,代码来源:AppraiseUiPlugin.java
示例14: taskActivated
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
@Override
public void taskActivated(ITask task) {
if (task == null) {
return;
}
TaskData taskData = loadTaskData(task);
if (taskData == null) {
AppraiseUiPlugin.logError("Failed to load task data for " + task.getTaskId());
return;
}
TaskRepository taskRepository = TasksUi.getRepositoryManager().getRepository(
AppraiseConnectorPlugin.CONNECTOR_KIND, taskData.getRepositoryUrl());
previousBranch = null;
String reviewBranch =
taskData.getRoot()
.getAttribute(AppraiseReviewTaskSchema.getDefault().REVIEW_REF.getKey())
.getValue();
if (reviewBranch != null && !reviewBranch.isEmpty()) {
promptSwitchToReviewBranch(taskRepository, reviewBranch);
}
new ReviewMarkerManager(taskRepository, taskData).createMarkers();
}
开发者ID:google,项目名称:git-appraise-eclipse,代码行数:27,代码来源:AppraiseReviewTaskActivationListener.java
示例15: getTask
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
/**
* Returns the {@link TrackedTask} associated with the given Mylyn task. If
* no such task exists it will be created.
*
* @param task
* the Mylyn task
* @return a {@link TrackedTask} associated with the Mylyn task
*/
public TrackedTask getTask(ITask task) {
// this may happen if the UI asks for task details before the database is ready
if (entityManager == null) {
return null;
}
TrackedTaskId id = new TrackedTaskId(TrackedTask.getRepositoryUrl(task), task.getTaskId());
TrackedTask found = entityManager.find(TrackedTask.class, id);
if (found == null) {
// no such tracked task exists, create one
TrackedTask tt = new TrackedTask(task);
entityManager.persist(tt);
return tt;
} else {
return found;
}
}
开发者ID:turesheim,项目名称:eclipse-timekeeper,代码行数:25,代码来源:TimekeeperPlugin.java
示例16: 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);
}
开发者ID:turesheim,项目名称:eclipse-timekeeper,代码行数:27,代码来源:TrackedTask.java
示例17: setTask
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
/**
* Associates given Mylyn Task with this instance.
*
* @param task
* the Mylyn task
*/
void setTask(ITask task) {
// associate this tracked task with the Mylyn task
this.task = task;
taskId = task.getTaskId();
repositoryUrl = getRepositoryUrl(task);
// we have an old fashioned value here. migrate the old data
if (task.getAttribute(TimekeeperPlugin.KEY_VALUELIST_ID) != null) {
try {
migrate();
} catch (Exception e) {
e.printStackTrace();
}
}
}
开发者ID:turesheim,项目名称:eclipse-timekeeper,代码行数:22,代码来源:TrackedTask.java
示例18: getRepositoryUrl
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
/**
* This method will return the repository URL for tasks in repositories that
* are not local. If the task is in a local repository, the Timekeeper
* repository identifier is returned if it exists. If it does not exist, it
* will be created, associated with the repository and returned.
*
* @param task
* the task to get the repository URL for
* @return the repository URL or {@link UUID}
*/
public static String getRepositoryUrl(ITask task) {
String url = task.getRepositoryUrl();
if (LOCAL_REPO_ID.equals(task.getRepositoryUrl())){
IRepositoryManager repositoryManager = TasksUi.getRepositoryManager();
if (repositoryManager == null) { // may happen during testing
return LOCAL_REPO_ID;
}
TaskRepository repository = repositoryManager.getRepository(task.getConnectorKind(), task.getRepositoryUrl());
String id = repository.getProperty(LOCAL_REPO_KEY_ID);
if (id == null) {
id = LOCAL_REPO_ID+"-"+UUID.randomUUID().toString();
repository.setProperty(LOCAL_REPO_KEY_ID, id);
}
url = id;
}
return url;
}
开发者ID:turesheim,项目名称:eclipse-timekeeper,代码行数:28,代码来源:TrackedTask.java
示例19: accumulateTime
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
synchronized static void accumulateTime(ITask task, String dateString, long millis) {
millis = millis + remainder;
long seconds = millis / 1000;
remainder = millis - (seconds * 1000);
if (seconds == 0) {
return;
}
String accumulatedString = getValue(task, dateString);
if (accumulatedString != null) {
long accumulated = Long.parseLong(accumulatedString);
accumulated = accumulated + seconds;
setValue(task, dateString, Long.toString(accumulated));
} else {
setValue(task, dateString, Long.toString(seconds));
}
}
开发者ID:turesheim,项目名称:eclipse-timekeeper,代码行数:17,代码来源:SharedStorageTest.java
示例20: getValue
import org.eclipse.mylyn.tasks.core.ITask; //导入依赖的package包/类
/**
*
* @param task
* @param key date "start" or "tick"
* @return
*/
public static String getValue(ITask task, String key) {
String attribute = task.getAttribute(KEY_VALUELIST_ID);
if (attribute == null) {
return null;
} else {
String[] split = attribute.split(PAIR_SEPARATOR);
for (String string : split) {
if (string.length() > 0) {
String[] kv = string.split(KV_SEPARATOR);
if (kv[0].equals(key)) {
return kv[1];
}
}
}
}
return null;
}
开发者ID:turesheim,项目名称:eclipse-timekeeper,代码行数:24,代码来源:SharedStorageTest.java
注:本文中的org.eclipse.mylyn.tasks.core.ITask类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论