本文整理汇总了Java中org.eclipse.ui.part.MultiPageEditorPart类的典型用法代码示例。如果您正苦于以下问题:Java MultiPageEditorPart类的具体用法?Java MultiPageEditorPart怎么用?Java MultiPageEditorPart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MultiPageEditorPart类属于org.eclipse.ui.part包,在下文中一共展示了MultiPageEditorPart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetLinkedBookmarksInMultipageEditor
import org.eclipse.ui.part.MultiPageEditorPart; //导入依赖的package包/类
@Test
public void testGetLinkedBookmarksInMultipageEditor() throws Exception {
// Given
importProjectFromTemplate("testGetLinkedBookmarksInMultipageEditor", "commons-cli");
Bookmark bookmark = bookmark("pom.xml")
.withProperty(PROP_WORKSPACE_PATH, "/testGetLinkedBookmarksInMultipageEditor/pom.xml")
.withProperty(PROP_LINE_NUMBER, "10").build();
addBookmark(rootFolderId, bookmark);
waitUntil("Cannot find marker", () -> bookmarksMarkers.findMarker(bookmark.getId(), null));
// When
IEditorPart editorPart = openEditor(new Path("/testGetLinkedBookmarksInMultipageEditor/pom.xml"));
// that's why we require org.eclipse.m2e.editor in MANIFEST.MF
assertThat(editorPart).isInstanceOf(MultiPageEditorPart.class);
ITextEditor textEditor = getTextEditor(editorPart);
selectAndReveal(textEditor, getOffset(textEditor, 10));
List<Bookmark> bookmarks = operation.getLinkedBookmarks(textEditor, getSelection(textEditor));
// Then
assertEquals(1, bookmarks.size());
assertEquals(bookmark, bookmarks.get(0));
}
示例2: isTimelineActive
import org.eclipse.ui.part.MultiPageEditorPart; //导入依赖的package包/类
public static boolean isTimelineActive() {
IWorkbench workbench = Activator.getDefault().getWorkbench();
IEditorPart current = EditorPartUtils.getCurrent(workbench);
if (current instanceof EditorPart) {
IEditorPart activeEditor = current;
if (activeEditor instanceof MultiPageEditorPart) {
MultiPageEditorPart editor = (MultiPageEditorPart) current;
int activePage = editor.getActivePage();
if (activePage >= 0) {
IEditorPart[] subEditors = editor.findEditors(editor.getEditorInput());
if (activePage < subEditors.length) {
activeEditor = subEditors[activePage];
}
}
}
Object adapter = activeEditor.getAdapter(Timeline.class);
if (adapter != null) {
return true;
}
}
return false;
}
示例3: createAdditionalPage
import org.eclipse.ui.part.MultiPageEditorPart; //导入依赖的package包/类
@Override
public String createAdditionalPage(MultiPageEditorPart parent, IFileEditorInput file, int pageNum) {
// Create the specified page
switch (pageNum) {
// Page 2 is the file's data displayed in text
case 1:
// Create a text editor with the file as input and add its page with
// the name Data
try {
editor = (IEditorPart) new TextEditor();
parent.addPage(editor, file);
return "Data";
} catch (PartInitException e) {
logger.error("Error initializing text editor for CSV Plot Editor.");
}
break;
}
// If the page number is not supported, return null
return null;
}
示例4: finishNotCompiledReport
import org.eclipse.ui.part.MultiPageEditorPart; //导入依赖的package包/类
private void finishNotCompiledReport() {
UIUtils.getDisplay().asyncExec(new Runnable() {
public void run() {
pcontainer.setNotRunning(true);
if (pcontainer.getSite() instanceof MultiPageEditorSite) {
MultiPageEditorPart mpe = ((MultiPageEditorSite) pcontainer.getSite()).getMultiPageEditor();
IEditorPart[] editors = mpe.findEditors(mpe.getEditorInput());
if (editors != null && editors.length > 0) {
// Dialog, if not ..., it's not clear for the user that error happened
UIUtils.showInformation(Messages.ReportControler_compilationerrors);
mpe.setActiveEditor(editors[0]);
}
}
}
});
}
示例5: partClosed
import org.eclipse.ui.part.MultiPageEditorPart; //导入依赖的package包/类
public void partClosed(IWorkbenchPartReference partRef)
{
if (partRef instanceof IEditorReference)
{
IEditorPart part = (IEditorPart) partRef.getPart(false);
if (part instanceof MultiPageEditorPart)
{
MultiPageEditorPart multi = (MultiPageEditorPart) part;
if (pageListener != null)
{
multi.getSite().getSelectionProvider().removeSelectionChangedListener(pageListener);
}
}
}
// If it's a search view, remove any query listeners for it!
else if (partRef instanceof IViewReference)
{
IViewPart view = (IViewPart) partRef.getPart(false);
if (queryListeners.containsKey(view))
{
NewSearchUI.removeQueryListener(queryListeners.remove(view));
}
}
}
示例6: selectAndReveal
import org.eclipse.ui.part.MultiPageEditorPart; //导入依赖的package包/类
public static void selectAndReveal(IEditorPart editorPart,
IRegion highlightRange) {
ITextEditor textEditor = null;
if (editorPart instanceof MultiPageEditorPart) {
MultiPageEditorPart part = (MultiPageEditorPart) editorPart;
Object editorPage = part.getSelectedPage();
if (editorPage != null && editorPage instanceof ITextEditor) {
textEditor = (ITextEditor) editorPage;
}
} else if (editorPart instanceof ITextEditor) {
textEditor = (ITextEditor) editorPart;
}
// highlight range in editor if possible
if (highlightRange != null && textEditor != null) {
textEditor.selectAndReveal(highlightRange.getOffset(),
highlightRange.getLength());
}
}
示例7: getTimelineEditor
import org.eclipse.ui.part.MultiPageEditorPart; //导入依赖的package包/类
public static IEditorPart getTimelineEditor(Object object) {
IEditorPart editor = null;
if (object instanceof IEditorPart) {
editor = (IEditorPart) object;
} else if (object instanceof ExecutionEvent) {
ExecutionEvent event = (ExecutionEvent) object;
IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
if (activeEditor instanceof MultiPageEditorPart) {
MultiPageEditorPart multiPageEditorPart = (MultiPageEditorPart) activeEditor;
IEditorPart[] editorParts = multiPageEditorPart.findEditors(multiPageEditorPart.getEditorInput());
for (IEditorPart editorPart : editorParts) {
Timeline timeline = (Timeline) editorPart.getAdapter(Timeline.class);
if (timeline != null) {
editor = editorPart;
break;
}
}
}
}
return editor;
}
示例8: refresh
import org.eclipse.ui.part.MultiPageEditorPart; //导入依赖的package包/类
private void refresh() {
ITextEditor iteEditor = null;
if (this.editor instanceof EcoreEditor) {
final EcoreEditor ecEditor = (EcoreEditor) this.editor;
ecEditor.getViewer().refresh();
} else {
if (this.editor instanceof ITextEditor) {
iteEditor = (ITextEditor) this.editor;
} else {
final MultiPageEditorPart mpepEditor = (MultiPageEditorPart) this.editor;
final IEditorPart[] editors = mpepEditor.findEditors(mpepEditor.getEditorInput());
iteEditor = (ITextEditor) editors[0];
}
final IDocumentProvider idp = iteEditor.getDocumentProvider();
try {
idp.resetDocument(iteEditor.getEditorInput());
} catch (final CoreException e) {
e.printStackTrace();
}
}
MarkerFactory.refreshProjectExp();
if (Activator.getDefault().getWorkbench().getWorkbenchWindows()[0].getActivePage()
.findView(Visualization.ID) != null) {
Visualization.showViz();
}
}
示例9: refresh
import org.eclipse.ui.part.MultiPageEditorPart; //导入依赖的package包/类
private void refresh() {
ITextEditor iteEditor = null;
if (editor instanceof EcoreEditor) {
final EcoreEditor ecEditor = (EcoreEditor) editor;
ecEditor.getViewer().refresh();
} else {
if (editor instanceof ITextEditor) {
iteEditor = (ITextEditor) editor;
} else {
final MultiPageEditorPart mpepEditor = (MultiPageEditorPart) editor;
final IEditorPart[] editors = mpepEditor.findEditors(mpepEditor.getEditorInput());
iteEditor = (ITextEditor) editors[0];
}
final IDocumentProvider idp = iteEditor.getDocumentProvider();
try {
idp.resetDocument(iteEditor.getEditorInput());
} catch (final CoreException e) {
e.printStackTrace();
}
}
MarkerFactory.refreshProjectExp();
if (Activator.getDefault().getWorkbench().getWorkbenchWindows()[0].getActivePage()
.findView(Visualization.ID) != null) {
Visualization.showViz();
}
}
示例10: refresh
import org.eclipse.ui.part.MultiPageEditorPart; //导入依赖的package包/类
private void refresh() {
ITextEditor iteEditor = null;
if (editor instanceof EcoreEditor) {
final EcoreEditor ecEditor = (EcoreEditor) editor;
ecEditor.getViewer().refresh();
} else {
if (editor instanceof ITextEditor) {
iteEditor = (ITextEditor) editor;
} else {
final MultiPageEditorPart mpepEditor = (MultiPageEditorPart) editor;
final IEditorPart[] editors = mpepEditor.findEditors(mpepEditor.getEditorInput());
iteEditor = (ITextEditor) editors[0];
}
final IDocumentProvider idp = iteEditor.getDocumentProvider();
try {
idp.resetDocument(iteEditor.getEditorInput());
} catch (final CoreException e) {
e.printStackTrace();
}
}
MarkerFactory.refreshProjectExp();
}
示例11: editorOpened
import org.eclipse.ui.part.MultiPageEditorPart; //导入依赖的package包/类
@Override
public final void editorOpened(IEditorPart editorPart)
{
if (editorPart instanceof MultiPageEditorPart)
{
Object selectedPage = ((MultiPageEditorPart) editorPart).getSelectedPage();
if (selectedPage instanceof IEditorPart)
{
editorPart = (IEditorPart) selectedPage;
}
}
if (editorPart instanceof ITextEditor)
{
editorOpened((ITextEditor) editorPart);
}
}
示例12: getActiveEditorInput
import org.eclipse.ui.part.MultiPageEditorPart; //导入依赖的package包/类
private IEditorInput getActiveEditorInput() {
IEditorPart editor = getActiveEditor();
if (editor == null)
return null;
// Handle multi-page editors
if (editor instanceof MultiPageEditorPart) {
Object page= ((MultiPageEditorPart)editor).getSelectedPage();
if (page instanceof IEditorPart)
editor= (IEditorPart)page;
else
return null;
}
return editor.getEditorInput();
}
示例13: setActiveEditor
import org.eclipse.ui.part.MultiPageEditorPart; //导入依赖的package包/类
public void setActiveEditor(IEditorPart part) {
if (part instanceof MultiPageEditorPart) {
part = ((NCLMultiPageEditor) part).getActivePageAsEditor();
activeNestedEditor = part;
/* layout editor, not in use for now
if(part instanceof NCLLayoutEditor){
nclLayoutActionBarContributor.setActiveEditor(part);
}
else*/
if (part instanceof NCLEditor) {
nclActionContributor.setActiveEditor(part);
}
}
super.setActiveEditor(part);
}
示例14: openEditor
import org.eclipse.ui.part.MultiPageEditorPart; //导入依赖的package包/类
public static void openEditor(final Object val, IEditorPart editor, ANode node) {
if (editor.getEditorSite() instanceof MultiPageEditorSite) {
final MultiPageEditorPart mpep = ((MultiPageEditorSite) editor.getEditorSite()).getMultiPageEditor();
if (mpep instanceof IJROBjectEditor)
doOpenEditor(val, (IJROBjectEditor) mpep, node);
} else {
editor = Workbench.getInstance().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (editor instanceof IJROBjectEditor)
doOpenEditor(val, (IJROBjectEditor) editor, node);
}
}
示例15: partOpened
import org.eclipse.ui.part.MultiPageEditorPart; //导入依赖的package包/类
public void partOpened(IWorkbenchPartReference partRef)
{
if (partRef instanceof IEditorReference)
{
IEditorPart editorPart = (IEditorPart) partRef.getPart(false);
hijackEditor(editorPart, false);
if (editorPart instanceof MultiPageEditorPart)
{
MultiPageEditorPart multi = (MultiPageEditorPart) editorPart;
if (pageListener == null)
{
pageListener = new ISelectionChangedListener()
{
public void selectionChanged(SelectionChangedEvent event)
{
hijackOutline();
}
};
}
multi.getSite().getSelectionProvider().addSelectionChangedListener(pageListener);
}
return;
}
if (partRef instanceof IViewReference)
{
IViewPart view = (IViewPart) partRef.getPart(false);
hijackView(view, false);
}
}