|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2005, 2007 IBM Corporation and others. |
2 |
* Copyright (c) 2005, 2008 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 16-22
Link Here
|
| 16 |
import java.util.ArrayList; |
16 |
import java.util.ArrayList; |
| 17 |
import java.util.Iterator; |
17 |
import java.util.Iterator; |
| 18 |
import java.util.List; |
18 |
import java.util.List; |
| 19 |
import java.util.Set; |
|
|
| 20 |
|
19 |
|
| 21 |
import org.eclipse.core.resources.IFile; |
20 |
import org.eclipse.core.resources.IFile; |
| 22 |
import org.eclipse.core.resources.IProject; |
21 |
import org.eclipse.core.resources.IProject; |
|
Lines 25-31
Link Here
|
| 25 |
import org.eclipse.core.runtime.Platform; |
24 |
import org.eclipse.core.runtime.Platform; |
| 26 |
import org.eclipse.emf.ecore.EObject; |
25 |
import org.eclipse.emf.ecore.EObject; |
| 27 |
import org.eclipse.hyades.test.ui.TestUIImages; |
26 |
import org.eclipse.hyades.test.ui.TestUIImages; |
| 28 |
import org.eclipse.hyades.test.ui.internal.model.ui.RemoveChildrenAction; |
|
|
| 29 |
import org.eclipse.hyades.test.ui.internal.navigator.TestNavigator; |
27 |
import org.eclipse.hyades.test.ui.internal.navigator.TestNavigator; |
| 30 |
import org.eclipse.hyades.test.ui.internal.navigator.TestNavigatorMessages; |
28 |
import org.eclipse.hyades.test.ui.internal.navigator.TestNavigatorMessages; |
| 31 |
import org.eclipse.hyades.test.ui.internal.resources.UiPluginResourceBundle; |
29 |
import org.eclipse.hyades.test.ui.internal.resources.UiPluginResourceBundle; |
|
Lines 60-66
Link Here
|
| 60 |
import org.eclipse.ui.actions.AddBookmarkAction; |
58 |
import org.eclipse.ui.actions.AddBookmarkAction; |
| 61 |
import org.eclipse.ui.actions.AddTaskAction; |
59 |
import org.eclipse.ui.actions.AddTaskAction; |
| 62 |
import org.eclipse.ui.actions.CloseResourceAction; |
60 |
import org.eclipse.ui.actions.CloseResourceAction; |
| 63 |
import org.eclipse.ui.actions.DeleteResourceAction; |
|
|
| 64 |
import org.eclipse.ui.actions.OpenResourceAction; |
61 |
import org.eclipse.ui.actions.OpenResourceAction; |
| 65 |
import org.eclipse.ui.actions.RefreshAction; |
62 |
import org.eclipse.ui.actions.RefreshAction; |
| 66 |
import org.eclipse.ui.actions.WorkingSetFilterActionGroup; |
63 |
import org.eclipse.ui.actions.WorkingSetFilterActionGroup; |
|
Lines 96-103
Link Here
|
| 96 |
protected CloseResourceAction closeProjectAction; |
93 |
protected CloseResourceAction closeProjectAction; |
| 97 |
protected StopAction stopAction; |
94 |
protected StopAction stopAction; |
| 98 |
|
95 |
|
| 99 |
protected DeleteResourceAction deleteResourceAction; |
96 |
protected DeleteAction deleteAction; |
| 100 |
protected RemoveChildrenAction deleteChildEObject; |
|
|
| 101 |
|
97 |
|
| 102 |
protected NavigatorSorterActionGroup sorterActionGroup; |
98 |
protected NavigatorSorterActionGroup sorterActionGroup; |
| 103 |
protected NewActionGroup newActionGroup; |
99 |
protected NewActionGroup newActionGroup; |
|
Lines 106-111
Link Here
|
| 106 |
protected RenameAction renameAction; |
102 |
protected RenameAction renameAction; |
| 107 |
protected CopyAction copyAction; |
103 |
protected CopyAction copyAction; |
| 108 |
protected PasteAction pasteAction; |
104 |
protected PasteAction pasteAction; |
|
|
105 |
protected MoveAction moveAction; |
| 109 |
protected OpenWithActionGroup openWithActionGroup; |
106 |
protected OpenWithActionGroup openWithActionGroup; |
| 110 |
|
107 |
|
| 111 |
|
108 |
|
|
Lines 133-138
Link Here
|
| 133 |
renameAction.dispose(); |
130 |
renameAction.dispose(); |
| 134 |
stopAction.dispose(); |
131 |
stopAction.dispose(); |
| 135 |
pasteAction.dispose(); |
132 |
pasteAction.dispose(); |
|
|
133 |
moveAction.dispose(); |
| 136 |
if(clipboard != null) { |
134 |
if(clipboard != null) { |
| 137 |
clipboard.dispose(); |
135 |
clipboard.dispose(); |
| 138 |
clipboard = null; |
136 |
clipboard = null; |
|
Lines 186-217
Link Here
|
| 186 |
TestUIImages.INSTANCE.setImageDescriptors(toggleEObjectChildren, TestUIImages.ACT_SHOW_EOBJECT_CHILDREN); |
184 |
TestUIImages.INSTANCE.setImageDescriptors(toggleEObjectChildren, TestUIImages.ACT_SHOW_EOBJECT_CHILDREN); |
| 187 |
|
185 |
|
| 188 |
ISharedImages images = PlatformUI.getWorkbench().getSharedImages(); |
186 |
ISharedImages images = PlatformUI.getWorkbench().getSharedImages(); |
| 189 |
deleteResourceAction = new DeleteResourceAction(shell); |
187 |
deleteAction = new DeleteAction(shell); |
| 190 |
deleteResourceAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED)); |
188 |
deleteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED)); |
| 191 |
deleteResourceAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)); |
189 |
deleteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)); |
| 192 |
deleteResourceAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)); |
190 |
deleteAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)); |
| 193 |
|
|
|
| 194 |
deleteChildEObject = new RemoveChildrenAction(true) |
| 195 |
{ |
| 196 |
protected List saveResources(Set changedResources) |
| 197 |
{ |
| 198 |
TestNavigator testNavigator = (TestNavigator)getNavigator(); |
| 199 |
testNavigator.getTreeViewer().remove(getStructuredSelection().toArray()); |
| 200 |
|
| 201 |
testNavigator.setMonitoringResourceChange(false); |
| 202 |
try |
| 203 |
{ |
| 204 |
return super.saveResources(changedResources); |
| 205 |
} |
| 206 |
finally |
| 207 |
{ |
| 208 |
testNavigator.setMonitoringResourceChange(true); |
| 209 |
} |
| 210 |
} |
| 211 |
}; |
| 212 |
deleteChildEObject.setStructuredViewer(((TestNavigator)getNavigator()).getViewer()); |
| 213 |
deleteChildEObject.setShowErrorDialog(true); |
| 214 |
|
| 215 |
openReportAction = new OpenReportAction(); |
191 |
openReportAction = new OpenReportAction(); |
| 216 |
generateAction = new GenerateAction(); |
192 |
generateAction = new GenerateAction(); |
| 217 |
generateAction.setImageDescriptor(TestUIImages.INSTANCE.getImageDescriptor("e", TestUIImages.GENERATE_TEST));//$NON-NLS-1$ |
193 |
generateAction.setImageDescriptor(TestUIImages.INSTANCE.getImageDescriptor("e", TestUIImages.GENERATE_TEST));//$NON-NLS-1$ |
|
Lines 222-233
Link Here
|
| 222 |
stopAction = new StopAction(); |
198 |
stopAction = new StopAction(); |
| 223 |
renameAction = new RenameAction((TreeNavigator)getNavigator()); |
199 |
renameAction = new RenameAction((TreeNavigator)getNavigator()); |
| 224 |
pasteAction = new PasteAction(shell, clipboard); |
200 |
pasteAction = new PasteAction(shell, clipboard); |
| 225 |
pasteAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE)); |
201 |
pasteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE)); |
| 226 |
pasteAction.setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED)); |
202 |
pasteAction.setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED)); |
| 227 |
copyAction = new CopyAction(clipboard); |
203 |
copyAction = new CopyAction(clipboard); |
| 228 |
copyAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY)); |
204 |
copyAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY)); |
| 229 |
copyAction.setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED)); |
205 |
copyAction.setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED)); |
| 230 |
|
206 |
moveAction = new MoveAction(shell); |
| 231 |
} |
207 |
} |
| 232 |
|
208 |
|
| 233 |
/** |
209 |
/** |
|
Lines 346-384
Link Here
|
| 346 |
menu.appendToGroup(INavigatorContribution.GROUP_DELETE, stopAction); |
322 |
menu.appendToGroup(INavigatorContribution.GROUP_DELETE, stopAction); |
| 347 |
stopAction.setEnabled(stopAction.isApplicableForEnablement()); |
323 |
stopAction.setEnabled(stopAction.isApplicableForEnablement()); |
| 348 |
} |
324 |
} |
| 349 |
|
325 |
boolean isResourceTestNav = ((TestNavigator)getNavigator()).getCurrentViewIndex()==TestNavigator.VIEW_ID_RESOURCE; |
| 350 |
copyAction.selectionChanged(selection); |
326 |
copyAction.selectionChanged(selection, isResourceTestNav); |
| 351 |
if(copyAction.isApplicableForSelection()){ |
327 |
if(copyAction.isApplicableForSelection()){ |
| 352 |
menu.appendToGroup(INavigatorContribution.GROUP_DELETE, copyAction); |
328 |
menu.appendToGroup(INavigatorContribution.GROUP_DELETE, copyAction); |
| 353 |
} |
329 |
} |
| 354 |
|
330 |
|
| 355 |
pasteAction.selectionChanged(selection); |
331 |
pasteAction.selectionChanged(selection, isResourceTestNav); |
| 356 |
if(pasteAction.isApplicableForSelection()){ |
332 |
if(pasteAction.isApplicableForSelection()){ |
| 357 |
menu.appendToGroup(INavigatorContribution.GROUP_DELETE, pasteAction); |
333 |
menu.appendToGroup(INavigatorContribution.GROUP_DELETE, pasteAction); |
| 358 |
} |
334 |
} |
| 359 |
|
335 |
|
| 360 |
deleteResourceAction.setEnabled(false); |
336 |
moveAction.selectionChanged(selection, isResourceTestNav); |
| 361 |
if(resSelection.size() == selection.size()) |
337 |
if(moveAction.isApplicableForSelection()){ |
| 362 |
{ |
338 |
menu.appendToGroup(INavigatorContribution.GROUP_DELETE, moveAction); |
| 363 |
deleteResourceAction.selectionChanged(resSelection); |
|
|
| 364 |
menu.appendToGroup(INavigatorContribution.GROUP_DELETE, deleteResourceAction); |
| 365 |
|
| 366 |
addBookmarkAction.selectionChanged(resSelection); |
| 367 |
if(addBookmarkAction.isEnabled()) |
| 368 |
menu.appendToGroup(INavigatorContribution.GROUP_DELETE, addBookmarkAction); |
| 369 |
} |
339 |
} |
| 370 |
if(!deleteResourceAction.isEnabled()){ |
340 |
|
| 371 |
menu.add(new Separator()); |
341 |
deleteAction.selectionChanged(selection); |
| 372 |
deleteChildEObject.selectionChanged(selection); |
342 |
if(deleteAction.isEnabled()) { |
| 373 |
if(deleteChildEObject.isEnabled()) |
343 |
menu.appendToGroup(INavigatorContribution.GROUP_DELETE, deleteAction); |
| 374 |
menu.add(deleteChildEObject); |
|
|
| 375 |
} |
344 |
} |
| 376 |
|
345 |
|
| 377 |
renameAction.selectionChanged(selection); |
346 |
renameAction.selectionChanged(selection); |
| 378 |
if(renameAction.isApplicableForSelection()) { |
347 |
if(renameAction.isApplicableForSelection()) { |
| 379 |
menu.appendToGroup(INavigatorContribution.GROUP_DELETE, renameAction); |
348 |
menu.appendToGroup(INavigatorContribution.GROUP_DELETE, renameAction); |
| 380 |
} |
349 |
} |
| 381 |
|
350 |
|
|
|
351 |
if(resSelection.size() == selection.size() && selection.size() > 0) |
| 352 |
{ |
| 353 |
addBookmarkAction.selectionChanged(resSelection); |
| 354 |
if(addBookmarkAction.isEnabled()) |
| 355 |
menu.appendToGroup(INavigatorContribution.GROUP_DELETE, addBookmarkAction); |
| 356 |
} |
| 357 |
|
| 382 |
if(selection.size() == 1) { |
358 |
if(selection.size() == 1) { |
| 383 |
propertyDialogAction.selectionChanged(selection); |
359 |
propertyDialogAction.selectionChanged(selection); |
| 384 |
if(propertyDialogAction.isApplicableForSelection()) |
360 |
if(propertyDialogAction.isApplicableForSelection()) |
|
Lines 394-400
Link Here
|
| 394 |
actionBars.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), propertyDialogAction); |
370 |
actionBars.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), propertyDialogAction); |
| 395 |
actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), addBookmarkAction); |
371 |
actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), addBookmarkAction); |
| 396 |
actionBars.setGlobalActionHandler(IDEActionFactory.ADD_TASK.getId(), addTaskAction); |
372 |
actionBars.setGlobalActionHandler(IDEActionFactory.ADD_TASK.getId(), addTaskAction); |
| 397 |
actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteResourceAction); |
373 |
actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction); |
| 398 |
|
374 |
|
| 399 |
frameListActionGroup.fillActionBars(actionBars); |
375 |
frameListActionGroup.fillActionBars(actionBars); |
| 400 |
newActionGroup.fillActionBars(actionBars); |
376 |
newActionGroup.fillActionBars(actionBars); |
|
Lines 432-444
Link Here
|
| 432 |
|
408 |
|
| 433 |
propertyDialogAction.setEnabled(structuredSelection.size() == 1); |
409 |
propertyDialogAction.setEnabled(structuredSelection.size() == 1); |
| 434 |
addBookmarkAction.selectionChanged(resourceStructuredSelection); |
410 |
addBookmarkAction.selectionChanged(resourceStructuredSelection); |
| 435 |
deleteResourceAction.selectionChanged(resourceStructuredSelection); |
411 |
deleteAction.selectionChanged(resourceStructuredSelection); |
| 436 |
addTaskAction.selectionChanged(structuredSelection); |
412 |
addTaskAction.selectionChanged(structuredSelection); |
| 437 |
refreshAction.selectionChanged(structuredSelection); |
413 |
refreshAction.selectionChanged(structuredSelection); |
| 438 |
openProjectAction.selectionChanged(structuredSelection); |
414 |
openProjectAction.selectionChanged(structuredSelection); |
| 439 |
closeProjectAction.selectionChanged(structuredSelection); |
415 |
closeProjectAction.selectionChanged(structuredSelection); |
| 440 |
copyAction.selectionChanged(structuredSelection); |
416 |
boolean isResourceTestNav = ((TestNavigator)getNavigator()).getCurrentViewIndex()==TestNavigator.VIEW_ID_RESOURCE; |
| 441 |
pasteAction.selectionChanged(structuredSelection); |
417 |
copyAction.selectionChanged(structuredSelection, isResourceTestNav); |
|
|
418 |
pasteAction.selectionChanged(structuredSelection, isResourceTestNav); |
| 419 |
moveAction.selectionChanged(structuredSelection, isResourceTestNav); |
| 442 |
renameAction.selectionChanged(structuredSelection); |
420 |
renameAction.selectionChanged(structuredSelection); |
| 443 |
|
421 |
|
| 444 |
|
422 |
|
|
Lines 465-472
Link Here
|
| 465 |
{ |
443 |
{ |
| 466 |
if(event.character == SWT.DEL && (event.stateMask == SWT.None)) |
444 |
if(event.character == SWT.DEL && (event.stateMask == SWT.None)) |
| 467 |
{ |
445 |
{ |
| 468 |
if(deleteResourceAction.isEnabled()) |
446 |
if(deleteAction.isEnabled()) |
| 469 |
deleteResourceAction.run(); |
447 |
deleteAction.run(); |
| 470 |
//- Swallow the event. |
448 |
//- Swallow the event. |
| 471 |
event.doit = false; |
449 |
event.doit = false; |
| 472 |
} |
450 |
} |