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


Java PerspectiveRegistry类代码示例

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


PerspectiveRegistry类属于org.eclipse.ui.internal.registry包,在下文中一共展示了PerspectiveRegistry类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: savePerspectiveToRegistryLegacy

import org.eclipse.ui.internal.registry.PerspectiveRegistry; //导入依赖的package包/类
@SuppressWarnings("restriction")
private IPerspectiveDescriptor savePerspectiveToRegistryLegacy(MPerspective perspective){
	IPerspectiveRegistry perspectiveRegistry =
		(PerspectiveRegistry) PlatformUI.getWorkbench().getPerspectiveRegistry();
	IPerspectiveDescriptor pd =
		perspectiveRegistry.findPerspectiveWithId(perspective.getElementId());
	if (pd == null) {
		((PerspectiveRegistry) perspectiveRegistry).addPerspective(perspective);
		pd = perspectiveRegistry.findPerspectiveWithId(perspective.getElementId());
	} else {
		LoggerFactory.getLogger(PerspektiveImportHandler.class)
			.error("perspective descriptor already exists for perspective id: "
			+ perspective.getElementId());
	}
	
	return pd;
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:18,代码来源:PerspektiveImportHandler.java

示例2: dirtySavePerspective

import org.eclipse.ui.internal.registry.PerspectiveRegistry; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
static void dirtySavePerspective(final SimulationPerspectiveDescriptor sp) {
	try {
		final Field descField = PerspectiveRegistry.class.getDeclaredField("descriptors");
		descField.setAccessible(true);
		final Map m = (Map) descField.get(getPerspectiveRegistry());
		m.put(sp.getId(), sp);
	} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
		e.printStackTrace();
	}
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:12,代码来源:PerspectiveHelper.java

示例3: cleanupPerspectives

import org.eclipse.ui.internal.registry.PerspectiveRegistry; //导入依赖的package包/类
protected void cleanupPerspectives() {
	PerspectiveRegistry pRegistry = (PerspectiveRegistry) PlatformUI.getWorkbench().getPerspectiveRegistry();
	Collection<String> undesirables = getUndesirablePerspectives();
	List<IPerspectiveDescriptor> pToRemove = new ArrayList<IPerspectiveDescriptor>();
	for (IPerspectiveDescriptor pDesc : pRegistry.getPerspectives()) {
		if (undesirables.contains(pDesc.getId())) {
			pToRemove.add(pDesc);
		}
	}
	pRegistry.removeExtension(null, pToRemove.toArray(new Object[pToRemove.size()]));
	System.out.println();
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:13,代码来源:EnsembleWorkbenchWindowAdvisor.java

示例4: getPerspectiveRegistry

import org.eclipse.ui.internal.registry.PerspectiveRegistry; //导入依赖的package包/类
public static PerspectiveRegistry getPerspectiveRegistry() {
	return (PerspectiveRegistry) PlatformUI.getWorkbench().getPerspectiveRegistry();
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:4,代码来源:PerspectiveHelper.java

示例5: importPerspectiveFromStream

import org.eclipse.ui.internal.registry.PerspectiveRegistry; //导入依赖的package包/类
@SuppressWarnings("restriction")
private IPerspectiveDescriptor importPerspectiveFromStream(InputStream in, IStateCallback iStateHandle,
	boolean openPerspectiveIfAdded) throws IOException{
	MPerspective mPerspective = loadPerspectiveFromStream(in);
	if (mPerspective != null) {
		IPerspectiveRegistry iPerspectiveRegistry =
			PlatformUI.getWorkbench().getPerspectiveRegistry();
		
		// the perspective id to import
		String id = mPerspective.getElementId();
		IPerspectiveDescriptor existingPerspectiveDescriptor =
			iPerspectiveRegistry.findPerspectiveWithId(id);
		
		// the active perspective id
		String activePerspectiveId = getActivePerspectiveId();
		
		// check if the import should be done
		if (existingPerspectiveDescriptor == null || iStateHandle == null
			|| iStateHandle.state(State.OVERRIDE)) {
			
			IPerspectiveDescriptor activePd =
				iPerspectiveRegistry.findPerspectiveWithId(activePerspectiveId);
			
			// delete if a perspective with the id already exists
			int idx = deletePerspective(id);
			
			// add the new perspective to the registry
			((PerspectiveRegistry) iPerspectiveRegistry).addPerspective(mPerspective);
			IPerspectiveDescriptor createdPd = iPerspectiveRegistry.findPerspectiveWithId(id);
			if (createdPd != null) {
				((PerspectiveDescriptor) createdPd).setHasCustomDefinition(false); //no original descriptor should exists 
			}
			// check if the new perspective should be opened
			if (idx > -1 || openPerspectiveIfAdded) {
				openPerspective(createdPd);
				// there was already an opened active perspective switch back to it
				openPerspective(activePd);
			}
			return createdPd;
		}
		
	}
	return null;
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:45,代码来源:PerspectiveImportService.java

示例6: savePerspectiveAs

import org.eclipse.ui.internal.registry.PerspectiveRegistry; //导入依赖的package包/类
@SuppressWarnings("restriction")
@Override
public void savePerspectiveAs(String perspectiveId, String newName){
	EModelService modelService = getService(EModelService.class);
	MApplication mApplication = getService(MApplication.class);
	PerspectiveRegistry perspectiveRegistry =
		(PerspectiveRegistry) PlatformUI.getWorkbench().getPerspectiveRegistry();
	PerspectiveDescriptor existingPerspectiveDescriptor =
		(PerspectiveDescriptor) perspectiveRegistry.findPerspectiveWithId(perspectiveId);
	if (existingPerspectiveDescriptor != null) {
		
		int idx = isPerspectiveInsideStack(existingPerspectiveDescriptor);
		
		// loads the mapplication from the orginal descriptor
		openPerspective(existingPerspectiveDescriptor);
		
		// the model must be loaded
		List<MPerspective> modelPerspective = modelService.findElements(mApplication,
			existingPerspectiveDescriptor.getId(), MPerspective.class, null);
		
		// check if the model is loaded
		if (!modelPerspective.isEmpty()) {
			// create a new pd
			PerspectiveDescriptor newPd =
				perspectiveRegistry.createPerspective(newName, existingPerspectiveDescriptor);
			
			// saves an opens the new perspective
			PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
				.savePerspectiveAs(newPd);
			
			// close the new created one
			closePerspective(newPd);
			
			if (idx > -1) {
				// opens the original descriptor if it was already opened
				openPerspective(existingPerspectiveDescriptor);
			}
		}
		
	}
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:42,代码来源:PerspectiveImportService.java


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