当前位置: 首页>>代码示例>>Java>>正文


Java MultiPageEditorPart类代码示例

本文整理汇总了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));
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:23,代码来源:GetLinkedBookmarksOperationTest.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:23,代码来源:AbstractTimelineCommandHandler.java

示例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;
}
 
开发者ID:eclipse,项目名称:eavp,代码行数:25,代码来源:CSVPlot.java

示例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]);
				}
			}
		}
	});
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:19,代码来源:ReportControler.java

示例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));
		}
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:25,代码来源:InvasiveThemeHijacker.java

示例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());
	}
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:22,代码来源:AbstractStrutsHyperlinkDetector.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:23,代码来源:TimelineEditorUtils.java

示例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();
  }
}
 
开发者ID:ModelWriter,项目名称:WP3,代码行数:27,代码来源:DeleteAllHandler.java

示例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();
  }
}
 
开发者ID:ModelWriter,项目名称:WP3,代码行数:27,代码来源:DeleteHandler.java

示例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();
}
 
开发者ID:ModelWriter,项目名称:WP3,代码行数:23,代码来源:DeleteAtomCommand.java

示例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);
    }
}
 
开发者ID:anjlab,项目名称:eclipse-tapestry5-plugin,代码行数:19,代码来源:TextEditorCallback.java

示例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();
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:17,代码来源:GoSearchPage.java

示例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);
}
 
开发者ID:ncleclipse,项目名称:ncl30-eclipse,代码行数:16,代码来源:NCLMultiPageActionBarContributor.java

示例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);
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:12,代码来源:EditableFigureEditPart.java

示例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);
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:32,代码来源:InvasiveThemeHijacker.java


注:本文中的org.eclipse.ui.part.MultiPageEditorPart类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。