當前位置: 首頁>>代碼示例>>Java>>正文


Java IViewPart.getViewSite方法代碼示例

本文整理匯總了Java中org.eclipse.ui.IViewPart.getViewSite方法的典型用法代碼示例。如果您正苦於以下問題:Java IViewPart.getViewSite方法的具體用法?Java IViewPart.getViewSite怎麽用?Java IViewPart.getViewSite使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.ui.IViewPart的用法示例。


在下文中一共展示了IViewPart.getViewSite方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import org.eclipse.ui.IViewPart; //導入方法依賴的package包/類
@Override
public void init(IPageBookViewPage page, IConsole console) {
	IPageSite pageSite = page.getSite();
	IWorkbenchPage workbenchPage = pageSite.getPage();
	IViewPart viewPart = workbenchPage.findView(IConsoleConstants.ID_CONSOLE_VIEW);
	IViewSite viewSite = viewPart.getViewSite();
	IActionBars actionBars = viewSite.getActionBars();
	IToolBarManager toolBarManager = actionBars.getToolBarManager();
	IContributionItem[] items = toolBarManager.getItems();
	for(int i = 0; i < items.length; ++i) {
		IContributionItem item = items[i];
		if(item instanceof ActionContributionItem) {
			IAction action = ((ActionContributionItem) item).getAction();
			String text = action.getText();
			if(text.equals("Pi&n Console") || text.equals("Open Console"))
				toolBarManager.remove(item);
		}
	}
}
 
開發者ID:AlexWengh,項目名稱:HMM,代碼行數:20,代碼來源:ConsolePageParticipant.java

示例2: showView

import org.eclipse.ui.IViewPart; //導入方法依賴的package包/類
/**
 * Shows the specified view in the workbench.
 *
 * @param viewPart
 *        The view to show.
 */
public static void showView(final IViewPart viewPart) {
    Check.notNull(viewPart, "viewPart"); //$NON-NLS-1$

    try {
        final IViewSite viewSite = viewPart.getViewSite();
        viewSite.getPage().showView(viewSite.getId());
    } catch (final PartInitException e) {
        final String messageFormat = "Could not create view part {0}"; //$NON-NLS-1$
        final String message = MessageFormat.format(messageFormat, viewPart.getViewSite().getId());
        log.warn(message, e);
    }
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:19,代碼來源:ViewHelper.java

示例3: RefactorActionGroup

import org.eclipse.ui.IViewPart; //導入方法依賴的package包/類
/**
 * Creates a new <code>RefactorActionGroup</code>. The group requires
 * that the selection provided by the part's selection provider is of type <code>
 * org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param part the view part that owns this action group
 */
public RefactorActionGroup(IViewPart part) {
	this(part.getSite(), null);

	IUndoContext workspaceContext= (IUndoContext)ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class);
	fUndoRedoActionGroup= new UndoRedoActionGroup(part.getViewSite(), workspaceContext, true);

	installQuickAccessAction();
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:16,代碼來源:RefactorActionGroup.java

示例4: getServersViewSelection

import org.eclipse.ui.IViewPart; //導入方法依賴的package包/類
/**
 * If the Servers view is available and it contains a selection, the
 * corresponding structured selection is returned. In any other case,
 * including the Servers view being unavailable, either because it is not
 * installed or it is closed, null is returned.
 * @return structured selection in the Servers view, if the Servers view is
 * open and available, or null otherwise
 */
public static IStructuredSelection getServersViewSelection() {

	IViewRegistry registry = PlatformUI.getWorkbench().getViewRegistry();
	String serversViewID = SERVERS_VIEW_ID;

	// fast check to verify that the servers View is available.
	IViewDescriptor serversViewDescriptor = registry.find(serversViewID);
	if (serversViewDescriptor != null) {

		// Granular null checks required as any of the workbench components
		// may not be available at some given point in time (e.g., during
		// start/shutdown)
		IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();

		if (activeWorkbenchWindow != null) {

			IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();

			if (activePage != null) {
				IViewReference[] references = activePage.getViewReferences();

				if (references != null) {
					IViewPart serversViewPart = null;
					for (IViewReference reference : references) {
						if (serversViewID.equals(reference.getId())) {
							serversViewPart = reference.getView(true);
							break;
						}
					}

					if (serversViewPart != null) {

						IViewSite viewSite = serversViewPart.getViewSite();
						if (viewSite != null) {
							ISelectionProvider selectionProvider = viewSite.getSelectionProvider();
							if (selectionProvider != null) {
								ISelection selection = selectionProvider.getSelection();
								if (selection instanceof IStructuredSelection) {
									return (IStructuredSelection) selection;
								}
							}
						}
					}
				}
			}
		}

	}
	return null;
}
 
開發者ID:eclipse,項目名稱:cft,代碼行數:59,代碼來源:CFUiUtil.java

示例5: TypeScriptSearchActionGroup

import org.eclipse.ui.IViewPart; //導入方法依賴的package包/類
/**
 * Creates a new <code>JavaSearchActionGroup</code>. The group 
 * requires that the selection provided by the part's selection provider 
 * is of type <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
 * 
 * @param part the view part that owns this action group
 */
public TypeScriptSearchActionGroup(IViewPart part) {
	this(part.getViewSite());
}
 
開發者ID:angelozerr,項目名稱:typescript.java,代碼行數:11,代碼來源:TypeScriptSearchActionGroup.java

示例6: JavaSearchActionGroup

import org.eclipse.ui.IViewPart; //導入方法依賴的package包/類
/**
 * Creates a new <code>JavaSearchActionGroup</code>. The group
 * requires that the selection provided by the part's selection provider
 * is of type <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param part the view part that owns this action group
 */
public JavaSearchActionGroup(IViewPart part) {
	this(part.getViewSite());
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:11,代碼來源:JavaSearchActionGroup.java


注:本文中的org.eclipse.ui.IViewPart.getViewSite方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。