blob: 4f1aa74ff9564741e139362d5fdc8700c9536c8a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/*******************************************************************************
* Copyright (c) 2009 - 2010 Martin Fluegge (Berlin, Germany).
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Martin Fluegge - initial API and implementation
******************************************************************************/
package org.eclipse.emf.cdo.dawn.helper;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
/**
* @author Martin Fluegge
*/
public class DawnEditorHelper
{
public static Shell getActiveShell()
{
Shell shell = Display.getCurrent().getActiveShell();
return shell;
}
public static IEditorPart getActiveEditor()
{
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IEditorPart editor = null;
if (window != null)
{
IWorkbenchPage page = window.getActivePage();
if (page != null)
{
editor = page.getActiveEditor();
}
}
return editor;
}
}
|