当前位置: 首页>>代码示例>>Java>>正文


Java IViewReference类代码示例

本文整理汇总了Java中org.eclipse.ui.IViewReference的典型用法代码示例。如果您正苦于以下问题:Java IViewReference类的具体用法?Java IViewReference怎么用?Java IViewReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IViewReference类属于org.eclipse.ui包,在下文中一共展示了IViewReference类的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: showQueue

import org.eclipse.ui.IViewReference; //导入依赖的package包/类
private void showQueue() throws Exception {

		IViewReference[] refs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();

		boolean foundStatus = false;
		for (IViewReference vr : refs) {
			if (StatusQueueView.ID.equals(vr.getId())) foundStatus = true;
		}
		if (!foundStatus) {
			String secondId = XcenServices.getQueueViewSecondaryId();
			IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(StatusQueueView.ID+":"+secondId, null, IWorkbenchPage.VIEW_VISIBLE);
			if (part !=null && part instanceof StatusQueueView) {
				StatusQueueView view = (StatusQueueView)part;
				PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().bringToTop(view);
				view.refresh();
			}
		}
	}
 
开发者ID:eclipse,项目名称:scanning,代码行数:19,代码来源:XcenView.java

示例4: 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

示例5: createHandler

import org.eclipse.ui.IViewReference; //导入依赖的package包/类
/**
 * Creates and returns a new IGazeHandler object from the specified object
 * and partRef, or returns null if no handler object is defined for that object.
 */
public static IGazeHandler createHandler(Object target,
        IWorkbenchPartReference partRef) {
	
	// create gaze handler for a StyledText widget within an EditorPart
    if (target instanceof StyledText &&
            partRef instanceof IEditorReference) {
        return new StyledTextGazeHandler(target); //can go back to using partRef
    
    } else if (target instanceof Browser) {
    	//create gaze handler for a Browser Stack overflow and Bug Report widget
    	//cannot get associated partRef
    	return new BrowserGazeHandler(target);

    } else if (target instanceof Tree &&
    		partRef instanceof IViewReference &&
    		partRef.getTitle().equals("Project Explorer")) {
    	//create gaze handler for a Project Explorer Tree
        return new ProjectExplorerGazeHandler(target, partRef);
    }

    return null;
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:27,代码来源:GazeHandlerFactory.java

示例6: evaluate

import org.eclipse.ui.IViewReference; //导入依赖的package包/类
public boolean evaluate() {
  if (!PlatformUI.isWorkbenchRunning()) {
    return true;
  }
  final IWorkbench workbench = PlatformUI.getWorkbench();
  if (workbench == null) {
    return true;
  }

  final Set<String> remaining = Sets.newHashSet(list);
  Display.getDefault().syncExec(new Runnable() {
    public void run() {
      for (IWorkbenchWindow workbenchWindow : workbench.getWorkbenchWindows()) {
        for (IWorkbenchPage workbenchPage : workbenchWindow.getPages()) {
          for (IViewReference viewReference : workbenchPage.getViewReferences()) {
            remaining.remove(viewReference.getId());
          }
        }
      }
    }
  });
  return remaining.isEmpty();
}
 
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:24,代码来源:ShowViewScanner.java

示例7: 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

示例8: 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

示例9: RenameSelectionState

import org.eclipse.ui.IViewReference; //导入依赖的package包/类
public RenameSelectionState(Object element) {
	fElement = element;
	fParts = new ArrayList<>();
	fSelections = new ArrayList<>();

	IWorkbenchWindow dw = JavaScriptPlugin.getActiveWorkbenchWindow();
	if (dw == null) {
		fDisplay = null;
		return;
	}
	fDisplay = dw.getShell().getDisplay();
	IWorkbenchPage page = dw.getActivePage();
	if (page == null)
		return;
	IViewReference vrefs[] = page.getViewReferences();
	for (int i = 0; i < vrefs.length; i++) {
		consider(vrefs[i].getPart(false));
	}
	IEditorReference refs[] = page.getEditorReferences();
	for (int i = 0; i < refs.length; i++) {
		consider(refs[i].getPart(false));
	}
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:24,代码来源:RenameSelectionState.java

示例10: 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

示例11: execute

import org.eclipse.ui.IViewReference; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException
{
	String partId = event.getParameter(PART_ARG);
	IWorkbenchWindow activeWindow = PlatformUI.getWorkbench()
	        .getActiveWorkbenchWindow();
	IWorkbenchPage page = activeWindow.getActivePage();
	if (page != null)
	{
		IViewReference ref = page.findViewReference(partId);
		if (ref != null)
		{
			Printable printable = (Printable) ref.getPart(false)
			        .getAdapter(Printable.class);
			return printable;
		}
	}
	return null;
}
 
开发者ID:Spacecraft-Code,项目名称:SPELL,代码行数:20,代码来源:PartPrintableHandler.java

示例12: 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

示例13: closeProcedureView

import org.eclipse.ui.IViewReference; //导入依赖的package包/类
/***************************************************************************
 * Close a procedure view
 * 
 * @param procId
 *            The view identifier
 **************************************************************************/
private void closeProcedureView(String procId)
{
	Logger.debug("Close procedure view: " + procId, Level.PROC, this);
	IWorkbenchWindow wbw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	IWorkbenchPage page = wbw.getActivePage();
	if (page != null)
	{
		IViewReference ref = page.findViewReference(ProcedureView.ID, procId);
		if (ref != null)
		{
			getProcedureView(procId).setCloseable(true);
			wbw.getActivePage().hideView(ref);
			unregisterProcView(procId);
		}
	}
}
 
开发者ID:Spacecraft-Code,项目名称:SPELL,代码行数:23,代码来源:ViewManager.java

示例14: setSelectedAgent

import org.eclipse.ui.IViewReference; //导入依赖的package包/类
/**
 * Method setSelectedAgent()
 * 
 * @see msi.gama.common.interfaces.IGui#setSelectedAgent(msi.gama.metamodel.agent.IAgent)
 */
@Override
public void setSelectedAgent(final IAgent a) {
	WorkbenchHelper.asyncRun(() -> {
		if (WorkbenchHelper.getPage() == null) { return; }
		if (a == null) { return; }
		try {
			final InspectDisplayOutput output = new InspectDisplayOutput(a);
			output.launch(a.getScope());
		} catch (final GamaRuntimeException g) {
			g.addContext("In opening the agent inspector");
			GAMA.reportError(GAMA.getRuntimeScope(), g, false);
		}
		final IViewReference r = WorkbenchHelper.getPage().findViewReference(IGui.AGENT_VIEW_ID, "");
		if (r != null) {
			WorkbenchHelper.getPage().bringToTop(r.getPart(true));
		}
	});
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:24,代码来源:SwtGui.java

示例15: closeSimulationViews

import org.eclipse.ui.IViewReference; //导入依赖的package包/类
@Override
public void closeSimulationViews(final IScope scope, final boolean openModelingPerspective,
		final boolean immediately) {
	WorkbenchHelper.run(() -> {
		final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
		final IViewReference[] views = page.getViewReferences();

		for (final IViewReference view : views) {
			final IViewPart part = view.getView(false);
			if (part instanceof IGamaView) {
				((IGamaView) part).close(scope);

			}
		}
		if (openModelingPerspective) {
			PerspectiveHelper.openModelingPerspective(immediately);
		}
		getStatus(scope).neutralStatus("No simulation running");
	});

}
 
开发者ID:gama-platform,项目名称:gama,代码行数:22,代码来源:SwtGui.java


注:本文中的org.eclipse.ui.IViewReference类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。