当前位置: 首页>>代码示例>>Java>>正文


Java AbstractTask类代码示例

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


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

示例1: createSubtask

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

示例2: initializeTask

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

示例3: markTaskSeen

import org.eclipse.mylyn.internal.tasks.core.AbstractTask; //导入依赖的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: createSaveJob

import org.eclipse.mylyn.internal.tasks.core.AbstractTask; //导入依赖的package包/类
private void createSaveJob() {
	saveDatabaseJob = new Job("Saving Timekeeper database") {

		@Override
		protected IStatus run(IProgressMonitor monitor) {
			if (entityManager != null && entityManager.isOpen()) {
				Collection<AbstractTask> allTasks = TasksUiPlugin.getTaskList().getAllTasks();
				EntityTransaction transaction = entityManager.getTransaction();
				transaction.begin();
				for (AbstractTask abstractTask : allTasks) {
					TrackedTask task = getTask(abstractTask);
					entityManager.persist(task);
				}
				transaction.commit();
				return Status.OK_STATUS;
			} else {
				return new Status(IStatus.ERROR, BUNDLE_ID, "Cannot persist data – no database connection.");
			}
		}

	};
}
 
开发者ID:turesheim,项目名称:eclipse-timekeeper,代码行数:23,代码来源:TimekeeperPlugin.java

示例5: createTask

import org.eclipse.mylyn.internal.tasks.core.AbstractTask; //导入依赖的package包/类
/**
 * Creates an unsubmitted task that's to be populated and submitted later.
 * The task is local until submitted and kept in the tasklist under
 * "Unsubmitted" category.
 *
 * @param taskRepository repository the task will be submitted to later.
 * @param initializingData default data (such as product/component) to
 * preset in the new task's data
 * @return the newly created task.
 * @throws CoreException tasklist or task data storage is inaccessible
 */
public NbTask createTask (TaskRepository taskRepository, ITaskMapping initializingData) throws CoreException {
    ensureTaskListLoaded();
    AbstractTask task = createNewTask(taskRepository);
    AbstractRepositoryConnector repositoryConnector = taskRepositoryManager.getRepositoryConnector(taskRepository.getConnectorKind());
    AbstractTaskDataHandler taskDataHandler = taskRepository == localTaskRepository
            ? new LocalTaskDataHandler(taskRepository)
            : repositoryConnector.getTaskDataHandler();
    TaskAttributeMapper attributeMapper = taskDataHandler.getAttributeMapper(taskRepository);
    TaskData taskData = new TaskData(attributeMapper, repositoryConnector.getConnectorKind(), taskRepository.getRepositoryUrl(), "");
    taskDataHandler.initializeTaskData(taskRepository, taskData, initializingData, new NullProgressMonitor());
    initializeTask(repositoryConnector, taskData, task, taskRepository);
    return MylynSupport.getInstance().toNbTask(task);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:MylynSupport.java

示例6: createNewTask

import org.eclipse.mylyn.internal.tasks.core.AbstractTask; //导入依赖的package包/类
private AbstractTask createNewTask (TaskRepository taskRepository) {
    AbstractTask task = new LocalTask(String.valueOf(taskList.getNextLocalTaskId()), Bundle.MSG_NewTaskSummary());
    if (taskRepository != localTaskRepository) {
        task.setSynchronizationState(ITask.SynchronizationState.OUTGOING_NEW);
        task.setAttribute(ITasksCoreConstants.ATTRIBUTE_OUTGOING_NEW_CONNECTOR_KIND, taskRepository.getConnectorKind());
        task.setAttribute(ITasksCoreConstants.ATTRIBUTE_OUTGOING_NEW_REPOSITORY_URL, taskRepository.getUrl());
    }
    return task;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:MylynSupport.java

示例7: getOrCreateTask

import org.eclipse.mylyn.internal.tasks.core.AbstractTask; //导入依赖的package包/类
NbTask getOrCreateTask (TaskRepository taskRepository, String taskId, boolean addToTaskList) throws CoreException {
    ensureTaskListLoaded();
    ITask task = taskList.getTask(taskRepository.getUrl(), taskId);
    if (task == null) {
        task = repositoryModel.createTask(taskRepository, taskId);
        ((AbstractTask) task).setSynchronizationState(ITask.SynchronizationState.INCOMING_NEW);
        if (addToTaskList) {
            // ensure the task is in the tasklist
            taskList.addTask(task);
        }
    }
    return toNbTask(task);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:MylynSupport.java

示例8: editorOpened

import org.eclipse.mylyn.internal.tasks.core.AbstractTask; //导入依赖的package包/类
void editorOpened (final ITask task) throws CoreException {
    // mark the task as not read pending to block incoming refreshes
    // from rewriting last seen task data while the editor is open
    // maybe we should follow the mylyn's way of handling incoming updates
    if (task instanceof AbstractTask) {
        taskList.run(new ITaskListRunnable() {
            @Override
            public void execute (IProgressMonitor monitor) throws CoreException {
                ((AbstractTask) task).setMarkReadPending(false);
            }
        }, null, true);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:MylynSupport.java

示例9: editorClosing

import org.eclipse.mylyn.internal.tasks.core.AbstractTask; //导入依赖的package包/类
void editorClosing (final ITask task, final TaskData td) throws CoreException {
    // copy repository task data into last seen data
    if (task instanceof AbstractTask) {
        taskList.run(new ITaskListRunnable() {
            @Override
            public void execute (IProgressMonitor monitor) throws CoreException {
                ((AbstractTask) task).setMarkReadPending(true);
                taskDataManager.putUpdatedTaskData(task, td, true);
            }
        }, null, true);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:MylynSupport.java

示例10: getPrivateNotes

import org.eclipse.mylyn.internal.tasks.core.AbstractTask; //导入依赖的package包/类
public final String getPrivateNotes () {
    if (delegate instanceof AbstractTask) {
        return ((AbstractTask) delegate).getNotes();
    } else {
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:NbTask.java

示例11: getScheduleDate

import org.eclipse.mylyn.internal.tasks.core.AbstractTask; //导入依赖的package包/类
public final NbDateRange getScheduleDate () {
    if (delegate instanceof AbstractTask) {
        DateRange date = ((AbstractTask) delegate).getScheduledForDate();
        return date == null ? null : new NbDateRange(date);
    } else {
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:NbTask.java

示例12: getEstimate

import org.eclipse.mylyn.internal.tasks.core.AbstractTask; //导入依赖的package包/类
public int getEstimate () {
    if (delegate instanceof AbstractTask) {
        return ((AbstractTask) delegate).getEstimatedTimeHours();
    } else {
        return 0;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:NbTask.java

示例13: createTimeColumn

import org.eclipse.mylyn.internal.tasks.core.AbstractTask; //导入依赖的package包/类
/**
 * Creates a table column for the given weekday and installs editing support
 *
 * @param weekday
 *            the day of the week, starting from 0
 */
private void createTimeColumn(int weekday) {
	TreeViewerColumn column = createTableViewerColumn("-", TIME_COLUMN_WIDTH, 1 + weekday);
	column.getColumn().setAlignment(SWT.RIGHT);
	column.setEditingSupport(new TimeEditingSupport((TreeViewer) column.getViewer(), contentProvider, weekday));
	column.setLabelProvider(new TimeColumnLabelProvider(contentProvider) {

		@Override
		public String getText(Object element) {
			// Use modern formatting
			long seconds = 0;
			LocalDate date = contentProvider.getFirstDayOfWeek().plusDays(weekday);
			if (element instanceof String) {
				seconds = getSum(contentProvider.getFiltered(), date, (String) element);
			} else if (element instanceof ITask) {
				AbstractTask task = (AbstractTask) element;
				TrackedTask trackedTask = TimekeeperPlugin.getDefault().getTask(task);
				if (trackedTask != null) {
					seconds = trackedTask.getDuration(contentProvider.getDate(weekday)).getSeconds();
				}
			} else if (element instanceof WeeklySummary) {
				seconds = getSum(contentProvider.getFiltered(), date);
			} else if (element instanceof Activity) {
				seconds = ((Activity) element).getDuration(date).getSeconds();
			}
			if (seconds > 0) {
				return DurationFormatUtils.formatDuration(seconds * 1000, "H:mm", true);
			}
			return "";
		}
	});
}
 
开发者ID:turesheim,项目名称:eclipse-timekeeper,代码行数:38,代码来源:WorkWeekView.java

示例14: getParentContainerSummary

import org.eclipse.mylyn.internal.tasks.core.AbstractTask; //导入依赖的package包/类
/**
 * Returns the name of the container holding the supplied task.
 *
 * @param task
 *            task to find the name for
 * @return the name of the task
 */
private static String getParentContainerSummary(AbstractTask task) {
	if (task.getParentContainers().size() > 0) {
		AbstractTaskContainer next = task.getParentContainers().iterator().next();
		return next.getSummary();
	}
	return null;
}
 
开发者ID:turesheim,项目名称:eclipse-timekeeper,代码行数:15,代码来源:TimekeeperUiPlugin.java

示例15: getProjectName

import org.eclipse.mylyn.internal.tasks.core.AbstractTask; //导入依赖的package包/类
/**
 * Returns the project name for the task if it can be determined.
 *
 * @param task
 *            the task to get the project name for
 * @return the project name or "&lt;undetermined&gt;"
 */
public static String getProjectName(ITask task) {
	String c = task.getConnectorKind();
	try {
		switch (c) {
		case KIND_GITHUB:
		case KIND_LOCAL:
			return getParentContainerSummary((AbstractTask) task);
			// Bugzilla and JIRA users may want to group on different
			// values.
		case KIND_BUGZILLA:
		case KIND_JIRA:
			TaskData taskData = TasksUi.getTaskDataManager().getTaskData(task);
			if (taskData != null) {
				// This appears to be a pretty slow mechanism
				TaskRepository taskRepository = taskData.getAttributeMapper().getTaskRepository();
				String groupingAttribute = taskRepository.getProperty(ATTR_GROUPING);
				// Use custom grouping if specified
				if (groupingAttribute != null) {
					TaskAttribute attribute = taskData.getRoot().getAttribute(groupingAttribute);
					return attribute.getValue();
				} else {
					if (c.equals(KIND_BUGZILLA)) {
						return task.getAttribute("product"); //$NON-NLS-1$
					}
					return getParentContainerSummary((AbstractTask) task);
				}
			}
		default:
			break;
		}
	} catch (CoreException e) {
		e.printStackTrace();
	}
	return "<undetermined>";
}
 
开发者ID:turesheim,项目名称:eclipse-timekeeper,代码行数:43,代码来源:TimekeeperUiPlugin.java


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