Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 165809 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoriesView.java (+31 lines)
Lines 55-60 Link Here
55
	private BaseSelectionListenerAction repositoryPropertiesAction;
55
	private BaseSelectionListenerAction repositoryPropertiesAction;
56
56
57
	private BaseSelectionListenerAction resetConfigurationAction;
57
	private BaseSelectionListenerAction resetConfigurationAction;
58
	
59
	private RepositoryOfflineAction offlineAction;
58
60
59
	private final ITaskRepositoryListener REPOSITORY_LISTENER = new ITaskRepositoryListener() {
61
	private final ITaskRepositoryListener REPOSITORY_LISTENER = new ITaskRepositoryListener() {
60
62
Lines 142-147 Link Here
142
			}
144
			}
143
		});
145
		});
144
146
147
		TasksUiPlugin.getRepositoryManager().addListener(new TaskRepositoryListener());
148
		
145
		makeActions();
149
		makeActions();
146
		hookContextMenu();
150
		hookContextMenu();
147
		contributeToActionBars();
151
		contributeToActionBars();
Lines 157-162 Link Here
157
		
161
		
158
		resetConfigurationAction = new ResetRepositoryConfigurationAction();
162
		resetConfigurationAction = new ResetRepositoryConfigurationAction();
159
		viewer.addSelectionChangedListener(resetConfigurationAction);
163
		viewer.addSelectionChangedListener(resetConfigurationAction);
164
		
165
		offlineAction = new RepositoryOfflineAction();
166
		viewer.addSelectionChangedListener(offlineAction);
160
	}
167
	}
161
168
162
	private void hookContextMenu() {
169
	private void hookContextMenu() {
Lines 187-192 Link Here
187
		manager.add(new Separator());
194
		manager.add(new Separator());
188
		manager.add(deleteRepositoryAction);
195
		manager.add(deleteRepositoryAction);
189
		manager.add(resetConfigurationAction);
196
		manager.add(resetConfigurationAction);
197
		manager.add(new Separator());
198
		manager.add(offlineAction);
190
		manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
199
		manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
191
		manager.add(new Separator());
200
		manager.add(new Separator());
192
		manager.add(repositoryPropertiesAction);
201
		manager.add(repositoryPropertiesAction);
Lines 214-218 Link Here
214
		return viewer;
223
		return viewer;
215
	}
224
	}
216
225
226
	public class TaskRepositoryListener implements ITaskRepositoryListener {
227
228
		public void repositoriesRead() {
229
		}
230
231
		public void repositoryAdded(TaskRepository repository) {
232
		}
233
234
		public void repositoryRemoved(TaskRepository repository) {
235
		}
236
237
		public void repositorySettingsChanged(TaskRepository repository) {
238
			PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
239
				public void run() {
240
					if (!getViewer().getControl().isDisposed()) {
241
						getViewer().refresh(true);
242
					}
243
				}
244
			});			
245
		}
246
247
	}
217
	
248
	
218
}
249
}
(-)src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoryLabelProvider.java (-1 / +5 lines)
Lines 44-50 Link Here
44
				return TasksUiImages.getImage(TasksUiImages.REPOSITORY);
44
				return TasksUiImages.getImage(TasksUiImages.REPOSITORY);
45
			}
45
			}
46
		} else if (object instanceof TaskRepository) {
46
		} else if (object instanceof TaskRepository) {
47
			return TasksUiImages.getImage(TasksUiImages.REPOSITORY);
47
			if (((TaskRepository)object).isOffline()) {
48
				return TasksUiImages.getImageWithOverlay(TasksUiImages.REPOSITORY, TasksUiImages.OVERLAY_OFFLINE, true, false);
49
			} else {
50
				return TasksUiImages.getImage(TasksUiImages.REPOSITORY);
51
			}
48
		}
52
		}
49
		return null;
53
		return null;
50
	}
54
	}
(-)src/org/eclipse/mylyn/internal/tasks/ui/ScheduledTaskListSynchJob.java (+5 lines)
Lines 78-83 Link Here
78
					scheduleDelay = -1;
78
					scheduleDelay = -1;
79
					throw new OperationCanceledException();
79
					throw new OperationCanceledException();
80
				}
80
				}
81
				
82
				if (repository.isOffline()) {
83
					continue;
84
				}
85
				
81
				final AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager()
86
				final AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager()
82
						.getRepositoryConnector(repository.getKind());
87
						.getRepositoryConnector(repository.getKind());
83
				if (connector == null) {
88
				if (connector == null) {
(-)src/org/eclipse/mylyn/internal/tasks/ui/TasksUiImages.java (+2 lines)
Lines 111-116 Link Here
111
111
112
	public static final ImageDescriptor OVERLAY_WEB = create(T_TOOL, "overlay-web.gif");
112
	public static final ImageDescriptor OVERLAY_WEB = create(T_TOOL, "overlay-web.gif");
113
113
114
	public static final ImageDescriptor OVERLAY_OFFLINE = create(T_EVIEW, "overlay-offline.gif");
115
114
	public static final ImageDescriptor BROWSER_SMALL = create(T_OBJ, "browser-small.gif");
116
	public static final ImageDescriptor BROWSER_SMALL = create(T_OBJ, "browser-small.gif");
115
117
116
	public static final ImageDescriptor BROWSER_OPEN_TASK = create(T_TOOL, "open-browser.gif");
118
	public static final ImageDescriptor BROWSER_OPEN_TASK = create(T_TOOL, "open-browser.gif");
(-)src/org/eclipse/mylyn/internal/tasks/ui/views/RepositoryOfflineAction.java (+74 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004 - 2006 Mylar committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.internal.tasks.ui.views;
10
11
import java.util.Iterator;
12
13
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.core.runtime.IProgressMonitor;
15
import org.eclipse.core.runtime.IStatus;
16
import org.eclipse.core.runtime.Status;
17
import org.eclipse.core.runtime.jobs.Job;
18
import org.eclipse.jface.action.Action;
19
import org.eclipse.jface.action.IAction;
20
import org.eclipse.jface.viewers.ISelection;
21
import org.eclipse.jface.viewers.ISelectionChangedListener;
22
import org.eclipse.jface.viewers.IStructuredSelection;
23
import org.eclipse.jface.viewers.SelectionChangedEvent;
24
import org.eclipse.jface.viewers.StructuredSelection;
25
import org.eclipse.mylyn.internal.monitor.core.util.StatusManager;
26
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
27
import org.eclipse.mylyn.tasks.core.TaskRepository;
28
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
29
30
/**
31
 * @author Steffen Pingel
32
 */
33
public class RepositoryOfflineAction extends Action implements ISelectionChangedListener {
34
35
	private static final String ID = "org.eclipse.mylyn.tasklist.repositories.offline";
36
	
37
	private TaskRepository repository;
38
39
	public RepositoryOfflineAction() {
40
		super("Offline", Action.AS_CHECK_BOX);
41
		setId(ID);
42
		setEnabled(false);
43
	}
44
45
	@Override
46
	public void run() {
47
		repository.setOffline(isChecked());
48
		TasksUiPlugin.getRepositoryManager().notifyRepositorySettingsChagned(repository);
49
	}
50
51
	public void selectionChanged(IAction action, ISelection selection) {
52
	}
53
54
	public void selectionChanged(SelectionChangedEvent event) {
55
		ISelection selection = event.getSelection();
56
		if (selection instanceof IStructuredSelection) {
57
			Object selectedObject = ((IStructuredSelection)selection).getFirstElement();
58
			if (selectedObject instanceof TaskRepository) {
59
				AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
60
						((TaskRepository) selectedObject).getKind());
61
				if (connector.isUserManaged()) {
62
					this.repository = (TaskRepository) selectedObject;
63
					setChecked(this.repository.isOffline());
64
					setEnabled(true);
65
					return;
66
				}
67
			}
68
		}
69
		this.repository = null;
70
		setChecked(false);
71
		setEnabled(false);
72
	}
73
74
}
(-)src/org/eclipse/mylyn/tasks/core/TaskRepository.java (+11 lines)
Lines 74-79 Link Here
74
	public static final String PROXY_USERNAME = "org.eclipse.mylyn.tasklist.repositories.proxy.username";
74
	public static final String PROXY_USERNAME = "org.eclipse.mylyn.tasklist.repositories.proxy.username";
75
75
76
	public static final String PROXY_PASSWORD = "org.eclipse.mylyn.tasklist.repositories.proxy.password";
76
	public static final String PROXY_PASSWORD = "org.eclipse.mylyn.tasklist.repositories.proxy.password";
77
	
78
	public static final String OFFLINE = "org.eclipse.mylyn.tasklist.repositories.offline";
77
79
78
	// HACK: Lock used to work around race condition in
80
	// HACK: Lock used to work around race condition in
79
	// Platform.add/get/flushAuthorizationInfo()
81
	// Platform.add/get/flushAuthorizationInfo()
Lines 461-464 Link Here
461
	public void setBugRepository(boolean isBugRepository) {
463
	public void setBugRepository(boolean isBugRepository) {
462
		this.isBugRepository = isBugRepository;
464
		this.isBugRepository = isBugRepository;
463
	}
465
	}
466
	
467
	public void setOffline(boolean offline) {
468
		properties.put(OFFLINE, String.valueOf(offline));
469
	}
470
471
	public boolean isOffline() {
472
		return getProperty(OFFLINE) != null && "true".equals(getProperty(OFFLINE));
473
	}
474
464
}
475
}

Return to bug 165809