|
Lines 26-31
Link Here
|
| 26 |
import org.eclipse.mylyn.tasks.core.TaskRepository; |
26 |
import org.eclipse.mylyn.tasks.core.TaskRepository; |
| 27 |
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; |
27 |
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; |
| 28 |
import org.eclipse.swt.SWT; |
28 |
import org.eclipse.swt.SWT; |
|
|
29 |
import org.eclipse.swt.events.KeyEvent; |
| 30 |
import org.eclipse.swt.events.KeyListener; |
| 29 |
import org.eclipse.swt.widgets.Composite; |
31 |
import org.eclipse.swt.widgets.Composite; |
| 30 |
import org.eclipse.swt.widgets.Display; |
32 |
import org.eclipse.swt.widgets.Display; |
| 31 |
import org.eclipse.swt.widgets.Menu; |
33 |
import org.eclipse.swt.widgets.Menu; |
|
Lines 34-39
Link Here
|
| 34 |
import org.eclipse.ui.IWorkbenchActionConstants; |
36 |
import org.eclipse.ui.IWorkbenchActionConstants; |
| 35 |
import org.eclipse.ui.IWorkbenchPage; |
37 |
import org.eclipse.ui.IWorkbenchPage; |
| 36 |
import org.eclipse.ui.PlatformUI; |
38 |
import org.eclipse.ui.PlatformUI; |
|
|
39 |
import org.eclipse.ui.actions.ActionFactory; |
| 37 |
import org.eclipse.ui.actions.BaseSelectionListenerAction; |
40 |
import org.eclipse.ui.actions.BaseSelectionListenerAction; |
| 38 |
import org.eclipse.ui.part.ViewPart; |
41 |
import org.eclipse.ui.part.ViewPart; |
| 39 |
|
42 |
|
|
Lines 171-184
Link Here
|
| 171 |
} |
174 |
} |
| 172 |
}); |
175 |
}); |
| 173 |
|
176 |
|
|
|
177 |
getViewer().getTable().addKeyListener(new KeyListener() { |
| 178 |
|
| 179 |
public void keyPressed(KeyEvent e) { |
| 180 |
// ignore |
| 181 |
if (e.keyCode == SWT.DEL && e.stateMask == 0 && |
| 182 |
deleteRepositoryAction.isEnabled()) { |
| 183 |
deleteRepositoryAction.run(); |
| 184 |
// } else if (e.keyCode == SWT.INSERT) { |
| 185 |
// addRepositoryAction.run(); |
| 186 |
// } else if (e.keyCode == '+' && e.stateMask == SWT.MOD1) { |
| 187 |
// addRepositoryAction.run(); |
| 188 |
// } else if (e.keyCode == SWT.ESC && e.stateMask == 0 && |
| 189 |
// offlineAction.isEnabled()) { |
| 190 |
// offlineAction.run(); |
| 191 |
// refresh(); |
| 192 |
} else if (e.keyCode == SWT.F5 && e.stateMask == 0 && |
| 193 |
resetConfigurationAction.isEnabled()) { |
| 194 |
resetConfigurationAction.run(); |
| 195 |
} |
| 196 |
} |
| 197 |
|
| 198 |
public void keyReleased(KeyEvent e) { |
| 199 |
// ignore |
| 200 |
|
| 201 |
} |
| 202 |
|
| 203 |
|
| 204 |
}); |
| 205 |
|
| 206 |
|
| 174 |
TasksUiPlugin.getRepositoryManager().addListener(new TaskRepositoryListener()); |
207 |
TasksUiPlugin.getRepositoryManager().addListener(new TaskRepositoryListener()); |
| 175 |
|
208 |
|
| 176 |
makeActions(); |
209 |
makeActions(); |
| 177 |
hookContextMenu(); |
210 |
hookContextMenu(); |
|
|
211 |
hookGlobalActions(); |
| 178 |
contributeToActionBars(); |
212 |
contributeToActionBars(); |
| 179 |
getSite().setSelectionProvider(getViewer()); |
213 |
getSite().setSelectionProvider(getViewer()); |
| 180 |
} |
214 |
} |
| 181 |
|
215 |
|
|
|
216 |
private void hookGlobalActions() { |
| 217 |
IActionBars bars = getViewSite().getActionBars(); |
| 218 |
bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteRepositoryAction); |
| 219 |
bars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), resetConfigurationAction); |
| 220 |
} |
| 221 |
|
| 182 |
private void makeActions() { |
222 |
private void makeActions() { |
| 183 |
deleteRepositoryAction = new DeleteTaskRepositoryAction(); |
223 |
deleteRepositoryAction = new DeleteTaskRepositoryAction(); |
| 184 |
viewer.addSelectionChangedListener(deleteRepositoryAction); |
224 |
viewer.addSelectionChangedListener(deleteRepositoryAction); |