~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/editors/handlers/AddBookmarkHandler.java

  • Committer: Package Import Robot
  • Author(s): tony mancill
  • Date: 2013-05-13 21:43:22 UTC
  • mfrom: (1.2.1) (2.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130513214322-6frgd9du1n0w2uo7
Tags: 1.2.1-1
* Team upload.
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*******************************************************************************
2
 
 * Copyright (c) 2010 Ericsson
3
 
 * 
4
 
 * All rights reserved. This program and the accompanying materials are
5
 
 * made available under the terms of the Eclipse Public License v1.0 which
6
 
 * accompanies this distribution, and is available at
7
 
 * http://www.eclipse.org/legal/epl-v10.html
8
 
 * 
9
 
 * Contributors:
10
 
 *   Patrick Tasse - Initial API and implementation
11
 
 *******************************************************************************/
12
 
 
13
 
package org.eclipse.linuxtools.internal.tmf.ui.editors.handlers;
14
 
 
15
 
import org.eclipse.core.commands.AbstractHandler;
16
 
import org.eclipse.core.commands.ExecutionEvent;
17
 
import org.eclipse.core.commands.ExecutionException;
18
 
import org.eclipse.linuxtools.tmf.ui.editors.TmfEventsEditor;
19
 
import org.eclipse.ui.IEditorPart;
20
 
import org.eclipse.ui.IWorkbench;
21
 
import org.eclipse.ui.IWorkbenchPage;
22
 
import org.eclipse.ui.PlatformUI;
23
 
 
24
 
public class AddBookmarkHandler extends AbstractHandler {
25
 
 
26
 
        @Override
27
 
    public boolean isEnabled() {
28
 
                return true;
29
 
    }
30
 
 
31
 
        @Override
32
 
        public Object execute(ExecutionEvent event) throws ExecutionException {
33
 
        IWorkbench wb = PlatformUI.getWorkbench();
34
 
        IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage();
35
 
        IEditorPart activeEditor = activePage.getActiveEditor();
36
 
        if (activeEditor instanceof TmfEventsEditor) {
37
 
                TmfEventsEditor editor = (TmfEventsEditor) activeEditor;
38
 
                editor.addBookmark();
39
 
        }
40
 
                return null;
41
 
        }
42
 
 
43
 
}
 
1
/*******************************************************************************
 
2
 * Copyright (c) 2010 Ericsson
 
3
 * 
 
4
 * All rights reserved. This program and the accompanying materials are
 
5
 * made available under the terms of the Eclipse Public License v1.0 which
 
6
 * accompanies this distribution, and is available at
 
7
 * http://www.eclipse.org/legal/epl-v10.html
 
8
 * 
 
9
 * Contributors:
 
10
 *   Patrick Tasse - Initial API and implementation
 
11
 *******************************************************************************/
 
12
 
 
13
package org.eclipse.linuxtools.internal.tmf.ui.editors.handlers;
 
14
 
 
15
import org.eclipse.core.commands.AbstractHandler;
 
16
import org.eclipse.core.commands.ExecutionEvent;
 
17
import org.eclipse.core.commands.ExecutionException;
 
18
import org.eclipse.linuxtools.tmf.ui.editors.TmfEventsEditor;
 
19
import org.eclipse.ui.IEditorPart;
 
20
import org.eclipse.ui.IWorkbench;
 
21
import org.eclipse.ui.IWorkbenchPage;
 
22
import org.eclipse.ui.PlatformUI;
 
23
 
 
24
public class AddBookmarkHandler extends AbstractHandler {
 
25
 
 
26
        @Override
 
27
    public boolean isEnabled() {
 
28
                return true;
 
29
    }
 
30
 
 
31
        @Override
 
32
        public Object execute(ExecutionEvent event) throws ExecutionException {
 
33
        IWorkbench wb = PlatformUI.getWorkbench();
 
34
        IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage();
 
35
        IEditorPart activeEditor = activePage.getActiveEditor();
 
36
        if (activeEditor instanceof TmfEventsEditor) {
 
37
                TmfEventsEditor editor = (TmfEventsEditor) activeEditor;
 
38
                editor.addBookmark();
 
39
        }
 
40
                return null;
 
41
        }
 
42
 
 
43
}