mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
- command contribution implemented properly
This commit is contained in:
parent
a7b0ef2fef
commit
56c7ec129c
8 changed files with 114 additions and 21 deletions
|
@ -1,16 +1,18 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Codan Analysis UI for C/C++
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: org.eclipse.cdt.codan.ui.cxx;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.codan.internal.ui.cxx.Activator
|
||||
Bundle-Vendor: Eclipse CDT
|
||||
Bundle-Vendor: %Bundle-Vendor
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
org.eclipse.cdt.codan.core;bundle-version="1.0.0",
|
||||
org.eclipse.cdt.codan.core.cxx;bundle-version="1.0.0",
|
||||
org.eclipse.ui.editors,
|
||||
org.eclipse.cdt.core,
|
||||
org.eclipse.cdt.ui
|
||||
org.eclipse.cdt.ui,
|
||||
org.eclipse.core.resources,
|
||||
org.eclipse.cdt.codan.ui;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Bundle-ActivationPolicy: lazy
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
#Properties file for org.eclipse.cdt.codan.ui.cxx
|
||||
command.name = Run C/C++ Code Analysis
|
||||
Bundle-Vendor = Eclipse CDT
|
||||
Bundle-Name = Codan Analysis UI for C/C++
|
|
@ -2,4 +2,5 @@ source.. = src/
|
|||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml
|
||||
plugin.xml,\
|
||||
OSGI-INF/l10n/bundle.properties
|
||||
|
|
|
@ -7,5 +7,37 @@
|
|||
<startup
|
||||
class="org.eclipse.cdt.codan.internal.ui.cxx.Startup"></startup>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.menus">
|
||||
<menuContribution
|
||||
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
|
||||
<command
|
||||
commandId="org.eclipse.cdt.codan.commands.runCodanCommand"
|
||||
id="org.eclipse.cdt.codan.ui.cxx.menus.runCodanCxxCommand"
|
||||
label="%command.name"
|
||||
mnemonic="C">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<iterate ifEmpty="false">
|
||||
<adapt type="org.eclipse.core.resources.IResource">
|
||||
<test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature"/>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
<!-- <menuContribution
|
||||
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
|
||||
<toolbar
|
||||
id="org.eclipse.cdt.codan.ui.cxx.toolbars.sampleToolbar">
|
||||
<command
|
||||
commandId="org.eclipse.cdt.codan.ui.cxx.commands.runCodanCxxCommand"
|
||||
icon="icons/sample.gif"
|
||||
id="org.eclipse.cdt.codan.ui.cxx.toolbars.sampleCommand"
|
||||
tooltip="%command.name">
|
||||
</command>
|
||||
</toolbar>
|
||||
</menuContribution> -->
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -13,4 +13,8 @@ Require-Bundle: org.eclipse.ui,
|
|||
org.eclipse.cdt.codan.core;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: org.eclipse.cdt.codan.internal.ui;x-friends:="org.eclipse.cdt.codan.ui.cxx",
|
||||
org.eclipse.cdt.codan.internal.ui.actions;x-friends:="org.eclipse.cdt.codan.ui.cxx",
|
||||
org.eclipse.cdt.codan.internal.ui.dialogs;x-friends:="org.eclipse.cdt.codan.ui.cxx",
|
||||
org.eclipse.cdt.codan.internal.ui.preferences;x-friends:="org.eclipse.cdt.codan.ui.cxx"
|
||||
|
||||
|
|
|
@ -4,4 +4,6 @@ Bundle-Name = Code Analysis UI
|
|||
CodeAnalysisAction.label = Run Code Analysis
|
||||
CodeAnalysisProperties.name = Code Analysis
|
||||
CodeAnalysisPreferences.name = Code Analysis
|
||||
CodeAnalysisPreferencesBuild.name = Launching
|
||||
CodeAnalysisPreferencesBuild.name = Launching
|
||||
category.name = Code Analysis
|
||||
command.name = Run Code Analysis
|
|
@ -3,23 +3,14 @@
|
|||
<plugin>
|
||||
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.popupMenus">
|
||||
<objectContribution
|
||||
adaptable="true"
|
||||
objectClass="org.eclipse.core.resources.IProject"
|
||||
nameFilter="*"
|
||||
id="org.eclipse.cdt.codan.ui.runaction">
|
||||
<action
|
||||
label="%CodeAnalysisAction.label"
|
||||
class="org.eclipse.cdt.codan.internal.ui.actions.RunCodeAnalysis"
|
||||
menubarPath="additions"
|
||||
enablesFor="+"
|
||||
id="org.eclipse.cdt.codan.ui.actions.RunCodeAnalysis">
|
||||
</action>
|
||||
</objectContribution>
|
||||
<extension
|
||||
point="org.eclipse.ui.commands">
|
||||
<category
|
||||
id="org.eclipse.cdt.codan.ui.commands.category"
|
||||
name="%category.name">
|
||||
</category>
|
||||
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.preferencePages">
|
||||
<page
|
||||
|
@ -63,4 +54,30 @@
|
|||
</initializer>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.commands">
|
||||
<command
|
||||
categoryId="org.eclipse.cdt.codan.ui.commands.category"
|
||||
id="org.eclipse.cdt.codan.commands.runCodanCommand"
|
||||
name="%command.name">
|
||||
</command>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.handlers">
|
||||
<handler
|
||||
class="org.eclipse.cdt.codan.ui.handlers.RunCodanCommand"
|
||||
commandId="org.eclipse.cdt.codan.commands.runCodanCommand">
|
||||
</handler>
|
||||
</extension>
|
||||
<!--
|
||||
<extension
|
||||
point="org.eclipse.ui.bindings">
|
||||
<key
|
||||
commandId="org.eclipse.cdt.codan.commands.runCodanCommand"
|
||||
contextId="org.eclipse.ui.contexts.window"
|
||||
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
|
||||
sequence="M1+F9">
|
||||
</key>
|
||||
</extension>
|
||||
-->
|
||||
</plugin>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package org.eclipse.cdt.codan.ui.handlers;
|
||||
|
||||
import org.eclipse.cdt.codan.internal.ui.actions.RunCodeAnalysis;
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
/**
|
||||
* Command to run code analysis AbstractHandler, an IHandler base class.
|
||||
* @see org.eclipse.core.commands.IHandler
|
||||
* @see org.eclipse.core.commands.AbstractHandler
|
||||
*/
|
||||
public class RunCodanCommand extends AbstractHandler {
|
||||
|
||||
public RunCodanCommand() {
|
||||
}
|
||||
|
||||
/**
|
||||
* the command has been executed, so extract extract the needed information
|
||||
* from the application context.
|
||||
*/
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
|
||||
RunCodeAnalysis action = new RunCodeAnalysis();
|
||||
action.selectionChanged(null, currentSelection);
|
||||
action.run(null);
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue