I develop an Eclipse 3 plugin and I would like to set context menu item visibility from code.
My menuContribution parentID is #CompilationUnitEditorContext.
When I try to find HandledMenuItem by id with "ModelService.findElements" method, it cannot find it. I tried to find it in every way.
My Fragment.e4xmi:
<elements xsi:type="menu:MenuContribution" xmi:id="_htd08JlQEeexy-nXp72DpA" elementId="my-plugin.menucontribution.context" positionInParent="before=additions" parentId="#CompilationUnitEditorContext">
<children xsi:type="menu:HandledMenuItem" xmi:id="_lQM74JlQEeexy-nXp72DpA" elementId="my-plugin.handledmenuitem.contextmenuitem" label="Do something" command="_Rj_3AJlQEeexy-nXp72DpA"/>
</elements>
Get MenuItem with contextVariables.getApplication().getMenuContributions().getChildren().get(0) , then use setToBeRendered().
Related
I have a C# solution, with multiple projects, being managed in Rider.
For one project ("Proj1") I have multiple run configurations ("Proj1 A", and "Proj1 B").
By default the project explorer UI offers one of the configurations preferentially:
"Build Selected Projects"
"Run 'Proj1 A'"
"Debug 'Proj1 A'"
but I want to run 'Proj1 B' more often that 'Proj1 A'.
How can I can set which one is offered by default?
(It doesn't seem to be done alphabetically, it mostly seems to be "order of creation"!?
Find \.idea\**\workspace.xml.
In that XML file find elements: <project> -> <component name="RunManager"> -> <list>.
Inside the <list> element, find <item> elements looking like this:
<item itemvalue=".NET Project.Proj1 A" />
<item itemvalue=".NET Project.Proj1 B" />
Reverse them - Rider appears to use whichever one is listed first as the default run config to offer.
I have created my Apache Velocity template under /resources/fileTemplates/internal/myTemplateClass.vm and would like to use it through:
final JavaDirectoryServiceImpl javaDirectoryService = new JavaDirectoryServiceImpl();
javaDirectoryService.createClass(myPsiDirectory,
"MyClassname",
"myTemplateClass");
So I added the following in my plugin.xml:
<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
<internalFileTemplate name="myTemplateClass"/>
</extensions>
However when I run my plugin it claims that it did not find a template with the name "myTemplateClass". I assume it is cause I haven't linked to the file perse. Where should I link this?
Thanks
If you have an <internalFileTemplate> with the name of "myTemplateClass" and you want to use it to create a Java class, the template needs to be stored as fileTemplates/internal/myTemplateClass.java.ft. So you need to change the extension of your file.
What are my options for attaching an SPEmailEventReceiver to a document library? Should the Elements file contain the specific library?
<Elements.xml
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Receivers ListTemplateId="101">
<Receiver>
<Name>EventReceiver1EmailReceived</Name>
<Type>EmailReceived</Type>
<Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
<Class>EmailLogic.EventReceiver1.EventReceiver1</Class>
<SequenceNumber>10000</SequenceNumber>
</Receiver>
</Receivers>
</Elements>
What about manual, programatic or powershell to attach it?
Using VS is very easy, just select the Library after select List Email Event (using new element select "Event Receiver"), then in codebehind, using List parameter you can check if the Library is the one that you need comparing: ID, name, url, etc.
I would love to add support for Working Sets for my Eclipse plugin that used the Common Navigator framework.
In Eclipse bugzilla there is mention that this is supported
None of the online manuals for the Common Navigator explain how to do it
I do not know where to start even since there is no extension point for it, and the Working Set implementation classes are all "internal". I have a very basic navigator setup showing default project resources and some additional IFileSystem stuff implementing ITreeContentProvider.
You can get the working set manager using:
IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
and from that get the visible working sets with:
IWorkingSet [] workingSets = manager.getWorkingSets();
the members of a working set can be accessed with:
IAdaptable [] elements = workingSet.getElements();
so you could use the working sets list as the input for the tree viewer and adjust your tree content provider to deal with this.
In retrospect the following is a better solution. Instead of implementing ITreeContentProvider and traversing the working sets ourselves, we can reuse existing standard providers for the same content, which might work better.
You can use them like so:
<extension
point="org.eclipse.ui.navigator.viewer">
<viewerContentBinding
viewerId="rascal.navigator">
<includes>
<contentExtension pattern="org.eclipse.ui.navigator.resourceContent" />
<contentExtension pattern="org.eclipse.ui.navigator.resources.filters.*"/>
<contentExtension pattern="org.eclipse.ui.navigator.resources.linkHelper"/>
<contentExtension pattern="org.eclipse.ui.navigator.resources.workingSets"/>
</includes>
</viewerContentBinding>
In particular the org.eclipse.ui.navigator.resources.workingSets is what adds working sets capabilities to your navigator.
Adding your own content then becomes an issue of adding another content provider which ignores workingsets and projects and other kinds of resources which are already taken care of, e.g. like so:
<extension
point="org.eclipse.ui.navigator.navigatorContent">
<navigatorContent
activeByDefault="true"
contentProvider="org.rascalmpl.eclipse.navigator.NavigatorContentProvider"
id="org.rascalmpl.navigator.searchPathContent"
labelProvider="org.rascalmpl.eclipse.navigator.NavigatorContentLabelProvider"
name="Rascal search path"
priority="normal">
<triggerPoints>
<or>
<instanceof value="org.eclipse.core.resources.IResource"/>
</or>
</triggerPoints>
<possibleChildren>
<or>
<instanceof value="java.lang.Object"/>
</or>
</possibleChildren>
<actionProvider
class="org.rascalmpl.eclipse.navigator.NavigatorActionProvider"
id="org.rascalmpl.navigator.actions">
</actionProvider>
<commonSorter
class="org.rascalmpl.eclipse.navigator.Sorter">
</commonSorter>
</navigatorContent>
<commonWizard
type="new"
wizardId="rascal_eclipse.wizards.NewRascalFile">
<enablement></enablement>
</commonWizard>
<commonWizard
type="new"
wizardId="rascal_eclipse.projectwizard">
<enablement></enablement>
</commonWizard>
</extension>
and in the NavigatorContentProvider class we implement getElements and getChildren but only for our own additional content.
I want to implement some tooltip for breadcrumbs is there a way to do it.
Got the soloution through simple jQuery command added it in the itemoptions of the breadcrumbs array.
'rel'=>'tooltip','title'=>'click here to read the mail')), $this->menu=array(
array('label'=>'Inbox', 'url'=>array('MessageTo/inbox'),'itemOptions'=>array('class'=>'inbox', 'rel'=>'tooltip','title'=>'click here to read the mail')),
);
?>