<commit_before>/*******************************************************************************
 * Copyright (c) 2009 <NAME>.
 * 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
 * Contributor:  <NAME> - initial API and implementation
 *******************************************************************************/
package de.loskutov.anyedit.jdt;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart;
import org.eclipse.jdt.internal.ui.workingsets.WorkingSetModel;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;

import de.loskutov.anyedit.AnyEditToolsPlugin;
import de.loskutov.anyedit.ui.wizards.IWSAction;

/**
 * Thic class is a dirty way to activate imported working sets into the Package Explorer
 *
 * @author Andrei
 */
public class SelectWorkingSetsAction extends Action implements IWSAction {

    private IWorkingSet[] workingSets;

    public SelectWorkingSetsAction() {
        super();
    }

    public void run() {
        if (workingSets == null || workingSets.length == 0) {
            return;
        }
        try {
            IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
            .getActivePage().showView(JavaUI.ID_PACKAGES);
            if (!(part instanceof PackageExplorerPart)) {
                return;
            }
            PackageExplorerPart viewPart = (PackageExplorerPart) part;
            // Eclipse 3.3: ViewActionGroup.SHOW_WORKING_SETS, value is 2
            // XXX Eclipse 3.4: PackageExplorerPart.WORKING_SETS_AS_ROOTS
            int showWS = 2;
            if (viewPart.getRootMode() != showWS) {
                viewPart.rootModeChanged(showWS);
            }
            WorkingSetModel workingSetModel = viewPart.getWorkingSetModel();
            IWorkingSet[] active = workingSetModel.getActiveWorkingSets();
            List all = new ArrayList();
            for (int i = 0; i < active.length; i++) {
                all.add(active[i]);<commit_msg>Don't care about Eclipse 3.3 anymore. Lowest supported version is 3.5 now.<commit_after>/*******************************************************************************
 * Copyright (c) 2009 <NAME>.
 * 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
 * Contributor:  <NAME> - initial API and implementation
 *******************************************************************************/
package de.loskutov.anyedit.jdt;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart;
import org.eclipse.jdt.internal.ui.workingsets.WorkingSetModel;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;

import de.loskutov.anyedit.AnyEditToolsPlugin;
import de.loskutov.anyedit.ui.wizards.IWSAction;

/**
 * Thic class is a dirty way to activate imported working sets into the Package Explorer
 *
 * @author Andrei
 */
public class SelectWorkingSetsAction extends Action implements IWSAction {

    private IWorkingSet[] workingSets;

    public SelectWorkingSetsAction() {
        super();
    }

    public void run() {
        if (workingSets == null || workingSets.length == 0) {
            return;
        }
        try {
            IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
            .getActivePage().showView(JavaUI.ID_PACKAGES);
            if (!(part instanceof PackageExplorerPart)) {
                return;
            }
            PackageExplorerPart viewPart = (PackageExplorerPart) part;
            int showWS = PackageExplorerPart.WORKING_SETS_AS_ROOTS;
            if (viewPart.getRootMode() != showWS) {
                viewPart.rootModeChanged(showWS);
            }
            WorkingSetModel workingSetModel = viewPart.getWorkingSetModel();
            IWorkingSet[] active = workingSetModel.getActiveWorkingSets();
            List all = new ArrayList();
            for (int i = 0; i < active.length; i++) {
                all.add(active[i]);
{'fraction_non_alphanumeric': 0.15657094948648081, 'fraction_numerical': 0.006287989939216097, 'mean_word_length': 3.2342502218278617, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '2144208', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1266, 'n_words': 314}