本文整理汇总了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);
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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.");
}
});
}
}
}
示例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);
}
}
示例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();
}
示例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;
}
示例14: registerEclipseListener
import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
private void registerEclipseListener(IEditorManagementListener listener, IPartListener2 eclipseListener) {
listeners.put(listener, eclipseListener);
}
示例15: getEclipseListener
import org.eclipse.ui.IPartListener2; //导入依赖的package包/类
private IPartListener2 getEclipseListener(IEditorManagementListener listener) {
return listeners.get(listener);
}