
/*
 * Carrot2 project.
 *
 * Copyright (C) 2002-2015, Dawid Weiss, Stanisław Osiński.
 * All rights reserved.
 *
 * Refer to the full license file "carrot2.LICENSE"
 * in the root folder of the repository checkout or at:
 * http://www.carrot2.org/carrot2.LICENSE
 */

package org.carrot2.workbench.vis.aduna;

import org.apache.commons.lang.SystemUtils;
import org.carrot2.workbench.core.ui.PageBookViewBase;
import org.carrot2.workbench.core.ui.SearchEditor;
import org.carrot2.workbench.core.ui.actions.PreferenceStorePropertyHost;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.ui.*;

/**
 * {@link AdunaClusterMapView} displays clusters using Aduna's Cluster View component.
 * 
 * @see "http://www.aduna-software.com/technologies/clustermap/overview.view"
 */
public final class AdunaClusterMapView extends PageBookViewBase
{
    /**
     * Public identifier of this view.
     */
    public static final String ID = "org.carrot2.workbench.views.aduna";

    @Override
    public void init(IViewSite site) throws PartInitException
    {
        super.init(site);

        final IActionBars bars = getViewSite().getActionBars();
        createToolbar(bars.getToolBarManager());
        bars.updateActionBars();
    }

    @Override
    public void partOpened(IWorkbenchPart part) {
      // Aduna won't work on OsX (SWT_AWT bridge is broken, LINGO-466)
      if (part == this && SystemUtils.IS_OS_MAC_OSX) {
        getViewSite().getPage().hideView(this);
      }
    }

    private void createToolbar(IToolBarManager toolBarManager)
    {
        toolBarManager.add(new VisualizationModeAction(
            PreferenceConstants.VISUALIZATION_MODE, new PreferenceStorePropertyHost(
                AdunaActivator.plugin.getPreferenceStore())));
    }

    /**
     * Create a document list for the given part.
     */
    @Override
    protected PageRec doCreatePage(IWorkbenchPart part)
    {
        final SearchEditor editor = (SearchEditor) part;

        final AdunaClusterMapViewPage page = new AdunaClusterMapViewPage(editor);
        initPage(page);
        page.createControl(getPageBook());

        return new PageRec(part, page);
    }

    /**
     * Only react to {@link SearchEditor} instances.
     */
    @Override
    protected boolean isImportant(IWorkbenchPart part)
    {
        return (part instanceof SearchEditor);
    }
}

@@ -308,52 +308,8 @@
 a;%0A%0A
-import org.apache.commons.lang.SystemUtils;%0A
 impo
@@ -1197,261 +1197,8 @@
  %7D%0A%0A
-    @Override%0A    public void partOpened(IWorkbenchPart part) %7B%0A      // Aduna won't work on OsX (SWT_AWT bridge is broken, LINGO-466)%0A      if (part == this && SystemUtils.IS_OS_MAC_OSX) %7B%0A        getViewSite().getPage().hideView(this);%0A      %7D%0A    %7D%0A%0A
     

Revert "LINGO-466: hide aduna on macosx."