Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-10-18 23:26:26 +0000
committerspingel2010-10-18 23:26:26 +0000
commit2a781f966d4a4803783f87dc1eb799574b8d363f (patch)
tree3eb54150f8cf79f607a038157f36d85b46e1d6e7
parent294f0e3a8da2f9171e195e2469fcc8905e8d914b (diff)
downloadorg.eclipse.mylyn.tasks-2a781f966d4a4803783f87dc1eb799574b8d363f.tar.gz
org.eclipse.mylyn.tasks-2a781f966d4a4803783f87dc1eb799574b8d363f.tar.xz
org.eclipse.mylyn.tasks-2a781f966d4a4803783f87dc1eb799574b8d363f.zip
NEW - bug 316835: [api] add a flag to TaskRepository to track if it was added automatically
https://bugs.eclipse.org/bugs/show_bug.cgi?id=316835
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java26
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java35
2 files changed, 45 insertions, 16 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
index 682f4325d..7d11b0455 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
@@ -153,6 +153,8 @@ public final class TaskRepository extends PlatformObject {
// HACK: private credentials for headless operation
private static Map<String, Map<String, String>> credentials = new HashMap<String, Map<String, String>>();
+ private static String CREATED_FROM_TEMPLATE = "org.eclipse.mylyn.tasklist.repositories.template"; //$NON-NLS-1$
+
static {
URL url = null;
try {
@@ -292,7 +294,7 @@ public final class TaskRepository extends PlatformObject {
}
}
- @SuppressWarnings( { "unchecked" })
+ @SuppressWarnings({ "unchecked" })
private Map<String, String> getAuthInfo() {
synchronized (LOCK) {
if (Platform.isRunning()) {
@@ -676,7 +678,7 @@ public final class TaskRepository extends PlatformObject {
}
/**
- * Use platform proxy settings
+ * Returns true, if platform proxy settings should be used.
*/
public boolean isDefaultProxyEnabled() {
return "true".equals(getProperty(PROXY_USEDEFAULT)); //$NON-NLS-1$
@@ -909,4 +911,24 @@ public final class TaskRepository extends PlatformObject {
setProperty(TaskRepository.PROXY_USEDEFAULT, String.valueOf(useDefaultProxy));
}
+ /**
+ * If this repository was automatically created from a template <code>value</code> should be set to true.
+ *
+ * @since 3.5
+ * @see #isCreatedFromTemplate()
+ */
+ public void setCreatedFromTemplate(boolean value) {
+ setProperty(TaskRepository.CREATED_FROM_TEMPLATE, String.valueOf(value));
+ }
+
+ /**
+ * Returns true, if this repository was automatically created from a template.
+ *
+ * @since 3.5
+ * @see #setCreatedFromTemplate(boolean)
+ */
+ public boolean isCreatedFromTemplate() {
+ return "true".equals(getProperty(CREATED_FROM_TEMPLATE)); //$NON-NLS-1$
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
index 23f46de15..2be01daa3 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
@@ -72,8 +72,8 @@ import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta;
-import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta.Type;
+import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataStore;
import org.eclipse.mylyn.internal.tasks.core.externalization.ExternalizationManager;
@@ -91,12 +91,12 @@ import org.eclipse.mylyn.tasks.core.AbstractDuplicateDetector;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
import org.eclipse.mylyn.tasks.core.ITaskActivationListener;
import org.eclipse.mylyn.tasks.core.ITaskContainer;
import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
import org.eclipse.mylyn.tasks.core.TaskActivationAdapter;
import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.AbstractTaskRepositoryLinkProvider;
import org.eclipse.mylyn.tasks.ui.TasksUi;
@@ -511,11 +511,13 @@ public class TasksUiPlugin extends AbstractUIPlugin {
return;
}
- boolean enabled = TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED);
+ boolean enabled = TasksUiPlugin.getDefault()
+ .getPreferenceStore()
+ .getBoolean(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED);
if (enabled) {
- long interval = TasksUiPlugin.getDefault().getPreferenceStore().getLong(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS);
+ long interval = TasksUiPlugin.getDefault()
+ .getPreferenceStore()
+ .getLong(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS);
if (initial) {
synchronizationScheduler.setInterval(DELAY_QUERY_REFRESH_ON_STARTUP, interval);
} else {
@@ -723,6 +725,7 @@ public class TasksUiPlugin extends AbstractUIPlugin {
if (template.anonymous) {
taskRepository.setCredentials(AuthenticationType.REPOSITORY, null, true);
}
+ taskRepository.setCreatedFromTemplate(true);
repositoryManager.addRepository(taskRepository);
repositoryManager.applyMigrators(taskRepository);
}
@@ -889,15 +892,18 @@ public class TasksUiPlugin extends AbstractUIPlugin {
}
}
- if (!MonitorUiPlugin.getDefault().getPreferenceStore().getBoolean(
- MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked")) { //$NON-NLS-1$
+ if (!MonitorUiPlugin.getDefault()
+ .getPreferenceStore()
+ .getBoolean(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked")) { //$NON-NLS-1$
if (!taskActivityMonitor.getActivationHistory().isEmpty()) {
// tasks have been active before so fore preference enabled
- MonitorUiPlugin.getDefault().getPreferenceStore().setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED,
- true);
+ MonitorUiPlugin.getDefault()
+ .getPreferenceStore()
+ .setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED, true);
}
- MonitorUiPlugin.getDefault().getPreferenceStore().setValue(
- MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked", true); //$NON-NLS-1$
+ MonitorUiPlugin.getDefault()
+ .getPreferenceStore()
+ .setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked", true); //$NON-NLS-1$
MonitorUiPlugin.getDefault().savePluginPreferences();
}
@@ -977,8 +983,9 @@ public class TasksUiPlugin extends AbstractUIPlugin {
}
public boolean groupSubtasks(ITaskContainer element) {
- boolean groupSubtasks = TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.GROUP_SUBTASKS);
+ boolean groupSubtasks = TasksUiPlugin.getDefault()
+ .getPreferenceStore()
+ .getBoolean(ITasksUiPreferenceConstants.GROUP_SUBTASKS);
if (element instanceof ITask) {
AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(((ITask) element).getConnectorKind());

Back to the top