<commit_before>/*******************************************************************************
 * Copyright (c) 2004, 2008 Tasktop Technologies and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Tasktop Technologies - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylyn.internal.context.ui;

import org.eclipse.mylyn.internal.context.ui.actions.FocusOutlineAction;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPart;

/**
 * @author <NAME>
 */
public class ContentOutlineManager implements IPartListener {

	public void partBroughtToTop(IWorkbenchPart part) {
//		if (!ContextCorePlugin.getContextManager().isContextActive()) {
//			return;
//		} else {
		if (part instanceof IEditorPart) {
			IEditorPart editorPart = (IEditorPart) part;
			FocusOutlineAction applyAction = FocusOutlineAction.getOutlineActionForEditor(editorPart);
			if (applyAction != null) {
				applyAction.update(editorPart);
			}
		}
//		}
	}

	public void partActivated(IWorkbenchPart part) {
		// ignore
	}

	public void partOpened(IWorkbenchPart part) {<commit_msg>RESOLVED - bug 261977: [context] outline view does not filter contents when new editor is opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=261977<commit_after>/*******************************************************************************
 * Copyright (c) 2004, 2008 Tasktop Technologies and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Tasktop Technologies - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylyn.internal.context.ui;

import org.eclipse.mylyn.internal.context.ui.actions.FocusOutlineAction;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPart;

/**
 * @author <NAME>
 */
public class ContentOutlineManager implements IPartListener {

	public void partBroughtToTop(final IWorkbenchPart part) {
		Display.getDefault().asyncExec(new Runnable() {
			public void run() {
				if (part instanceof IEditorPart) {
					IEditorPart editorPart = (IEditorPart) part;
					FocusOutlineAction applyAction = FocusOutlineAction.getOutlineActionForEditor(editorPart);
					if (applyAction != null) {
						applyAction.update(editorPart);
					}
				}
			}
		});
	}

	public void partActivated(IWorkbenchPart part) {
		// ignore
	}

	public void partOpened(IWorkbenchPart part) {
{'fraction_non_alphanumeric': 0.19101123595505617, 'fraction_numerical': 0.011896893588896233, 'mean_word_length': 4.982213438735178, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2684054', 'n_tokens_mistral': 908, 'n_tokens_neox': 801, 'n_words': 209}