Skip to main content
summaryrefslogtreecommitdiffstats
path: root/qt
diff options
context:
space:
mode:
authorDoug Schaefer2015-12-03 16:06:26 +0000
committerDoug Schaefer2015-12-03 17:09:47 +0000
commit8d898be36427e71f47a32e08f8f2c219f369d2a8 (patch)
tree19e363d092e181c7cad3a7ba24d603b9b9a9d921 /qt
parent2df732fe9a113fffd27bf989a374eeed459359d5 (diff)
downloadorg.eclipse.cdt-8d898be36427e71f47a32e08f8f2c219f369d2a8.tar.gz
org.eclipse.cdt-8d898be36427e71f47a32e08f8f2c219f369d2a8.tar.xz
org.eclipse.cdt-8d898be36427e71f47a32e08f8f2c219f369d2a8.zip
Add command an UI to reload the QML Analyzer.
This is just a temporary thing while we're developing it. Change-Id: Id83fac1fa22f451ead2de8493a4c7457320b8008
Diffstat (limited to 'qt')
-rw-r--r--qt/org.eclipse.cdt.qt.ui/icons/sample.gifbin0 -> 983 bytes
-rw-r--r--qt/org.eclipse.cdt.qt.ui/plugin.xml52
-rw-r--r--qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/qt/ui/handlers/ReloadAnalyzerHandler.java47
3 files changed, 99 insertions, 0 deletions
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
--- /dev/null
+++ b/qt/org.eclipse.cdt.qt.ui/icons/sample.gif
Binary files 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">
</launchConfigurationTabGroup>
</extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.cdt.qt.ui.handlers.ReloadAnalyzerHandler"
+ commandId="org.eclipse.cdt.qt.ui.commands.sampleCommand">
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.eclipse.cdt.qt.ui.commands.sampleCommand"
+ contextId="org.eclipse.ui.contexts.window"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+6">
+ </key>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:help">
+ <command
+ commandId="org.eclipse.cdt.qt.ui.commands.sampleCommand"
+ id="org.eclipse.cdt.qt.ui.menus.sampleCommand"
+ mnemonic="R"
+ style="push">
+ </command>
+ </menuContribution>
+ <menuContribution
+ locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
+ <toolbar
+ id="org.eclipse.cdt.qt.ui.toolbars.sampleToolbar">
+ <command
+ commandId="org.eclipse.cdt.qt.ui.commands.sampleCommand"
+ icon="icons/sample.gif"
+ id="org.eclipse.cdt.qt.ui.toolbars.sampleCommand"
+ tooltip="Reloads the QML Anayzer Tern Server">
+ </command>
+ </toolbar>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <category
+ id="org.eclipse.cdt.qt.ui.commands.category"
+ name="Qt Commands">
+ </category>
+ <command
+ categoryId="org.eclipse.cdt.qt.ui.commands.category"
+ id="org.eclipse.cdt.qt.ui.commands.sampleCommand"
+ name="Reload QML Analyzer">
+ </command>
+ </extension>
</plugin>
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;
+ }
+}

Back to the top