From 8d898be36427e71f47a32e08f8f2c219f369d2a8 Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Thu, 3 Dec 2015 11:06:26 -0500 Subject: Add command an UI to reload the QML Analyzer. This is just a temporary thing while we're developing it. Change-Id: Id83fac1fa22f451ead2de8493a4c7457320b8008 --- qt/org.eclipse.cdt.qt.ui/icons/sample.gif | Bin 0 -> 983 bytes qt/org.eclipse.cdt.qt.ui/plugin.xml | 52 +++++++++++++++++++++ .../cdt/qt/ui/handlers/ReloadAnalyzerHandler.java | 47 +++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 qt/org.eclipse.cdt.qt.ui/icons/sample.gif create mode 100644 qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/qt/ui/handlers/ReloadAnalyzerHandler.java (limited to 'qt') diff --git a/qt/org.eclipse.cdt.qt.ui/icons/sample.gif b/qt/org.eclipse.cdt.qt.ui/icons/sample.gif new file mode 100644 index 00000000000..34fb3c9d8cb Binary files /dev/null and b/qt/org.eclipse.cdt.qt.ui/icons/sample.gif differ diff --git a/qt/org.eclipse.cdt.qt.ui/plugin.xml b/qt/org.eclipse.cdt.qt.ui/plugin.xml index 4d873df09d8..c1b60a0562e 100644 --- a/qt/org.eclipse.cdt.qt.ui/plugin.xml +++ b/qt/org.eclipse.cdt.qt.ui/plugin.xml @@ -88,4 +88,56 @@ type="org.eclipse.cdt.qt.core.launchConfigurationType"> + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/qt/ui/handlers/ReloadAnalyzerHandler.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/qt/ui/handlers/ReloadAnalyzerHandler.java new file mode 100644 index 00000000000..78b4d8c036f --- /dev/null +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/qt/ui/handlers/ReloadAnalyzerHandler.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2015 QNX Software Systems and others. + * 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 + *******************************************************************************/ +package org.eclipse.cdt.qt.ui.handlers; + +import java.io.IOException; + +import javax.script.ScriptException; + +import org.eclipse.cdt.internal.qt.core.Activator; +import org.eclipse.cdt.qt.core.QMLAnalyzer; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; + +/** + * Our sample handler extends AbstractHandler, an IHandler base class. + * + * @see org.eclipse.core.commands.IHandler + * @see org.eclipse.core.commands.AbstractHandler + */ +public class ReloadAnalyzerHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + new Job("Reload QML Analyzer") { + @Override + protected IStatus run(IProgressMonitor monitor) { + try { + Activator.getService(QMLAnalyzer.class).load(); + } catch (NoSuchMethodException | ScriptException | IOException e) { + return Activator.error("Reloading QML Analyzer", e); + } + return Status.OK_STATUS; + } + }.schedule(); + return Status.OK_STATUS; + } +} -- cgit v1.2.3