我需要将一个部分(带有命令和处理程序)贡献给eclipse IDE。
我正在使用Eclipse RCP和RAP开发人员(Mars 4.5),而且我不知道如何对我的处理程序进行编程,所以我的部分将转到eclipse ide的编辑器。
我的贡献是这样的:
public class Menu extends ViewPart {
@PostConstruct
@Override
public void createPartControl(Composite parent) {
parent.setLayout(null);
Label lblService = new Label(parent, SWT.NONE);
lblService.setBounds(67, 49, 40, 15);
lblService.setText("Service:");
Combo combo = new Combo(parent, SWT.NONE);
combo.setBounds(112, 45, 213, 23);
Label lblOperacion = new Label(parent, SWT.NONE);
lblOperacion.setBounds(51, 97, 56, 15);
lblOperacion.setText("Operation:");
Combo combo_1 = new Combo(parent, SWT.NONE);
combo_1.setBounds(112, 93, 214, 23);
Label lblRequest = new Label(parent, SWT.NONE);
lblRequest.setBounds(62, 145, 45, 15);
lblRequest.setText("Request:");
Combo combo_2 = new Combo(parent, SWT.NONE);
combo_2.setBounds(112, 141, 213, 23);
Button btnCommandButton = new Button(parent, SWT.NONE);
btnCommandButton.setBounds(223, 189, 108, 25);
btnCommandButton.setText("Command Button");
}
@Override
public void setFocus() {
// TODO Auto-generated method stub
}
我已经知道如何为另一个应用程序做出贡献,但不知道对于Eclipse的构想。 如果有人可以帮助我或给我一些想法,也许是一个带有这个或那个教程的网页...
编辑:好的,我发现有人在这里问几乎相同的问题:How to contribute a new view in eclipse 4.2?
没有人给出一个解决方案,因为该错误,但现在已经修复了4.5中的错误。
我的plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<extension
id="py.com.leverit.gepetto.services.tester.fragment"
point="org.eclipse.e4.workbench.model">
<fragment
uri="fragment.e4xmi">
</fragment>
</extension>
</plugin>
我的片段.4xmi:
<?xml version="1.0" encoding="ASCII"?>
<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmi:id="_HszDYEDxEeWo0NbVsB9ULA">
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_PCMHIEDyEeWo0NbVsB9ULA" featurename="children" parentElementId="menu:org.eclipse.ui.main.menu" positionInList="first">
<elements xsi:type="menu:Menu" xmi:id="_H5DcEEEEEeWo0NbVsB9ULA" elementId="py.com.leverit.gepetto.services.tester.menu.menucontributor" label="MenuContributor" iconURI="platform:/plugin/py.com.leverit.gepetto.services.tester/icons/sample.png">
<children xsi:type="menu:HandledMenuItem" xmi:id="_LkmgwEEEEeWo0NbVsB9ULA" elementId="py.com.leverit.gepetto.services.tester.handledmenuitem.view" label="View" command="_XWhHQEESEeWsyKfsIG3sSg"/>
</elements>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_NWq7UEEEEeWo0NbVsB9ULA" featurename="handlers" parentElementId="org.eclipse.e4.legacy.ide.application" positionInList="">
<elements xsi:type="commands:Handler" xmi:id="_Jgr_4EESEeWsyKfsIG3sSg" elementId="py.com.leverit.gepetto.services.tester.handler.tester" contributionURI="bundleclass://py.com.leverit.gepetto.services.tester/py.com.leverit.gepetto.services.tester.handler.TesterHandler" command="_XWhHQEESEeWsyKfsIG3sSg"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_VIr9wEESEeWsyKfsIG3sSg" featurename="coomand" parentElementId="org.eclipse.e4.legacy.ide.application">
<elements xsi:type="commands:Command" xmi:id="_XWhHQEESEeWsyKfsIG3sSg" elementId="py.com.leverit.gepetto.services.tester.command.tester" commandName="tester"/>
</fragments>
</fragment:ModelFragments>
EDIT2:好的,我发现了我需要做的事情,它始终在我眼前。如果有人来这里同样的事情可以去http://www.vogella.com/tutorials/EclipsePlugIn/article.html#plugin_ideextensionsintroducion