tmf : Remove import XML analysis command
authorJean-Christian Kouame <jean-christian.kouame@ericsson.com>
Mon, 25 Jan 2016 21:14:57 +0000 (16:14 -0500)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Tue, 9 Feb 2016 20:20:47 +0000 (15:20 -0500)
Change-Id: Ia8626d3a797caa9ed8a8942a0c7934b0e357bb3e
Signed-off-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/65142
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/plugin.properties
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/plugin.xml
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/handler/ImportXmlHandler.java [deleted file]
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/module/Messages.java [deleted file]
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/module/messages.properties [deleted file]

index cda2a464b94f10816ea927798b0b78e1486e395e..15aa19ac62ceba2825cbcf328cebbb3f6f591df1 100644 (file)
 Bundle-Vendor = Eclipse Trace Compass
 Bundle-Name = Trace Compass TMF XML Analysis UI Plug-in
 
-command.xml.import = Import XML analysis
-command.xml.import.mnemonic = I
-command.xml.import.description = Import an XML file containing analysis information
-
 command.manager.xml = Manage XML analyses
 command.manager.xml.mnemonic = M
 command.manager.xml.description = Manage XML files containing analysis information
index 0b84f90f8a00b023dd9db054472d97a614ac745a..67fb3b1911e0739cc94f78c19d929cbebf0ea008 100644 (file)
@@ -9,12 +9,6 @@
    </extension>
    <extension
          point="org.eclipse.ui.commands">
-      <command
-            categoryId="org.eclipse.linuxtools.tmf.ui.commands.category"
-            id="org.eclipse.linuxtools.tmf.analysis.xml.ui.importxml"
-            name="%command.xml.import"
-            description="%command.xml.import.description">
-      </command>
       <command
             categoryId="org.eclipse.linuxtools.tmf.ui.commands.category"
             description="%command.manager.xml.description"
          point="org.eclipse.ui.menus">
       <menuContribution
             locationURI="popup:org.eclipse.ui.popup.any?after=org.eclipse.linuxtools.tmf.ui.menu.managecustomparsers">
-         <command
-               commandId="org.eclipse.linuxtools.tmf.analysis.xml.ui.importxml"
-               label="%command.xml.import"
-               mnemonic="%command.xml.import.mnemonic"
-               style="push"
-               tooltip="%command.xml.import.description">
-            <visibleWhen
-                  checkEnabled="false">
-               <with
-                     variable="selection">
-                  <count
-                        value="1">
-                  </count>
-                  <iterate
-                        ifEmpty="false"
-                        operator="and">
-                     <or>
-                        <instanceof
-                           value="org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceFolder">
-                        </instanceof>
-                        <instanceof
-                           value="org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentFolder">
-                        </instanceof>
-                        <instanceof
-                           value="org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectElement">
-                        </instanceof>
-                     </or>
-                  </iterate>
-               </with>
-            </visibleWhen>
-         </command>
          <command
                commandId="org.eclipse.tracecompass.tmf.analysis.xml.ui.managexmlanalyses"
                label="%command.manager.xml"
    </extension>
    <extension
          point="org.eclipse.ui.handlers">
-      <handler
-            class="org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.handler.ImportXmlHandler"
-            commandId="org.eclipse.linuxtools.tmf.analysis.xml.ui.importxml">
-         <activeWhen>
-            <and>
-               <count
-                     value="1">
-               </count>
-               <iterate
-                     ifEmpty="false"
-                     operator="and">
-                  <or>
-                     <instanceof
-                        value="org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceFolder">
-                     </instanceof>
-                     <instanceof
-                        value="org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentFolder">
-                     </instanceof>
-                     <instanceof
-                        value="org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectElement">
-                     </instanceof>
-                  </or>
-               </iterate>
-            </and>
-         </activeWhen>
-      </handler>
       <handler
             class="org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.handler.ManageXMLAnalysisCommandHandler"
             commandId="org.eclipse.tracecompass.tmf.analysis.xml.ui.managexmlanalyses">
diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/handler/ImportXmlHandler.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/handler/ImportXmlHandler.java
deleted file mode 100644 (file)
index 8416964..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 École Polytechnique de Montréal
- *
- * 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:
- *   Geneviève Bastien - Initial implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.handler;
-
-import java.io.File;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tracecompass.tmf.analysis.xml.core.module.XmlAnalysisModuleSource;
-import org.eclipse.tracecompass.tmf.analysis.xml.core.module.XmlUtils;
-import org.eclipse.tracecompass.tmf.analysis.xml.ui.module.Messages;
-import org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectModelElement;
-import org.eclipse.tracecompass.tmf.ui.project.model.TraceUtils;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Imports and validates an XML file
- *
- * @author Geneviève Bastien
- */
-public class ImportXmlHandler extends AbstractHandler {
-
-    @Override
-    public Object execute(ExecutionEvent event) throws ExecutionException {
-
-        FileDialog dlg = new FileDialog(new Shell(), SWT.OPEN);
-        dlg.setFilterNames(new String[] { Messages.ImportXmlHandler_ImportXmlFile + " (*.xml)" }); //$NON-NLS-1$
-        dlg.setFilterExtensions(new String[] { "*.xml" }); //$NON-NLS-1$
-
-        String fn = dlg.open();
-        if (fn != null) {
-            File file = new File(fn);
-            IStatus status = XmlUtils.xmlValidate(file);
-            if (status.isOK()) {
-                status = XmlUtils.addXmlFile(file);
-                if (status.isOK()) {
-                    XmlAnalysisModuleSource.notifyModuleChange();
-                    /*
-                     * FIXME: It refreshes the list of analysis under a trace,
-                     * but since modules are instantiated when the trace opens,
-                     * the changes won't apply to an opened trace, it needs to
-                     * be closed then reopened
-                     */
-                    refreshProject();
-                } else {
-                    TraceUtils.displayErrorMsg(Messages.ImportXmlHandler_ImportXmlFile, status.getMessage());
-                }
-            } else {
-                TraceUtils.displayErrorMsg(Messages.ImportXmlHandler_ImportXmlFile, status.getMessage());
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * Refresh the selected project with the new XML file import
-     */
-    private static void refreshProject() {
-        // Check if we are closing down
-        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-        if (window == null) {
-            return;
-        }
-
-        // Get the selection
-        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
-        IWorkbenchPart part = page.getActivePart();
-        if (part == null) {
-            return;
-        }
-        ISelectionProvider selectionProvider = part.getSite().getSelectionProvider();
-        if (selectionProvider == null) {
-            return;
-        }
-        ISelection selection = selectionProvider.getSelection();
-
-        if (selection instanceof TreeSelection) {
-            TreeSelection sel = (TreeSelection) selection;
-            // There should be only one item selected as per the plugin.xml
-            Object element = sel.getFirstElement();
-            if (element instanceof TmfProjectModelElement) {
-                ((TmfProjectModelElement) element).getProject().refresh();
-            }
-        }
-
-    }
-
-}
diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/module/Messages.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/module/Messages.java
deleted file mode 100644 (file)
index fa9f957..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 École Polytechnique de Montréal
- *
- * 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:
- *   Geneviève Bastien - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.analysis.xml.ui.module;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Externalized messages for the XML analysis module package
- *
- * @author Geneviève Bastien
- */
-public class Messages extends NLS {
-    private static final String BUNDLE_NAME = "org.eclipse.tracecompass.tmf.analysis.xml.ui.module.messages"; //$NON-NLS-1$
-
-    /** Import XML file title */
-    public static String ImportXmlHandler_ImportXmlFile;
-
-    static {
-        // initialize resource bundle
-        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
-    }
-
-    private Messages() {
-    }
-}
diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/module/messages.properties b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/module/messages.properties
deleted file mode 100644 (file)
index 3059e00..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################
-# Copyright (c) 2014 Ericsson
-#
-# 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:
-#    Ericsson - Initial API and implementation
-###############################################################################
-ImportXmlHandler_ImportXmlFile=Import XML analysis file
This page took 0.029711 seconds and 5 git commands to generate.