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


Java IPartListener2类代码示例

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


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

示例1: addPartListenerToAllExistingPages

import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
private void addPartListenerToAllExistingPages(IPartListener2 eclipseListener) {
    for (IWorkbenchWindow window : eclipseAdapter.getWorkbench().getWorkbenchWindows()) {
        for (IWorkbenchPage page : window.getPages()) {
            page.addPartListener(eclipseListener);
        }
    }
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:8,代码来源:EditorManagementListenerMgr.java

示例2: removePartListenerFromAllExistingPages

import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
private void removePartListenerFromAllExistingPages(IPartListener2 eclipseListener) {
    for (IWorkbenchWindow window : eclipseAdapter.getWorkbench().getWorkbenchWindows()) {
        for (IWorkbenchPage page : window.getPages()) {
            page.removePartListener(eclipseListener);
        }
    }
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:8,代码来源:EditorManagementListenerMgr.java

示例3: removeEditorManagementListener

import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
/**
 * Removes an {@link IEditorManagementListener} from the set of listeners getting notified of
 * opened and closed {@link IEditorPart}s.
 * 
 * @param listener
 *            The listener to be removed.
 */
public void removeEditorManagementListener(final IEditorManagementListener listener) {
    if (!listeners.containsKey(listener)) {
        throw new NoSuchElementException(listener.toString());
    } else {
        final IPartListener2 eclipseListener = listeners.get(listener);
        eclipseAdapter.executeSynchronous(new Runnable() {
            @Override
            public void run() {
                removePartListenerFromAllExistingPages(eclipseListener);
            }
        });
        listeners.remove(listener);
    }
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:22,代码来源:EditorManagementListenerMgr.java

示例4: executionListenerIsFiredOnEditorOpen

import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
@Test
public void executionListenerIsFiredOnEditorOpen() {
    IPartListener2 createEditorListener = createStrictMock(IPartListener2.class);
    reset(createEditorListener);
    createEditorListener.partOpened(isA(IWorkbenchPartReference.class));
    expectLastCall().andAnswer(IS_ARG_IEDITORPART_ANSWER).times(1);
    replay(createEditorListener);

    eclipse.getActiveWorkbenchPage().addPartListener(createEditorListener);
    eclipseMockCtrl.openNewNonEMFEditorPart();

    verify(createEditorListener);
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:14,代码来源:EclipseMockTests.java

示例5: executionListenerIsFiredOnEMFTreeEditorOpen

import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
@Test
public void executionListenerIsFiredOnEMFTreeEditorOpen() {
    IPartListener2 createEditorListener = createStrictMock(IPartListener2.class);
    reset(createEditorListener);
    createEditorListener.partOpened(isA(IWorkbenchPartReference.class));
    expectLastCall().andAnswer(IS_ARG_IEDITORPART_ANSWER).times(1);
    replay(createEditorListener);

    eclipse.getActiveWorkbenchPage().addPartListener(createEditorListener);
    eclipseMockCtrl.openNewEMFTreeEditorPart(Files.DATATYPE_ECORE);

    verify(createEditorListener);
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:14,代码来源:EclipseMockTests.java

示例6: executionListenerIsFiredOnGMFEditorOpen

import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
@Test
public void executionListenerIsFiredOnGMFEditorOpen() {
    IPartListener2 createEditorListener = createStrictMock(IPartListener2.class);
    reset(createEditorListener);
    createEditorListener.partOpened(isA(IWorkbenchPartReference.class));
    expectLastCall().andAnswer(IS_ARG_IEDITORPART_ANSWER).times(1);
    replay(createEditorListener);

    eclipse.getActiveWorkbenchPage().addPartListener(createEditorListener);
    eclipseMockCtrl.openNewEMFDiagramEditorPart(Files.EXAMPLEMODEL_ECORE, Files.EXAMPLEMODEL_ECOREDIAG);

    verify(createEditorListener);
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:14,代码来源:EclipseMockTests.java

示例7: executionListenerIsFiredOnMultipleEditorOpen

import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
@Test
public void executionListenerIsFiredOnMultipleEditorOpen() {
    IPartListener2 createEditorListener = createStrictMock(IPartListener2.class);
    reset(createEditorListener);
    createEditorListener.partOpened(isA(IWorkbenchPartReference.class));
    expectLastCall().andAnswer(IS_ARG_IEDITORPART_ANSWER).times(3);
    replay(createEditorListener);

    eclipse.getActiveWorkbenchPage().addPartListener(createEditorListener);
    eclipseMockCtrl.openNewNonEMFEditorPart();
    eclipseMockCtrl.openNewEMFTreeEditorPart(Files.EMPTY_ECORE);
    eclipseMockCtrl.openNewEMFTreeEditorPart(Files.EMPTY_ECORE);
    verify(createEditorListener);
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:15,代码来源:EclipseMockTests.java

示例8: executionListenerIsFiredOnEditorClose

import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
@Test
public void executionListenerIsFiredOnEditorClose() {
    IPartListener2 createEditorListener = createStrictMock(IPartListener2.class);
    reset(createEditorListener);
    createEditorListener.partClosed(isA(IWorkbenchPartReference.class));
    expectLastCall().times(1);
    replay(createEditorListener);

    IEditorPart editor = eclipseMockCtrl.openNewNonEMFEditorPart();
    eclipse.getActiveWorkbenchPage().addPartListener(createEditorListener);
    eclipseMockCtrl.closeEditorPart(editor);

    verify(createEditorListener);
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:15,代码来源:EclipseMockTests.java

示例9: getPartListeners

import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
public Collection<IPartListener2> getPartListeners() {
    List<IPartListener2> result = new ArrayList<>();
    for (IWorkbenchPage page : this.partListeners.keySet()) {
        result.addAll(partListeners.get(page));
    }
    return result;
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:8,代码来源:EclipseWorkbenchMock.java

示例10: postWindowOpen

import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
/***************************************************************************
 * Called just after the workbench window is open.
 **************************************************************************/
public void postWindowOpen()
{
	// Show the master console as default. Showing this view must be
	// done this way in order to activate properly the log view.
	final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	try
	{
		window.getActivePage().showView(MasterView.ID);
	}
	catch (PartInitException e)
	{
		e.printStackTrace();
	}

	// Register the view manager for monitoring view operations
	IViewManager viewMgr = (IViewManager) ServiceManager.get(IViewManager.class);
	PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().addPartListener( (IPartListener2) viewMgr);
	
	// Show connection dialog in case of having procedures already loaded in the context
	final IContextProxy cproxy = (IContextProxy) ServiceManager.get(IContextProxy.class);
	if (cproxy.isConnected())
	{
		if (!cproxy.getAvailableExecutors().isEmpty())
		{
			final String ctx = cproxy.getCurrentContext();
			Display.getDefault().syncExec( new Runnable()
			{
				public void run()
				{
					MessageDialog.openInformation(window.getShell(), "Open procedures", 
							"There are procedures open on the current context " + ctx + ".\n\n" +
					        "Be aware of that there is a limit for the number of open procedures in the GCS system.\n\n" +
							"It should be recommended to check the Master View for details.");
					
				}
			});
		}
	}
}
 
开发者ID:Spacecraft-Code,项目名称:SPELL,代码行数:43,代码来源:ApplicationWorkbenchWindowAdvisor.java

示例11: assignBoxPartListener

import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
private void assignBoxPartListener() {
	final IPartService partService = getSite().getWorkbenchWindow().getPartService();
	if (partService == null) { return; }
	if (partListeners == null) {
		partListeners = new HashMap<IPartService, IPartListener2>();
	}
	final IPartListener2 oldListener = partListeners.get(partService);
	if (oldListener == null) {
		final IPartListener2 listener = new BoxDecoratorPartListener();
		partService.addPartListener(listener);
		partListeners.put(partService, listener);
	}
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:14,代码来源:GamlEditor.java

示例12: createDisposeListener

import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
@Override
protected Optional<IPartListener2> createDisposeListener(IEditorPart editorPart) {
    if (editorPart instanceof CoreMultiDiagramEditor) {
        ((CoreMultiDiagramEditor) editorPart).onClose(() -> this.editorClosed(editorPart.getSite().getPage()));
    }
    return Optional.empty();
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:8,代码来源:PapyrusCDOLauncher.java

示例13: removeListener

import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
public void removeListener(IPartListener2 listener) {
	IWorkbenchPage page = EmacsPlusUtils.getWorkbenchPage(); 
	if (page != null && location != null) {
		page.removePartListener(listener);
	}
	location.clearListener();
	location = null;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:9,代码来源:TecoRegister.java

示例14: registerEclipseListener

import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
private void registerEclipseListener(IEditorManagementListener listener, IPartListener2 eclipseListener) {
    listeners.put(listener, eclipseListener);
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:4,代码来源:EditorManagementListenerMgr.java

示例15: getEclipseListener

import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
private IPartListener2 getEclipseListener(IEditorManagementListener listener) {
    return listeners.get(listener);
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:4,代码来源:EditorManagementListenerMgr.java


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