|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2007, 2010 IBM Corporation and others. |
2 |
* Copyright (c) 2007, 2011 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 8-14
Link Here
|
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
| 10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
| 11 |
|
|
|
| 12 |
package org.eclipse.ui.internal.views.markers; |
11 |
package org.eclipse.ui.internal.views.markers; |
| 13 |
|
12 |
|
| 14 |
import java.util.ArrayList; |
13 |
import java.util.ArrayList; |
|
Lines 17-24
Link Here
|
| 17 |
import java.util.Iterator; |
16 |
import java.util.Iterator; |
| 18 |
import java.util.List; |
17 |
import java.util.List; |
| 19 |
|
18 |
|
|
|
19 |
import org.eclipse.core.commands.operations.IUndoContext; |
| 20 |
import org.eclipse.core.resources.IFile; |
20 |
import org.eclipse.core.resources.IFile; |
| 21 |
import org.eclipse.core.resources.IMarker; |
21 |
import org.eclipse.core.resources.IMarker; |
|
|
22 |
import org.eclipse.core.resources.ResourcesPlugin; |
| 23 |
import org.eclipse.core.runtime.Assert; |
| 22 |
import org.eclipse.core.runtime.IStatus; |
24 |
import org.eclipse.core.runtime.IStatus; |
| 23 |
import org.eclipse.core.runtime.Status; |
25 |
import org.eclipse.core.runtime.Status; |
| 24 |
import org.eclipse.help.IContext; |
26 |
import org.eclipse.help.IContext; |
|
Lines 70-86
Link Here
|
| 70 |
import org.eclipse.ui.ISelectionListener; |
72 |
import org.eclipse.ui.ISelectionListener; |
| 71 |
import org.eclipse.ui.IViewPart; |
73 |
import org.eclipse.ui.IViewPart; |
| 72 |
import org.eclipse.ui.IViewSite; |
74 |
import org.eclipse.ui.IViewSite; |
|
|
75 |
import org.eclipse.ui.IWorkbenchCommandConstants; |
| 73 |
import org.eclipse.ui.IWorkbenchPage; |
76 |
import org.eclipse.ui.IWorkbenchPage; |
| 74 |
import org.eclipse.ui.IWorkbenchPart; |
77 |
import org.eclipse.ui.IWorkbenchPart; |
| 75 |
import org.eclipse.ui.IWorkbenchPartReference; |
78 |
import org.eclipse.ui.IWorkbenchPartReference; |
| 76 |
import org.eclipse.ui.OpenAndLinkWithEditorHelper; |
79 |
import org.eclipse.ui.OpenAndLinkWithEditorHelper; |
| 77 |
import org.eclipse.ui.PartInitException; |
80 |
import org.eclipse.ui.PartInitException; |
| 78 |
import org.eclipse.ui.PlatformUI; |
81 |
import org.eclipse.ui.PlatformUI; |
|
|
82 |
import org.eclipse.ui.actions.ActionFactory; |
| 79 |
import org.eclipse.ui.ide.IDE; |
83 |
import org.eclipse.ui.ide.IDE; |
| 80 |
import org.eclipse.ui.ide.ResourceUtil; |
84 |
import org.eclipse.ui.ide.ResourceUtil; |
| 81 |
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; |
85 |
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; |
| 82 |
import org.eclipse.ui.internal.ide.StatusUtil; |
86 |
import org.eclipse.ui.internal.ide.StatusUtil; |
| 83 |
import org.eclipse.ui.menus.IMenuService; |
87 |
import org.eclipse.ui.menus.IMenuService; |
|
|
88 |
import org.eclipse.ui.operations.RedoActionHandler; |
| 89 |
import org.eclipse.ui.operations.UndoActionHandler; |
| 84 |
import org.eclipse.ui.part.MarkerTransfer; |
90 |
import org.eclipse.ui.part.MarkerTransfer; |
| 85 |
import org.eclipse.ui.part.ViewPart; |
91 |
import org.eclipse.ui.part.ViewPart; |
| 86 |
import org.eclipse.ui.progress.IWorkbenchSiteProgressService; |
92 |
import org.eclipse.ui.progress.IWorkbenchSiteProgressService; |
|
Lines 94-99
Link Here
|
| 94 |
|
100 |
|
| 95 |
import com.ibm.icu.text.MessageFormat; |
101 |
import com.ibm.icu.text.MessageFormat; |
| 96 |
|
102 |
|
|
|
103 |
|
| 97 |
/** |
104 |
/** |
| 98 |
* The ExtendedMarkersView is the internal implementation of the view that shows |
105 |
* The ExtendedMarkersView is the internal implementation of the view that shows |
| 99 |
* markers using the markerGenerators extension point. |
106 |
* markers using the markerGenerators extension point. |
|
Lines 146-151
Link Here
|
| 146 |
private IMemento memento; |
153 |
private IMemento memento; |
| 147 |
private String[] defaultGeneratorIds = new String[0]; |
154 |
private String[] defaultGeneratorIds = new String[0]; |
| 148 |
|
155 |
|
|
|
156 |
private UndoActionHandler undoAction; |
| 157 |
|
| 158 |
private RedoActionHandler redoAction; |
| 159 |
|
| 160 |
|
| 149 |
/** |
161 |
/** |
| 150 |
* Return a new instance of the receiver. |
162 |
* Return a new instance of the receiver. |
| 151 |
* |
163 |
* |
|
Lines 393-398
Link Here
|
| 393 |
|
405 |
|
| 394 |
getSite().setSelectionProvider(viewer); |
406 |
getSite().setSelectionProvider(viewer); |
| 395 |
|
407 |
|
|
|
408 |
IUndoContext undoContext= getUndoContext(); |
| 409 |
undoAction= new UndoActionHandler(getSite(), undoContext); |
| 410 |
undoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_UNDO); |
| 411 |
redoAction= new RedoActionHandler(getSite(), undoContext); |
| 412 |
redoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_REDO); |
| 413 |
getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction); |
| 414 |
getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction); |
| 415 |
|
| 396 |
startView(); |
416 |
startView(); |
| 397 |
|
417 |
|
| 398 |
} |
418 |
} |
|
Lines 572-577
Link Here
|
| 572 |
|
592 |
|
| 573 |
getSite().getPage().removePostSelectionListener(pageSelectionListener); |
593 |
getSite().getPage().removePostSelectionListener(pageSelectionListener); |
| 574 |
getSite().getPage().removePartListener(partListener); |
594 |
getSite().getPage().removePartListener(partListener); |
|
|
595 |
|
| 596 |
undoAction.dispose(); |
| 597 |
redoAction.dispose(); |
| 598 |
|
| 575 |
super.dispose(); |
599 |
super.dispose(); |
| 576 |
} |
600 |
} |
| 577 |
|
601 |
|
|
Lines 1714-1717
Link Here
|
| 1714 |
} |
1738 |
} |
| 1715 |
|
1739 |
|
| 1716 |
} |
1740 |
} |
|
|
1741 |
|
| 1742 |
/** |
| 1743 |
* Return the undo context associated with operations performed in this view. By default, return |
| 1744 |
* the workspace undo context. Subclasses should override if a more specific undo context should |
| 1745 |
* be used. |
| 1746 |
* |
| 1747 |
* @since 3.7 |
| 1748 |
*/ |
| 1749 |
protected IUndoContext getUndoContext() { |
| 1750 |
return (IUndoContext)ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class); |
| 1751 |
} |
| 1752 |
|
| 1753 |
/** |
| 1754 |
* Returns the name of the delete operation. |
| 1755 |
* |
| 1756 |
* @param markers the markers to be deleted, must have at least one element |
| 1757 |
* @since 3.7 |
| 1758 |
*/ |
| 1759 |
protected String getDeleteOperationName(IMarker[] markers) { |
| 1760 |
Assert.isLegal(markers.length > 0); |
| 1761 |
return markers.length == 1 ? MarkerMessages.deleteMarker_operationName : MarkerMessages.deleteMarkers_operationName; |
| 1762 |
} |
| 1763 |
|
| 1717 |
} |
1764 |
} |