本文整理匯總了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);
}
}
}
示例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);
}
}
示例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();
}
示例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;
}
示例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());
}
示例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());
}