當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。