mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
Add command an UI to reload the QML Analyzer.
This is just a temporary thing while we're developing it. Change-Id: Id83fac1fa22f451ead2de8493a4c7457320b8008
This commit is contained in:
parent
2df732fe9a
commit
8d898be364
3 changed files with 99 additions and 0 deletions
BIN
qt/org.eclipse.cdt.qt.ui/icons/sample.gif
Normal file
BIN
qt/org.eclipse.cdt.qt.ui/icons/sample.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 983 B |
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue