Source:
<code>protected void addPages() { initialize(); Set<String> conflictingIds = new HashSet<String>(); ArrayList<AbstractTaskEditorPageFactory> pageFactories = new ArrayList<AbstractTaskEditorPageFactory>(); for (AbstractTaskEditorPageFactory pageFactory : TasksUiPlugin.getDefault().getTaskEditorPageFactories()) { if (pageFactory.canCreatePageFor(getTaskEditorInput()) && WorkbenchUtil.allowUseOf(pageFactory)) { pageFactories.add(pageFactory); String[] ids = pageFactory.getConflictingIds(getTaskEditorInput()); if (ids != null) { conflictingIds.addAll(Arrays.asList(ids)); } } } for (Iterator<AbstractTaskEditorPageFactory> it = pageFactories.iterator(); it.hasNext();) { if (conflictingIds.contains(it.next().getId())) { it.remove(); } } Collections.sort(pageFactories, new Comparator<AbstractTaskEditorPageFactory>() { public int compare(AbstractTaskEditorPageFactory o1, AbstractTaskEditorPageFactory o2) { return o1.getPriority() - o2.getPriority(); } }); for (AbstractTaskEditorPageFactory factory : pageFactories) { try { IFormPage page = factory.createPage(this); int index = addPage(page); setPageImage(index, factory.getPageImage(this, page)); setPageText(index, factory.getPageText(this, page)); if (factory.getPriority() == AbstractTaskEditorPageFactory.PRIORITY_TASK) { setActivePage(index); } if (page instanceof ISelectionProvider) { ((ISelectionProvider) page).addSelectionChangedListener(getActionBarContributor()); } } catch (Exception e) { StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not create editor via factory: " + factory, e)); } } final String CONTEXT_PAGE = "org.eclipse.mylyn.context.ui"; <START> if (!needsContext()) { <END> IFormPage page = findPage(CONTEXT_PAGE); if (page != null) { removePage(page.getIndex()); } } updateTitleImage(); updateHeaderToolBar(); installTitleDrag(getHeaderForm().getForm().getForm()); getEditorSite().registerContextMenu(menuManager, getEditorSite().getSelectionProvider(), true); }</code><technical_language>do this factory instead</technical_language>

Target:
protected void addPages() { initialize(); Set<String> conflictingIds = new HashSet<String>(); ArrayList<AbstractTaskEditorPageFactory> pageFactories = new ArrayList<AbstractTaskEditorPageFactory>(); for (AbstractTaskEditorPageFactory pageFactory : TasksUiPlugin.getDefault().getTaskEditorPageFactories()) { if (pageFactory.canCreatePageFor(getTaskEditorInput()) && WorkbenchUtil.allowUseOf(pageFactory)) { pageFactories.add(pageFactory); String[] ids = pageFactory.getConflictingIds(getTaskEditorInput()); if (ids != null) { conflictingIds.addAll(Arrays.asList(ids)); } } } for (Iterator<AbstractTaskEditorPageFactory> it = pageFactories.iterator(); it.hasNext();) { if (conflictingIds.contains(it.next().getId())) { it.remove(); } } Collections.sort(pageFactories, new Comparator<AbstractTaskEditorPageFactory>() { public int compare(AbstractTaskEditorPageFactory o1, AbstractTaskEditorPageFactory o2) { return o1.getPriority() - o2.getPriority(); } }); for (AbstractTaskEditorPageFactory factory : pageFactories) { try { IFormPage page = factory.createPage(this); int index = addPage(page); setPageImage(index, factory.getPageImage(this, page)); setPageText(index, factory.getPageText(this, page)); if (factory.getPriority() == AbstractTaskEditorPageFactory.PRIORITY_TASK) { setActivePage(index); } if (page instanceof ISelectionProvider) { ((ISelectionProvider) page).addSelectionChangedListener(getActionBarContributor()); } } catch (Exception e) { StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not create editor via factory: " + factory, e)); } } updateTitleImage(); updateHeaderToolBar(); installTitleDrag(getHeaderForm().getForm().getForm()); getEditorSite().registerContextMenu(menuManager, getEditorSite().getSelectionProvider(), true); }