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