Is it possible to write javadoc comments in a seperate file.
My usual method for writing comments is like below
/**
*#param name person name
*/
private void testMethod(String name) {
//something to do...
}
Is it possible to move all these embedded comments to a external file(s) that i can reference.It should still show the popup on mouse-over.
No, this is not possible. The main idea behind Javadoc is to keep code and documentation together to increase the likelihood that they stay in sync.
Related
I'm using this NetResource class to send files to a network drive and it looks like this:
[StructLayout(LayoutKind.Sequential)]
public class NetResource
{
public ResourceScope Scope;
public ResourceType ResourceType;
public ResourceDisplayType DisplayType;
public int Usage;
public string LocalName;
public string RemoteName;
public string Comment;
public string Provider;
}
Now it's very important that the order of these fields stay the same, as hinted on by the StructLayout attribute.
However, when someone would run a resharper cleanup, resharper decides to move the fields around and that would break the code.
Is there any way of telling rehsarper to not mess with it? I feel like if I can't do that, someone is going to eventually break the code and have no idea where to look.
But a mediocre solution to that I think would be to create a unittest that can check if there layout is as expected.
Edit: I've seen this answer, but it is outdated and requires resharper settings to be updated. I will also not be guaranteed that coworkers use this resharper setting. I'm looking for a way to add it in the code, just like you can do // ReSharper disable once InconsistentNaming
I see a couple of solutions here:
You might mark the class with NoReorderAttribute from the JetBrains.Annotations (there are several ways to add them to a project). Then ReSharper will stop reordering members inside the marked code entity.
It is mostly about already mentioned answer, I will show you how to get the same things in last ReSharper builds. All you need is to add "System.Runtime.InteropServices.StructLayoutAttribute" to "Non-reorderable types" pattern in ReSharper | Options | Code Editing | C# | File Layout.
Step 1:
Step 2:
Step 3:
Step 4:
Step 5:
To make sure your colleagues use the same settings in ReSharper, save this change to the Solution team shared layer (Save To at the bottom of the Options dialog). Then if any of your colleagues opens the solution, ReSharper will automatically use the setting from this layer with no additional actions required.
I want to prevent the user that he will loose his changes in an EditView when changing the view to another.
I use MVP4G in my project and the project is divided as mvp's structure (one package for the template another one for views ..) is there any solution to detect the EditView in the eventBus. or detect the current View shown to user
Thanks in advance
Thanks to the Navigation Event feature in mvp4g, the presenter will get control before the view changes. At this point the presenter can decide if the navigation will be done or not. This is the correct place in a mvp4g application to save your data.
First zu have to mark all events in the eventbus that will change your view with:
#Event(..., navigationEvent = true)
void goToPage1();
Next your presenters have to implement the NavigationConfirmationInterface and the requires confirm-method:
public class Presenter extends ... implements NavigationConfirmationInterface {
public void confirm(NavigationEventCommand event) {
//pseudo method to verify if the view has changed
if (isViewModified(){
//Window shouldn't be used inside a presenter
//this is just to give a simple example
if (Window.confirm("Are you sure you want to leave?")){
event.fireEvent();
}
} else {
event.fireEvent();
}
}
}
And the last thing to do, is to set the presenter of the current view to the confirmation presenter by calling:
event.fireEvent(false);
This is usually done when the presenter gets control.
You will find the documentation here:
https://github.com/FrankHossfeld/mvp4g/wiki/03.-Defining-EventBus#navigation-event
Thanks to MVP4G's team including El Hoss who gives me a hint to check the MVP4G's blog.. I've solved my problem by following this example
http://mvp4g.blogspot.com/2011/06/navigation-control.html
In my current project we have many parts where we have something as follows:
var request = new ThingRequest {someId = };
ThingResponse response = dispatcher.Get<ThingResponse>(request);
Where dispatcher fetches a class with the name ThingRequestHandler that handles the actual logic.
public class ThingRequestHandler : RequestHandler<ThingRequest, ThingResponse>
This system is great for keeping it SOLID but I'm having trouble navigating easily.
Currently I use R# to goto class and -as I now the class name to follow convention- manually type the class name. This usually works but makes my head jump from thinking about the problem to thinking about a class name.
I would love to be able to navigate to my ThingRequestHandler from my dispatcher.Get line with one keystroke or click.
Is there a way Visual studio 2012, R# or any other plugin or macro would help me do this?
In R# 8+ they made a loads of improvements and especially to the navigation. They introduced CamelHumps which could be very useful in your case. For example you could navigate to ThingRequestHandler just by typing trh.
I'm writing a VS2012 add-in, adding a command to Build Explorer context menu (see related question). The command gets added to 2 different context menus:
Build Explorer
Team Explorer, Builds page, My Builds section
When my one callback is called, how do I know which of these it is?
I tried get the focused control (using P/Invoke as this question suggests). However, it gets me a Tabs container for (1), and null for (2). I could try to cast the control to the tabbed container, but that sounds pretty bad...
Any better alternative?
My new/other idea - it is similar to yours:
You should try to monitor which window was activated lastly.
If you create an eventhandler for your command, then you may be able to check which window is active when your command fired. A simple evenent handler for a command:
void cmdEvents_BeforeExecute( string guid, int ID, object customIn, object customOut, ref bool cancelDefault )
{
Window2 teamExplorer = _applicationObject.Windows.Item("Team Explorer") as Window2;
if (_applicationObject.ActiveWindow.Caption == teamExplorer.Caption)
{
//You are called from Team Explorer
}
else
{
//Somewhere else
}
}
And the way you can subscribe:
static _dispCommandEvents_BeforeExecuteEventHandler _myHandler;
static CommandEvents _cmdEvents;
public void OnConnection(...)
{
Command command = ...; // Init your command
int ID = command.ID;
string GUID = command.Guid;
CommandEvents _cmdEvents = _applicationObject.Events.get_CommandEvents(GUID, ID);
_myHandler = new _dispCommandEvents_BeforeExecuteEventHandler(cmdEvents_BeforeExecute);
_cmdEvents.BeforeExecute += _myHandler;
}
You may find a better way to identify the window(s) by GUID. You should keep at least _cmdEvents as static because when it will be desroyed, your event handler could vanish (least for internal commands).
In OnDisconnection you should unsubscribe.
Reworked by the comment, and founded links:
As the menu item is shown every place it seems there is no way to distinct between them from an Add-In, you should add two command and distinct them by their context.
The way instead of converting the Add-In to a VS-Package MZ-Tools HOWTO: Controlling the state of command in a Visual Studio add-in, try MZ-Tools HOWTO: Use the IVsMonitorSelection ... you can also get it from an Add-In.
But:
Neither the AddNamedCommand nor the QueryStatus methods honor the
invisible state: the button that must be invisible ...
remains disabled rather than invisible.
I think this makes it impossible to do it from an Add-In on a suitable way, but maybe you can check the contexts.
Other way you could get further, if you try to migrate your command/menu into a VSPackage and create a custom UIContext for the menu items or find a suitable predefined one. I have no access to a Studio enhanced with Build Explorer so I can't try it.
The following discussion is about custom contexts for vs-packages:
http://davedewinter.com/2008/04/05/dynamic-menu-commands-in-visual-studio-packages-part-3/
Sadly the links are broken from the post, and I can't reach Part 1. and Part 2. which is about the discussion of the problem from the beginning.
But there is no guarantee you can create a context which suits you.
Only context ID I found for Team Explorer is the guidTeamProjectCmdUIContext.
It is placed at vsshilds.h in Visual Studio 2010 SDK, vsshell*.h are also contain several others.
MSDN: Vsct files to define command, menus, ect. from packages.
Condition attribute for items:
http://msdn.microsoft.com/en-us/library/bb491718.aspx
http://msdn.microsoft.com/en-us/library/bb166515.aspx
MSDN: VisibilityItem element for commands and toolbars.
VisibilityItem element determines the static visibility of commands and toolbars.
... After the VSPackage is loaded, Visual Studio expects command visibility to be determined by the VSPackage rather than the VisibilityItem.
And finally about predefined Context Guids:
http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.uicontextguids80.aspx
http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.uicontextguids.aspx
I'm trying to put a joypad made with AndEngine on a WebView that will be the view of an ipCamera. How can I do? I've searched a lot about that, but still haven't found the solution. Thank you all very much
You didn't mention what version of AndEngine you are using.
If you are using GLES2 (same technique may work for the GLES1 branch but I have not verified that), look at the AndEngine TextBreakExample.
That example shows how to use the org.andengine.opengl.view.RenderSurfaceView in combination with another layout like a LinearLayout. The "other layout" can contain anything - this example uses an EditText, but you should be able to use a WebView using the same technique.
Be sure and check the res/layout/textbreakexample.xml file. Also note these extra methods in the TextBreakExample.java file
#Override
protected int getLayoutID() {
return R.layout.textbreakexample;
}
#Override
protected int getRenderSurfaceViewID() {
return R.id.textbreakexample_rendersurfaceview;
}
https://github.com/nicolasgramlich/AndEngineExamples/blob/GLES2/src/org/andengine/examples/TextBreakExample.java
https://github.com/nicolasgramlich/AndEngineExamples/blob/GLES2/res/layout/textbreakexample.xml
Also might check out this layout file
https://github.com/nicolasgramlich/AndEngineExamples/blob/GLES2/res/layout/xmllayoutexample.xml