blob: ff03e906415b68d82cc2e43b03e1f8d5d6e8d65c (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
*
* 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:
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.moka.launch;
import org.eclipse.papyrus.infra.core.Activator;
import org.eclipse.papyrus.moka.MokaConstants;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
/**
* A runnable to open a new Papyrus editor from a file editor input
*
*/
public class OpenPapyrusEditorRunnable implements Runnable {
/**
* The file editor input from which an IEditorPart has to be constructed and added to the workbench
*/
protected FileEditorInput input;
protected IEditorPart part;
public OpenPapyrusEditorRunnable(FileEditorInput input) {
this.input = input;
}
/*
* (non-Javadoc)
*
* @see java.lang.Runnable#run()
*/
public void run() {
try {
this.part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input, MokaConstants.PAPYRUS_EDITOR_ID);
} catch (PartInitException e) {
Activator.log.error(e);
}
}
/**
* Returns the created IEditorPart
* This method shall be called only after run() has been executed
*
* @return The created IEditorPart
*/
public IEditorPart getEditorPart() {
return this.part;
}
}
|