Search in sources :

Example 26 with IUndoableOperation

use of org.eclipse.core.commands.operations.IUndoableOperation in project hale by halestudio.

the class AlignmentServiceUndoSupport method addCell.

/**
 * @see AlignmentServiceDecorator#addCell(MutableCell)
 */
@Override
public synchronized void addCell(MutableCell cell) {
    if (cell == null) {
        return;
    }
    IUndoableOperation operation = new AddCellOperation(cell);
    executeOperation(operation);
}
Also used : IUndoableOperation(org.eclipse.core.commands.operations.IUndoableOperation)

Example 27 with IUndoableOperation

use of org.eclipse.core.commands.operations.IUndoableOperation in project xtext-eclipse by eclipse.

the class ProblemHoverTest method testBug357516_bookmark.

@Test
public void testBug357516_bookmark() throws Exception {
    IResource resource = editor.getResource();
    HashMap<String, Object> attributes = new HashMap<String, Object>();
    attributes.put(IMarker.MESSAGE, CUSTOM_MARKER_TEST_MESSAGE);
    attributes.put(IMarker.LINE_NUMBER, 1);
    attributes.put(IMarker.LOCATION, resource.getFullPath().toPortableString());
    IUndoableOperation operation = new CreateMarkersOperation(IMarker.BOOKMARK, attributes, resource, CUSTOM_MARKER_TEST_MESSAGE);
    IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
    try {
        operationHistory.execute(operation, null, null);
    } catch (ExecutionException x) {
        fail(x.getMessage());
    }
    String hoverInfo = hover.getHoverInfo(editor.getInternalSourceViewer(), 0);
    assertNotNull(hoverInfo);
    assertTrue(hoverInfo.contains(CUSTOM_MARKER_TEST_MESSAGE));
}
Also used : HashMap(java.util.HashMap) IUndoableOperation(org.eclipse.core.commands.operations.IUndoableOperation) IOperationHistory(org.eclipse.core.commands.operations.IOperationHistory) ExecutionException(org.eclipse.core.commands.ExecutionException) CreateMarkersOperation(org.eclipse.ui.ide.undo.CreateMarkersOperation) IResource(org.eclipse.core.resources.IResource) AbstractEditorTest(org.eclipse.xtext.ui.testing.AbstractEditorTest) Test(org.junit.Test)

Aggregations

IUndoableOperation (org.eclipse.core.commands.operations.IUndoableOperation)27 ExecutionException (org.eclipse.core.commands.ExecutionException)7 IAdaptable (org.eclipse.core.runtime.IAdaptable)5 MutableCell (eu.esdihumboldt.hale.common.align.model.MutableCell)4 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 GridData (org.eclipse.swt.layout.GridData)4 IOperationHistory (org.eclipse.core.commands.operations.IOperationHistory)3 CoreException (org.eclipse.core.runtime.CoreException)3 IStatus (org.eclipse.core.runtime.IStatus)3 Status (org.eclipse.core.runtime.Status)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)3 Section (org.eclipse.ui.forms.widgets.Section)3 CreateMarkersOperation (org.eclipse.ui.ide.undo.CreateMarkersOperation)3 ServerEditorSection (org.eclipse.wst.server.ui.editor.ServerEditorSection)3 Cell (eu.esdihumboldt.hale.common.align.model.Cell)2 AbstractRemoveResourcesOperation (eu.esdihumboldt.hale.ui.service.project.internal.AbstractRemoveResourcesOperation)2 HashMap (java.util.HashMap)2