I am working with Code-Generation and trying to get the path of the Annotated-File.
I would need it inside the visitFieldElement:
#override
dynamic visitFieldElement(FieldElement element) {
// Get path here
}
I tried couple of different things: element.source, elenment.librarySource, element.location.
But non of them is giving me the exact path relativ from lib/.
I know I can simply extract it from e.g the element.location but I thought there must be a cleaner way to get this done.
It should be possible since the builder itself is printing out the path:
Any idea? Let me know if you need any more info!
If you have an element to use via visiting children,
then I believe you do have the "buildStep" variable,
it contains the "path" variable and I think that is what you are looking for.
Related
Hello,
I'm an eclipse plugin development newbie looking for pointers to get me started on a particular project.
I am trying to build an eclipse plugin that will automatically construct a working set from a text file that simply consists of a list of file path names. The files/items need not share any parent directories. The rough idea is represented in the following diagram:
I am not asking for the solution to this task. That's the over-arching goal. To achieve that goal, I want to conquer some smaller goals first.
With that in mind, here's the smaller goal I'm currently trying to tackle:
In Eclipse, how can I prompt the user for a single file's path, and then add that file to an existing working set?
I'm not sure where to start. Should I work directly off of the existing org.eclipse.ui.workingSets extension point? Or should I use a collection of other extension points? How do I convert strings into something that can be added to a working set? Do I write code that directly modifies the workingsets.xml file?
Even with a much simpler goal, I still feel quite overwhelmed with the vastness of eclipse extension options. There are probably many ways to go about implementing something like this, but I just need one to get started.
Thanks a bunch!
To manipulate working sets you use the working set manager interface IWorkingSetManager. Get this with:
IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
From this you can get a particular working by name with:
IWorkingSet workingSet = manager.getWorkingSet("name");
The contents of a working set is an array of IAdaptable objects:
IAdaptable [] contents = workingSet.getElements();
You add to the contents by adding to this array and setting the contents:
IAdaptable [] newContents
.... get new array with old contents + new contents
workingSet.setElements(newContents);
A lot of Eclipse objects implement IAdaptable, for a file in the workspace you would use IFile. You can use dialogs such as ResourceSelectionDialog to select resources from the workspace.
I building an TYPO3 extension, withs contains a frond-end plugin. In the fluid template I'm using the following link. This links contains the argument named "group" to send the value "3" to the page.
<f:link.action pageUid="1" pluginName="PluginAds" controller="Ads" arguments="{group: 3}">
In the controller "PluginAds" under "AdsController" it works ok to get the value with the following action:
$this->request->getArgument('group');
But I also want to use the argument "group" for generating the correct breadcrums link. But when I use the same code in a different controller I'm getting the error that the argument does not exists. Can anyone help on this?
Inspect with browser tools how does f:link.action constructs prefixes for params of your plugin, it's i.e.: tx_extkey_pluginsname[myparam]
Within the plugin's actions you can get myparam by
$this->request->getArgument('myparam')
anyway anywhere else you need to get it as normal GET array, so it will be something like:
$pluginsParams = GeneralUtility::_GET('tx_extkey_pluginsname');
$myParam = $pluginsParams['myparam'];
Other thing is that you should always check if:
$this->request->hasArgument('group')
Before trying using it, otherwise it can lead you to null pointer exception.
I've got a table which I'm firing an event on row selection. In the handler I want to get the context for the selected row and then create a new context for a lower level oData object and then bind that to a Text view.
I'm sure there is a beautifully succinct way of doing this but currently I am:
Getting the binding path and adding a string to create a path to my lower level object:
var path = oEvent.getParameters().listItem.getBindingContext().sPath + "/ComplianceNote";
This is returning a path with / as the first character, from what I understand this means it's the root object of the service or this is an "absolute" path. My current workaround is to remove the first character:
path = path.substr(1, path.length);
Then I can bind my Text view:
noteText.bindElement(path);
noteText.bindProperty("text", "Note");
This works fine but seems to me to be a code smell hacking around with the string. My questions are:
Why is the path returned as "absolute" rather than "relative"
What is the correct way to achieve this. I've been looking at things like setBindContext and bindText.
Cheers,
Gregor
I'm using Microsoft UI automation + White framework. Is it possible to get a full path from to the control from the top parent, and then use it to find an element? For example, use UI spy to get the full path, and then somehow get the control by the taken path?
Thanks
I use the unmanaged version of MSUIA and don't use white, but something like this should do what you are asking. Pass in an element.
CUIAutomation auto = new CUIAutomation();
var desktop = auto.GetRootElement();
var walker = GetRawTreeWalker();
while (true)
{
element = walker.GetParentElement(element);
if (auto.CompareElements(desktop, element) == 1)
{
break;
}
winPath = AppendWinPathPart(winPath, element);
}
AppendWinPathPart is a call to a method that builds something like a path in string form that I use in my automation. It is much like XPath for MSUIA.
I have done something in the past similar to what it sounds like you're trying to do. Unfortunately, it's not necessarily all that easy to do.
I essentially built my own simplified version of UI Spy that used some code similar to what's in the answer from #chrismead above to build a '\' delimited path of automation IDs (unfortunately, as you may have already discovered, AutomationIDs can be unreliable, so for the sake of robustness I also had to add the capability to identify AutomationElements by things like name, position among siblings, or position relative to parent).
Then, I had code in another application that could take those paths as input in order to locate those specific AutomationElements and interact with them.
I'm trying to add the item
<key>UIStatusBarHidden</key><true/>
to my plist that's auto-generated by CMake. For certain keys, it appears there are pre-defined ways to add an item; for example:
set(MACOSX_BUNDLE_ICON_FILE ${ICON})
But I can't find a way to add an arbitrary property.
I tried using the MACOSX_BUNDLE_INFO_PLIST target property as follows: I'd like the resulting plist to be identical to the old one, except with the new property I want, so I just copied the auto-generated plist and set that as my template. But the plist uses some Xcode variables, which also look like ${foo}, and CMake grumbles about this:
Syntax error in cmake code when
parsing string
<string>com.bedaire.${PRODUCT_NAME:identifier}</string>
syntax error, unexpected cal_SYMBOL,
expecting } (47)
Policy CMP0010 is not set: Bad
variable reference syntax is an error.
Run "cmake --help-policy CMP0010"
for policy details. Use the
cmake_policy command to set the
policy and suppress this warning. This
warning is for project developers.
Use -Wno-dev to suppress it.
In any case, I'm not even sure that this is the right thing to do. I can't find a good example or any good documentation about this. Ideally, I'd just let CMake generate everything as before, and just add a single extra line. What can I do?
Have you looked into copying the relevant *.plist.in file in /opt/local/share/cmake-2.8/Modules (such as MacOSXBundleInfo.plist.in), editing it to put <key>UIStatusBarHidden</key><true/> (or #VAR_TO_REPLACE_BY_CMAKE#), and adding the directory of the edited version in the CMAKE_MODULE_PATH?
If you have CMake installed as an app bundle, then the location of that file is /Applications/CMake.app/Contents/share/cmake-N.N/Modules
You can add your values using # and pass #ONLY to configure_file.
Unfortunately there is no simple way to add custom line to generated file.