org.eclipse.ui.internal.registry.PerspectiveDescriptor#org.eclipse.e4.ui.workbench.modeling.EPartService源码实例Demo

下面列出了org.eclipse.ui.internal.registry.PerspectiveDescriptor#org.eclipse.e4.ui.workbench.modeling.EPartService 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: e4macs   文件: SwitchToBufferHandler.java
/**
 * Cursor enablement for E4
 */
private void forceActivate() {
	EPartService partService = (EPartService)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
	partService.activate(null);
	partService.activate(partService.getActivePart(),true);
	// E4 activation seems slightly hosed - add this in
	EmacsPlusUtils.asyncUiRun(new Runnable() {
		public void run() {
			try {
				// this will finish activating
				EmacsPlusUtils.executeCommand("org.eclipse.ui.window.activateEditor", null);	//$NON-NLS-1$
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	});
}
 
/**
 * Register to selection service to update button enablement
 * Register the Automatic Perspective switch part listener
 */
@Override
public void postWindowOpen() {
    IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
    configurer.addEditorAreaTransfer(EditorInputTransfer.getInstance());
    configurer.addEditorAreaTransfer(ResourceTransfer.getInstance());
    configurer.addEditorAreaTransfer(FileTransfer.getInstance());
    configurer.addEditorAreaTransfer(MarkerTransfer.getInstance());
    configurer.configureEditorAreaDropListener(new EditorAreaDropAdapter(
            configurer.getWindow()));

    final MWindow model = ((WorkbenchPage) window.getActivePage()).getWindowModel();
    model.getContext().get(EPartService.class).addPartListener(new AutomaticSwitchPerspectivePartListener());
    final Object widget = model.getWidget();
    if (widget instanceof Shell) {
        ((Widget) widget).setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, SWTBotConstants.SWTBOT_ID_MAIN_SHELL);
    }
    // Replace ObjectActionContributorManager with filtered actions
    CustomObjectActionContributorManager.getManager();
}
 
源代码3 项目: offspring   文件: ShowNXTPerspectiveHandler.java
@Execute
public void execute(MApplication app, EPartService partService,
    EModelService modelService) {
  MPerspective element = (MPerspective) modelService.find(PART_ID, app);
  if (element != null) {
    partService.switchPerspective(element);
    logger.trace("Switch to " + PART_ID);
  }
}
 
源代码4 项目: offspring   文件: ShowTraderPerspectiveHandler.java
@Execute
public void execute(MApplication app, EPartService partService,
    EModelService modelService) {
  MPerspective element = (MPerspective) modelService.find(PART_ID, app);
  partService.switchPerspective(element);
  logger.trace("Switch to " + PART_ID);
}
 
源代码5 项目: codeexamples-eclipse   文件: SaveHandler.java
@CanExecute
public boolean canExecute(EPartService partService) {
	if (partService != null) {
		return !partService.getDirtyParts().isEmpty();
	}
	return false;
}
 
源代码6 项目: codeexamples-eclipse   文件: SaveHandler.java
@CanExecute
public boolean canExecute(EPartService partService) {
	if (partService != null) {
		return !partService.getDirtyParts().isEmpty();
	}
	return false;
}
 
源代码7 项目: codeexamples-eclipse   文件: SaveHandler.java
@CanExecute
public boolean canExecute(EPartService partService) {
	if (partService != null) {
		return !partService.getDirtyParts().isEmpty();
	}
	return false;
}
 
@Execute
public void execute(EModelService modelService, EPartService partService,
		MWindow window,
		@Named("com.vogella.rcp.jface.translation.commandparameter.perspectiveid") String id) {
	MPerspective activePerspective = modelService
			.getActivePerspective(window);


	MUIElement find = modelService.find(id, window);
	if (find == null || activePerspective.equals(find)) {
		return;
	}

	partService.switchPerspective((MPerspective) find);
}
 
@Execute
public void execute(EModelService modelService, MWindow window, EPartService partService) {

	// get active perpective and find stored snippet of this perspective
	MPerspective activePerspective = modelService.getActivePerspective(window);
	MUIElement perspectiveSnippet = modelService.cloneSnippet(window, activePerspective.getElementId(), window);

	// remove existing active perspective
	MElementContainer<MUIElement> parent = activePerspective.getParent();
	modelService.removePerspectiveModel(activePerspective, window);

	// add stored perspective snippet and switch to it
	parent.getChildren().add(perspectiveSnippet);
	partService.switchPerspective((MPerspective) perspectiveSnippet);
}
 
源代码10 项目: codeexamples-eclipse   文件: SaveHandler.java
@CanExecute
public boolean canExecute(EPartService partService) {
	if (partService != null) {
		return !partService.getDirtyParts().isEmpty();
	}
	return false;
}
 
源代码11 项目: codeexamples-eclipse   文件: SaveHandler.java
@CanExecute
public boolean canExecute(EPartService partService) {
	if (partService != null) {
		return !partService.getDirtyParts().isEmpty();
	}
	return false;
}
 
源代码12 项目: codeexamples-eclipse   文件: SaveHandler.java
@CanExecute
public boolean canExecute(EPartService partService) {
	if (partService != null) {
		return !partService.getDirtyParts().isEmpty();
	}
	return false;
}
 
源代码13 项目: codeexamples-eclipse   文件: SaveHandler.java
@CanExecute
public boolean canExecute(EPartService partService) {
	if (partService != null) {
		return !partService.getDirtyParts().isEmpty();
	}
	return false;
}
 
源代码14 项目: codeexamples-eclipse   文件: SaveHandler.java
@CanExecute
public boolean canExecute(EPartService partService) {
	if (partService != null) {
		return !partService.getDirtyParts().isEmpty();
	}
	return false;
}
 
源代码15 项目: e4Preferences   文件: SaveHandler.java
@CanExecute
public boolean canExecute(EPartService partService) {
	if (partService != null) {
		return !partService.getDirtyParts().isEmpty();
	}
	return false;
}
 
源代码16 项目: e4macs   文件: WindowJoinCmd.java
void closePart(MPart part) {
	// based on org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.closePart()
	IEclipseContext context = part.getContext();
	if (context != null && part.isCloseable()) {
		EPartService partService = context.get(EPartService.class);
		partService.hidePart(part,true);
	}
}
 
源代码17 项目: bonita-studio   文件: CoolbarToolControl.java
public void registerHandlers(final IEclipseContext context, final IWorkbenchPage page) {
    EPartService partService = context.get(EPartService.class);
    ESelectionService selectionService = context.get(ESelectionService.class);
    if (!isRegistered && partService != null && selectionService != null) {
        partService.addPartListener(CoolbarToolControl.this);
        selectionService.addSelectionListener(CoolbarToolControl.this);
        isRegistered = true;
    }
}
 
源代码18 项目: elexis-3-core   文件: PerspektiveImportHandler.java
private void switchToPerspectiveLegacy(MPerspective loadedPerspective,
	List<String> preLoadedFastViewIds){
	
	EModelService modelService = getService(EModelService.class);
	EPartService partService = getService(EPartService.class);
	MApplication mApplication = getService(MApplication.class);
	MTrimmedWindow mWindow = (MTrimmedWindow) modelService.find("IDEWindow", mApplication);
	if (mWindow == null) {
		List<MWindow> windows = mApplication.getChildren();
		if (!windows.isEmpty() && windows.get(0) instanceof MTrimmedWindow) {
			mWindow = (MTrimmedWindow) windows.get(0);
		}
	}
	MPerspective activePerspective = modelService.getActivePerspective(mWindow);
	MElementContainer<MUIElement> perspectiveParent = activePerspective.getParent();
	List<String> fastViewIds = preLoadedFastViewIds;
	
	// add the loaded perspective and switch to it
	String id = loadedPerspective.getElementId();
	Iterator<MUIElement> it = perspectiveParent.getChildren().iterator();
	while (it.hasNext()) {
		MUIElement element = it.next();
		if (id.equals(element.getElementId()) || element.getElementId().startsWith(id + ".<")) {
			it.remove();
		}
	}
	perspectiveParent.getChildren().add(loadedPerspective);
	
	// add fast view
	for (String fastViewId : fastViewIds) {
		ElexisFastViewUtil.addToFastView(loadedPerspective.getElementId(), fastViewId);
	}
	// the workbench window must be on top - otherwise the exception 'Application does not have an active window' occurs
	PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().open();
	
	partService.switchPerspective(loadedPerspective);
}
 
源代码19 项目: gama   文件: ArrangeDisplayViews.java
private static EPartService getPartService() {
	return WorkbenchHelper.getService(EPartService.class);
}
 
源代码20 项目: offspring   文件: ShowHomePerspectiveHandler.java
@Execute
public void execute(MApplication app, EPartService partService, EModelService modelService) {
  MPerspective element = (MPerspective) modelService.find(PART_ID, app);
  partService.switchPerspective(element);
}
 
源代码21 项目: offspring   文件: ShowAccountPerspectiveHandler.java
@Execute
public void execute(MApplication app, EPartService partService, EModelService modelService) {
  MPerspective element = (MPerspective) modelService.find(PART_ID, app);
  partService.switchPerspective(element);
  logger.trace("Switch to " + PART_ID);
}
 
源代码22 项目: codeexamples-eclipse   文件: SaveHandler.java
@Execute
public void execute(EPartService partService) {
	partService.saveAll(false);
}
 
源代码23 项目: codeexamples-eclipse   文件: SaveHandler.java
@Execute
public void execute(EPartService partService) {
	partService.saveAll(false);
}
 
源代码24 项目: codeexamples-eclipse   文件: SaveHandler.java
@Execute
public void execute(EPartService partService) {
	partService.saveAll(false);
}
 
源代码25 项目: codeexamples-eclipse   文件: SaveHandler.java
@Execute
public void execute(EPartService partService) {
	partService.saveAll(false);
}
 
源代码26 项目: codeexamples-eclipse   文件: SaveHandler.java
@Execute
public void execute(EPartService partService) {
	partService.saveAll(false);
}
 
源代码27 项目: codeexamples-eclipse   文件: SaveHandler.java
@Execute
public void execute(EPartService partService) {
	partService.saveAll(false);
}
 
源代码28 项目: codeexamples-eclipse   文件: SaveHandler.java
@Execute
public void execute(EPartService partService) {
	partService.saveAll(false);
}
 
源代码29 项目: codeexamples-eclipse   文件: SaveHandler.java
@Execute
public void execute(EPartService partService) {
	partService.saveAll(false);
}
 
源代码30 项目: e4Preferences   文件: SaveHandler.java
@Execute
public void execute(EPartService partService) {
	partService.saveAll(false);
}