<commit_before>/*******************************************************************************
 * Copyright (c) 2015 UNIT Information Technologies R&D Ltd 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: <NAME> - initial API and implementation <NAME> - initial API and
 * implementation <NAME> - initial API and implementation <NAME> - initial API and
 * implementation
 *******************************************************************************/
package eu.modelwriter.marker.ui.internal.wizards.markerwizard;

import java.io.IOException;

import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;

import eu.modelwriter.marker.Serialization;
import eu.modelwriter.marker.ui.Activator;

public class MarkerPage extends WizardPage {

  public static TreeViewer markTreeViewer = null;
  private String savedTree;
  public static IDialogSettings settings = Activator.getDefault().getDialogSettings();

  public MarkerPage() {
    super("Marking with Tag");
  }

  public static boolean isParsed() {
    return settings.get("alloyFile") != null;
  }

  @Override
  public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(1, false));

    markTreeViewer = new TreeViewer(composite);
    markTreeViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));

    MarkerTreeViewContentProvider treeViewerContentProvider = new MarkerTreeViewContentProvider();

    markTreeViewer.setLabelProvider(new MarkerTreeViewLabelProvider());
    markTreeViewer.setContentProvider(treeViewerContentProvider);

    savedTree = settings.get("universe");
    try {
      Object[] array = new Object[1];
      if (savedTree != null) {
        // hic sig yoksa univ cikmasin
        array[0] = Serialization.getInstance().fromString(savedTree);
        markTreeViewer.setInput(array);
      }
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
    markTreeViewer.expandAll();
    setPageComplete(true);
    setControl(composite);
  }
}
<commit_msg>Expand/Collapse Type TreeViewer by doubleClick has been added.<commit_after>/*******************************************************************************
 * Copyright (c) 2015 UNIT Information Technologies R&D Ltd 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: <NAME> - initial API and implementation <NAME> - initial API and
 * implementation <NAME> - initial API and implementation <NAME> - initial API and
 * implementation
 *******************************************************************************/
package eu.modelwriter.marker.ui.internal.wizards.markerwizard;

import java.io.IOException;

import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;

import eu.modelwriter.marker.Serialization;
import eu.modelwriter.marker.ui.Activator;

public class MarkerPage extends WizardPage {

  public static TreeViewer markTreeViewer = null;
  private String savedTree;
  public static IDialogSettings settings = Activator.getDefault().getDialogSettings();

  public MarkerPage() {
    super("Marking with Tag");
  }

  public static boolean isParsed() {
    return settings.get("alloyFile") != null;
  }

  @Override
  public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(1, false));

    markTreeViewer = new TreeViewer(composite);
    markTreeViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));

    MarkerTreeViewContentProvider treeViewerContentProvider = new MarkerTreeViewContentProvider();

    markTreeViewer.setLabelProvider(new MarkerTreeViewLabelProvider());
    markTreeViewer.setContentProvider(treeViewerContentProvider);

    markTreeViewer.addDoubleClickListener(new IDoubleClickListener() {

      @Override
      public void doubleClick(DoubleClickEvent event) {
        IStructuredSelection selection = (IStructuredSelection) event.getSelection();
        Object firstElement = selection.getFirstElement();
        if (markTreeViewer.isExpandable(firstElement)) {
          boolean expanded = markTreeViewer.getExpandedState(firstElement);
          markTreeViewer.setExpandedState(firstElement, !expanded);
        }

      }
    });

    savedTree = settings.get("universe");
    try {
      Object[] array = new Object[1];
      if (savedTree != null) {
        // hic sig yoksa univ cikmasin
        array[0] = Serialization.getInstance().fromString(savedTree);
        markTreeViewer.setInput(array);
      }
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
    markTreeViewer.expandAll();
    setPageComplete(true);
    setControl(composite);
  }
}

{'fraction_non_alphanumeric': 0.1448668564729526, 'fraction_numerical': 0.0036844749623178696, 'mean_word_length': 4.660663507109005, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '5634078', 'n_tokens_mistral': 1670, 'n_tokens_neox': 1611, 'n_words': 372}