當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。