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