blob: 8a9d3def9d5e3b7cafe5ed24d0912c31cc63af9e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/*******************************************************************************
* Copyright (c) 2004 - 2006 Mylar committers and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.mylar.internal.tasks.ui.actions;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
import org.eclipse.ui.actions.BaseSelectionListenerAction;
/**
* @author Shawn Minto
*/
public abstract class AbstractTaskRepositoryAction extends BaseSelectionListenerAction {
public AbstractTaskRepositoryAction(String text) {
super(text);
}
@Override
protected boolean updateSelection(IStructuredSelection selection) {
if (selection != null && !selection.isEmpty()) {
Object selectedObject = selection.getFirstElement();
if (selectedObject instanceof TaskRepository) {
TaskRepository taskRepository = (TaskRepository) selectedObject;
AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
taskRepository.getKind());
if (connector.isUserManaged()) {
return true;
}
return false;
}
}
return false;
}
}
|