From 95a795f3aec972b5421149027136bb2138d7312d Mon Sep 17 00:00:00 2001 From: Jean-Christian Kouame Date: Mon, 25 Jan 2016 16:14:57 -0500 Subject: [PATCH] tmf : Remove import XML analysis command Change-Id: Ia8626d3a797caa9ed8a8942a0c7934b0e357bb3e Signed-off-by: Jean-Christian Kouame Reviewed-on: https://git.eclipse.org/r/65142 Reviewed-by: Hudson CI Reviewed-by: Bernd Hufmann Tested-by: Bernd Hufmann Reviewed-by: Genevieve Bastien --- .../plugin.properties | 4 - .../plugin.xml | 63 ---------- .../xml/ui/handler/ImportXmlHandler.java | 110 ------------------ .../tmf/analysis/xml/ui/module/Messages.java | 35 ------ .../xml/ui/module/messages.properties | 12 -- 5 files changed, 224 deletions(-) delete mode 100644 tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/handler/ImportXmlHandler.java delete mode 100644 tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/module/Messages.java delete mode 100644 tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/module/messages.properties diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/plugin.properties b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/plugin.properties index cda2a464b9..15aa19ac62 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/plugin.properties +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/plugin.properties @@ -13,10 +13,6 @@ 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 diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/plugin.xml b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/plugin.xml index 0b84f90f8a..67fb3b1911 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/plugin.xml +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/plugin.xml @@ -9,12 +9,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 index 8416964bb4..0000000000 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/handler/ImportXmlHandler.java +++ /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 index fa9f9575ca..0000000000 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/module/Messages.java +++ /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 index 3059e008b1..0000000000 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/tmf/analysis/xml/ui/module/messages.properties +++ /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 -- 2.34.1