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


Java IViewReference.getView方法代碼示例

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


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

示例1: getExistingInstances

import org.eclipse.ui.IViewReference; //導入方法依賴的package包/類
/**
 * Utility method to get all open views that are instances of CommonNavigator
 * @param clazz the class type which extends EnsembleCommonNavigator
 * @return the list of viewers that are of type EnsembleCommonNavigator
 */
public static List<EnsembleCommonNavigator> getExistingInstances(Class<? extends EnsembleCommonNavigator> clazz) {
	List<EnsembleCommonNavigator> commonNavigators = new ArrayList<EnsembleCommonNavigator>();
	
	IWorkbench workbench = PlatformUI.getWorkbench();
	IWorkbenchWindow[] workbenchWindows = workbench.getWorkbenchWindows();
	for(IWorkbenchWindow workbenchWindow : workbenchWindows) {
		IWorkbenchPage[] pages = workbenchWindow.getPages();
		for(IWorkbenchPage page : pages) {
			IViewReference[] viewReferences = page.getViewReferences();							
			for(IViewReference viewReference : viewReferences) {
				IViewPart view = viewReference.getView(false);
					if(view != null) {
						boolean assignableFrom = clazz.isAssignableFrom(view.getClass());
						if(assignableFrom) {
							commonNavigators.add((EnsembleCommonNavigator)view);
						}
				}
			}
		}
	}
	
	return commonNavigators;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:29,代碼來源:EnsembleCommonNavigator.java

示例2: getCurrentSelection

import org.eclipse.ui.IViewReference; //導入方法依賴的package包/類
protected static IStructuredSelection getCurrentSelection() {
	IStructuredSelection structuredSeleciton = StructuredSelection.EMPTY;
	IWorkbench workbench = PlatformUI.getWorkbench();
	IViewReference[] viewReferences = workbench.getActiveWorkbenchWindow().getActivePage().getViewReferences();
	IViewPart viewPart = null;
	for(IViewReference viewReference : viewReferences) {
		IViewPart view = viewReference.getView(false);
		if(view instanceof CommonViewer) {
			viewPart = view;
		}
	}
	
	if(viewPart != null) {
		ISelectionProvider selectionProvider = viewPart.getSite().getSelectionProvider();
		ISelection selection = selectionProvider.getSelection();
		if(selection instanceof IStructuredSelection) {
			structuredSeleciton = (IStructuredSelection)selection;
		}
	}
	
	return structuredSeleciton;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:23,代碼來源:NewResourceAction.java

示例3: getDeviceInformation

import org.eclipse.ui.IViewReference; //導入方法依賴的package包/類
private Collection<DeviceInformation<?>> getDeviceInformation() throws ScanningException {

		IViewReference[] refs = PageUtil.getPage().getViewReferences();
		for (IViewReference iViewReference : refs) {
			IViewPart part = iViewReference.getView(false);
			if (part==null) continue;
			Object info = part.getAdapter(DeviceInformation.class);
			if (info!=null && info instanceof Collection) { // A collection of device information
				return (Collection<DeviceInformation<?>>)info;
			}
		}

		// We cannot find a part which has the temp information so
        // we use the server information.
		return dservice.getDeviceInformation();
	}
 
開發者ID:eclipse,項目名稱:scanning,代碼行數:17,代碼來源:ExecuteView.java

示例4: refreshCurrent

import org.eclipse.ui.IViewReference; //導入方法依賴的package包/類
/**
 * The refresher for Current ReportList View. 
 *
 * @param pages the page list for the currently active workbench windows
 * @param project the project, the user change his/her view to
 * @param filename the filename
 * @param considerViewerRefresh false if the refresh should always happen despite of no real need to force refresh
 */
private void refreshCurrent(IWorkbenchPage[] pages, IProject project, String filename,
        boolean considerViewerRefresh) {
    for(IWorkbenchPage page : pages) {
        for (IViewReference vp : page.getViewReferences()) {
            if (vp.getId().equals(ReportListView.ID)) {
                ReportListView rlv = (ReportListView) vp.getView(true);
                if (!considerViewerRefresh || rlv.getViewerRefresh()) {
                    rlv.onEditorChanged(project, filename);
                } else {
                    rlv.setViewerRefresh(true);
                }
            }
        }
    }
}
 
開發者ID:Ericsson,項目名稱:CodeCheckerEclipsePlugin,代碼行數:24,代碼來源:CodeCheckerContext.java

示例5: refreshCustom

import org.eclipse.ui.IViewReference; //導入方法依賴的package包/類
/**
 * The refresher for Custom ReportList View. If secondary id is empty, 
 * it checks if a refresh really needs to happen and if so updates every 
 * custom view for the current project. If secondary-id is not empty, 
 * it will search for the secondary-id custom view and 
 * updates that particular one.
 *
 * @param pages the page list for the currently active workbench windows.
 * @param project the project, the user change his/her view to
 * @param secondaryId id of the {@link ReportListViewCustom} the refresh
 * @param considerViewerRefresh false if the refresh should always happen despite of no real need to force refresh
 */
private void refreshCustom(IWorkbenchPage[] pages, IProject project, String secondaryId,
        boolean considerProjectChange) {
    for(IWorkbenchPage page : pages) {
        for (IViewReference vp : page.getViewReferences()) {
            if (vp.getId().equals(ReportListViewCustom.ID)) {
                ReportListViewCustom rlvc = (ReportListViewCustom) vp.getView(true);
                if(secondaryId.equals("") && rlvc.getViewSite().getSecondaryId() != null) {
                    if (!considerProjectChange || this.activeProject != project) {
                        rlvc.onEditorChanged(project);
                    }
                } else if(rlvc.getViewSite().getSecondaryId() != null && 
                        rlvc.getViewSite().getSecondaryId().equals(secondaryId)){
                    rlvc.onEditorChanged(project);
                    return;
                }
            }
        }
    }
}
 
開發者ID:Ericsson,項目名稱:CodeCheckerEclipsePlugin,代碼行數:32,代碼來源:CodeCheckerContext.java

示例6: open

import org.eclipse.ui.IViewReference; //導入方法依賴的package包/類
/** Open a runtime display
 *
 *  <p>Either opens a new display, or if there is already an existing view
 *  for that input, "activate" it, which pops a potentially hidden view to the top.
 *
 *  @param page Page to use. <code>null</code> for 'active' page
 *  @param close_handler Code to call when part is closed
 *  @param info DisplayInfo (to compare with currently open displays)
 *  @return {@link RuntimeViewPart}
 *  @throws Exception on error
 */
public static RuntimeViewPart open(IWorkbenchPage page, final Consumer<DisplayModel> close_handler, final DisplayInfo info)
        throws Exception
{
    if (page == null)
        page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    if (info != null)
        for (IViewReference view_ref : page.getViewReferences())
            if (view_ref.getId().startsWith(ID))
            {
                final IViewPart view = view_ref.getView(true);
                if (view instanceof RuntimeViewPart)
                {
                    final RuntimeViewPart runtime_view = (RuntimeViewPart) view;
                    if (info.equals(runtime_view.getDisplayInfo())) // Allow for runtime_view.getDisplayInfo() == null
                    {
                        page.showView(view_ref.getId(), view_ref.getSecondaryId(), IWorkbenchPage.VIEW_ACTIVATE);
                        return runtime_view;
                    }
                }
            }
    final RuntimeViewPart part = (RuntimeViewPart) page.showView(ID, UUID.randomUUID().toString(), IWorkbenchPage.VIEW_ACTIVATE);
    part.close_handler = close_handler;
    return part;
}
 
開發者ID:kasemir,項目名稱:org.csstudio.display.builder,代碼行數:36,代碼來源:RuntimeViewPart.java

示例7: unregisterProcView

import org.eclipse.ui.IViewReference; //導入方法依賴的package包/類
/***************************************************************************
 * Unregister a view part
 * 
 * @param viewId
 *            View identifier
 **************************************************************************/
private void unregisterProcView(String viewId)
{
	Logger.debug("Unregistering proc view: " + viewId, Level.PROC, this);
	m_procViewList.remove(viewId);

	// Close all tabbed views (AsRun and Log views) associated with
	// this procedure
	IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	IWorkbenchPage page = window.getActivePage();
	for (IViewReference viewReference : page.getViewReferences())
	{
		if (viewReference.getView(false) instanceof TabbedView)
		{
			TabbedView logOrAsRunView = (TabbedView) viewReference.getView(false);
			if (logOrAsRunView.getProcId().equals(viewId))
			{
				page.hideView(logOrAsRunView);
			}
		}
	}
}
 
開發者ID:Spacecraft-Code,項目名稱:SPELL,代碼行數:28,代碼來源:ViewManager.java

示例8: partActivated

import org.eclipse.ui.IViewReference; //導入方法依賴的package包/類
public void partActivated(IWorkbenchPartReference partRef)
{
	if (partRef instanceof IViewReference)
	{
		IViewReference viewRef = (IViewReference) partRef;
		String id = viewRef.getId();
		if ("org.eclipse.ui.console.ConsoleView".equals(id) || "org.eclipse.jdt.ui.TypeHierarchy".equals(id) //$NON-NLS-1$ //$NON-NLS-2$
				|| "org.eclipse.jdt.callhierarchy.view".equals(id)) //$NON-NLS-1$
		{
			final IViewPart part = viewRef.getView(false);
			Display.getCurrent().asyncExec(new Runnable()
			{
				public void run()
				{
					hijackView(part, false);
				}
			});
			return;
		}
	}
	if (partRef instanceof IEditorReference)
	{
		hijackOutline();
	}
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:26,代碼來源:InvasiveThemeHijacker.java

示例9: getPicDirView

import org.eclipse.ui.IViewReference; //導入方法依賴的package包/類
private PicDirView getPicDirView(final IWorkbenchWindow wbWindow) {

		final IWorkbenchPage wbPage = wbWindow.getActivePage();
		if (wbPage != null) {

			for (final IViewReference viewRef : wbPage.getViewReferences()) {

				if (viewRef.getId().equals(PicDirView.ID)) {

					final IViewPart viewPart = viewRef.getView(false);
					if (viewPart instanceof PicDirView) {
						return (PicDirView) viewPart;
					}
				}
			}
		}

		return null;
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:20,代碼來源:TourPhotoLinkView.java

示例10: getCurrentSelection

import org.eclipse.ui.IViewReference; //導入方法依賴的package包/類
public static IStructuredSelection getCurrentSelection() {
	IWorkbench workbench = PlatformUI.getWorkbench();
	if (workbench==null || workbench.getActiveWorkbenchWindow()==null) {
		return StructuredSelection.EMPTY;
	}
	IStructuredSelection structuredSelection = StructuredSelection.EMPTY;
	IViewReference[] viewReferences = workbench.getActiveWorkbenchWindow()
			.getActivePage().getViewReferences();
	IViewPart viewPart = null;
	for (IViewReference viewReference : viewReferences) {
		IViewPart view = viewReference.getView(false);
		if (view instanceof CommonViewer) {
			viewPart = view;
		}
	}

	if (viewPart != null) {
		ISelectionProvider selectionProvider = viewPart.getSite()
				.getSelectionProvider();
		ISelection selection = selectionProvider.getSelection();
		if (selection instanceof IStructuredSelection) {
			structuredSelection = (IStructuredSelection) selection;
		}
	}
	return structuredSelection;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:27,代碼來源:EditorPartUtils.java

示例11: isSaveOnCloseNeeded

import org.eclipse.ui.IViewReference; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public boolean isSaveOnCloseNeeded() {
	// workaround for SPF-6678 "Dirty bit is only set when focus is removed from field in Template View, Details View "
	IWorkbenchPartSite site = getSite();
	if (site != null) {
		IWorkbenchPage page = site.getPage();
		IViewReference[] viewReferences = page.getViewReferences();
		for (IViewReference iViewReference : viewReferences) {
			IViewPart viewPart = iViewReference.getView(false);
			if(viewPart != null) {
				Object adapter = viewPart.getAdapter(IPage.class);
				if(adapter instanceof DetailPage) {
					DetailPage detailPage = (DetailPage) adapter;
					if(detailPage.hasSheet()) {
						this.setFocus();
						break;
					}
				}
			}	
		}			
	}
	// end workaround
	return super.isSaveOnCloseNeeded();
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:28,代碼來源:MultiPagePlanEditor.java

示例12: getView

import org.eclipse.ui.IViewReference; //導入方法依賴的package包/類
public static ViewPart getView(String viewId, boolean forceVisible) {
    IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    try {
        if (workbenchWindow == null) {
            return null;
        }
        IWorkbenchPage page = workbenchWindow.getActivePage();
        if (forceVisible) {
            return (ViewPart) page.showView(viewId, null, IWorkbenchPage.VIEW_VISIBLE);

        } else {
            IViewReference viewReference = page.findViewReference(viewId);
            if (viewReference != null) {
                //if it's there, return it (but don't restore it if it's still not there).
                //when made visible, it'll handle things properly later on.
                return (ViewPart) viewReference.getView(false);
            }
        }
    } catch (Exception e) {
        Log.log(e);
    }
    return null;

}
 
開發者ID:fabioz,項目名稱:Pydev,代碼行數:25,代碼來源:UIUtils.java

示例13: getConsoleParts

import org.eclipse.ui.IViewReference; //導入方法依賴的package包/類
/**
 * @param page the page where the console view is
 * @param restore whether we should try to restore it
 * @return a list with the parts containing the console
 */
private static List<IViewPart> getConsoleParts(IWorkbenchPage page, boolean restore) {
    List<IViewPart> consoleParts = new ArrayList<IViewPart>();

    IViewReference[] viewReferences = page.getViewReferences();
    for (IViewReference ref : viewReferences) {
        if (ref.getId().equals(IConsoleConstants.ID_CONSOLE_VIEW)) {
            IViewPart part = ref.getView(restore);
            if (part != null) {
                consoleParts.add(part);
                if (restore) {
                    return consoleParts;
                }
            }
        }
    }
    return consoleParts;
}
 
開發者ID:fabioz,項目名稱:Pydev,代碼行數:23,代碼來源:ScriptConsole.java

示例14: getView

import org.eclipse.ui.IViewReference; //導入方法依賴的package包/類
/**
 * Gets the py code coverage view. May only be called in the UI thread. If the view is not visible, if createIfNotThere
 * is true, it's made visible.
 *
 * Note that it may return null if createIfNotThere == false and the view is not currently shown or if not in the
 * UI thread.
 */
public static PyCodeCoverageView getView(boolean createIfNotThere) {
    IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    try {
        if (workbenchWindow == null) {
            return null;
        }
        IWorkbenchPage page = workbenchWindow.getActivePage();
        if (createIfNotThere) {
            return (PyCodeCoverageView) page.showView(PY_COVERAGE_VIEW_ID, null, IWorkbenchPage.VIEW_ACTIVATE);
        } else {
            IViewReference viewReference = page.findViewReference(PY_COVERAGE_VIEW_ID);
            if (viewReference != null) {
                //if it's there, return it (but don't restore it if it's still not there).
                //when made visible, it'll handle things properly later on.
                return (PyCodeCoverageView) viewReference.getView(false);
            }
        }
    } catch (Exception e) {
        Log.log(e);
    }
    return null;
}
 
開發者ID:fabioz,項目名稱:Pydev,代碼行數:30,代碼來源:PyCodeCoverageView.java

示例15: isScanView

import org.eclipse.ui.IViewReference; //導入方法依賴的package包/類
private boolean isScanView(IViewReference des) {
	IViewPart part = des.getView(false);
	if (part instanceof SeriesItemView) {
		SeriesItemView view = (SeriesItemView)part;
		return view.isSeriesOf(IPointGenerator.class);
	}
	return false;
}
 
開發者ID:eclipse,項目名稱:scanning,代碼行數:9,代碼來源:ModelViewer.java


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