diff options
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal')
3 files changed, 18 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java index e1fd95485..29503c64d 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java @@ -26,6 +26,7 @@ import org.eclipse.mylyn.commons.workbench.forms.DatePicker; import org.eclipse.mylyn.commons.workbench.forms.DateSelectionDialog; import org.eclipse.mylyn.internal.tasks.core.AbstractTask; import org.eclipse.mylyn.internal.tasks.core.DateRange; +import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants; import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil; import org.eclipse.mylyn.internal.tasks.core.WeekDateRange; import org.eclipse.mylyn.tasks.core.IRepositoryElement; @@ -52,6 +53,12 @@ public class ScheduleTaskMenuContributor implements IDynamicSubMenuContributor { IRepositoryElement selectedElement = selectedElements.get(0); if (selectedElement instanceof ITask) { singleTaskSelection = (AbstractTask) selectedElement; + + // Tasks artifacts are not able to be scheduled; we'll simply mark them as not supported here + String artifactFlag = singleTaskSelection.getAttribute(ITasksCoreConstants.ATTRIBUTE_ARTIFACT); + if (Boolean.valueOf(artifactFlag)) { + return null; + } } } @@ -206,8 +213,7 @@ public class ScheduleTaskMenuContributor implements IDynamicSubMenuContributor { } private boolean isThisWeek(AbstractTask task) { - return task != null && task.getScheduledForDate() != null - && task.getScheduledForDate() instanceof WeekDateRange + return task != null && task.getScheduledForDate() != null && task.getScheduledForDate() instanceof WeekDateRange && task.getScheduledForDate().isBefore(TaskActivityUtil.getCurrentWeek()); } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RepositoryElementActionGroup.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RepositoryElementActionGroup.java index c81f8b4ff..dd54305b4 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RepositoryElementActionGroup.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RepositoryElementActionGroup.java @@ -265,7 +265,8 @@ public class RepositoryElementActionGroup { for (final IDynamicSubMenuContributor contributor : dynamicMenuMap.get(menuPath)) { SafeRunnable.run(new ISafeRunnable() { public void handleException(Throwable e) { - StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Menu contributor failed")); //$NON-NLS-1$ + StatusHandler + .log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Menu contributor failed")); //$NON-NLS-1$ } public void run() throws Exception { @@ -306,8 +307,8 @@ public class RepositoryElementActionGroup { if (container instanceof TaskCategory) { hasCategory = true; } - if (container instanceof UncategorizedTaskContainer - && !LocalRepositoryConnector.CONNECTOR_KIND.equals(((AbstractTask) element).getConnectorKind())) { + if (container instanceof UncategorizedTaskContainer && !LocalRepositoryConnector.CONNECTOR_KIND + .equals(((AbstractTask) element).getConnectorKind())) { hasCategory = true; } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskPropertyTester.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskPropertyTester.java index 5a5f9c775..7138d4fb4 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskPropertyTester.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskPropertyTester.java @@ -13,6 +13,7 @@ package org.eclipse.mylyn.internal.tasks.ui.util; import org.eclipse.core.expressions.PropertyTester; import org.eclipse.mylyn.internal.tasks.core.AbstractTask; +import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants; import org.eclipse.mylyn.internal.tasks.ui.actions.ClearOutgoingAction; import org.eclipse.mylyn.tasks.core.ITask; @@ -43,6 +44,8 @@ public class TaskPropertyTester extends PropertyTester { private static final String PROPERTY_LOCAL_COMPLETION_STATE = "hasLocalCompletionState"; //$NON-NLS-1$ + private static final String PROPERTY_IS_ARTIFACT = "isArtifact"; //$NON-NLS-1$ + private boolean equals(boolean value, Object expectedValue) { return new Boolean(value).equals(expectedValue); } @@ -73,6 +76,9 @@ public class TaskPropertyTester extends PropertyTester { return (task instanceof AbstractTask) && equals(((AbstractTask) task).isLocal(), expectedValue); } else if (PROPERTY_LOCAL_COMPLETION_STATE.equals(property)) { return equals(TasksUiInternal.hasLocalCompletionState(task), expectedValue); + } else if (PROPERTY_IS_ARTIFACT.equals(property)) { + String artifactFlag = task.getAttribute(ITasksCoreConstants.ATTRIBUTE_ARTIFACT); + return Boolean.valueOf(artifactFlag); } } return false; |