More

ArcGIS 10 add-in: Top-level exception handling

ArcGIS 10 add-in: Top-level exception handling


The ArcGIS 10 add-in I'm working on is pretty simple -- just a tool control and a dockable window. I'm handling the specific exceptions I anticipate occuring at the source and throwing everything else, but what is the best practice for handling those unexpected exceptions in the add-in framework?

I'm currently just doing acatch (System.Exception ex)and showing it in a MessageBox in every method that doesn't have a higher-level method I could handle it in, but this doesn't seem like the best practice (and of course, FxCop is whining about it).

Is there any facility in the ArcGIS 10 add-in framework for a top-level exception handler to be hooked up, for example to theApplication.ThreadExceptionorAppDomain.UnhandledExceptionevents?

Seeing as add-ins are just class libraries and not applications with no access to the underlying application's startup code (from what I gather, those events have to be hooked up very early in the startup process), my guess is no, but I thought I'd ask if any experts out there had any suggestions on how "unexpected" exceptions should be handled in add-ins.


As far as I can tell you are implementing the error handling that ESRI is currently putting out there as best practice. If you were to grab a hold of the application's (ArcMap) unhandled exceptions you could potentially be then displaying messages about errors that were not part of your AddIn. Most of the AddIns you write are probably going to be buttons and those really only have two major routes that unexpected errors would be caught and displayed (onClick and onUpdate).

Just remember to use the 'throw' instead of 'throw ex'. There is a minute difference, but it results in retaining the error's lineage as it bubbles up from called functions.


I am working with an ArcGIS add-in. My add-in consists a dockable window and a tool control. I am trying to keep log of ArcGIS crash because of my tool. And I get some success on top-level exception handling using Application.ThreadException. As thread exception works only for UI thread, after instantiating dockable window, any exception that can be a cause to crash ArcGIS, it catches that, but it does not work before instantiating dockable window.

public class AddinImpl : ESRI.ArcGIS.Desktop.AddIns.DockableWindow { private WatershedDelineationDockableWindow m_windowUI; public WatershedDelineationDockableWindow GetUI { get { return m_windowUI; } } public AddinImpl() { Application.ThreadException += MYThreadHandler; Log.Info("Creating dockable window."); } static void MYThreadHandler(object sender, ThreadExceptionEventArgs e) { Log.Error("unhandled error in thread " + e.Exception.ToString()); MessageBox.Show("unhandled error in thread " + e.Exception.ToString()); } protected override IntPtr OnCreateChild() { m_windowUI = new WatershedDelineationDockableWindow(this.Hook); return m_windowUI.Handle; } protected override void Dispose(bool disposing) { if (m_windowUI != null) m_windowUI.Dispose(disposing); base.Dispose(disposing); Log.Info("Closing dockable window "); } }

This does top-level exception handling after instantiating UI


Top Clinical Information Systems Executive Salary in Savannah, Georgia

How much does a Top Clinical Information Systems Executive make in Savannah, GA? The average Top Clinical Information Systems Executive salary in Savannah, GA is $267,158 as of May 27, 2021, but the range typically falls between $201,590 and $321,172. Salary ranges can vary widely depending on many important factors, including education, certifications, additional skills, the number of years you have spent in your profession. With more online, real-time compensation data than any other website, Salary.com helps you determine your exact pay target.

Percentile Salary Location Last Updated
10th Percentile Top Clinical Information Systems Executive Salary $141,893 Savannah,GA May 27, 2021
25th Percentile Top Clinical Information Systems Executive Salary $201,590 Savannah,GA May 27, 2021
50th Percentile Top Clinical Information Systems Executive Salary $267,158 Savannah,GA May 27, 2021
75th Percentile Top Clinical Information Systems Executive Salary $321,172 Savannah,GA May 27, 2021
90th Percentile Top Clinical Information Systems Executive Salary $370,348 Savannah,GA May 27, 2021

Individualize employee pay based on unique job requirements and personal qualifications.

Get the latest market price for benchmark jobs and jobs in your industry.

Analyze the market and your qualifications to negotiate your salary with confidence.

Search thousands of open positions to find your next opportunity.


and put this file in your theme location

Add below <li> structure just after <?php /* @escapeNotVerified */ echo $block->getChildHtml() ?> line in topmenu.phtml

Another alternative is to use a new template file via layout xml.

Then use this template file to create link html.

When you clear the layout and block_html caches, these will show in the menu. Note:


2 Answers 2

All of the solutions that I tested that worked included that behavior of adding an unwanted blank admin page. I'm not sure that there is not some solution buried somewhere - or some trick you can use to close the page after it's been opened! - but the indication is that WP does not want you to do what you want to do.

I think the cleanest solution you can try is to add a link directly to a submenu. You'll find some indications on the pages I linked above.

You might also consider simply adding the link - or the re-direct - via the blank page: So, in other words, cooperate with WordPress load the page, and work it from there: Add a link to the author page that also appears there, initiate some other process, point to the user-profile page, or incorporate other functions for editing the user's profile information.

To answer your minor question, to make the link available to all users, use 'read' instead of 'manage_options' as the third, capabilities variable under the add_menu_page() array.


1 Answer 1

You can do it with a Plugin. In a custom module:

It says it will use the plugin you defined in CustomModulePluginTopmenuplugin.php when the block MagentoThemeBlockHtmlTopmenu is used

Now add the plugin under magentoappcodeCustomModulePluginTopmenuPlugin.php

So, after the Topmenu Block generates its html, we intercept it and add our new menu items. Here you have one top menu item with 3 sub-items. Simply replace the "REPLACE_BY_YOUR_EXTERNAL_URL" by your urls and the "REPLACE_BY_THE_TITLE_OF_THE_LINK" by the title of your links.

EDIT: To make it a complete workable module, you'll need 3 more files:

  • Custom/Module/etc/module.xml
  • Custom/Module/composer.json
  • Custom/Module/registration.php

Composer.json

registration.php

After these changes, do in a terminal (and from your magento install dir)


You can add elements to the top menu using the event page_block_html_topmenu_gethtml_before.

Step 1 - So you need to create a module with these files (all the files should be in app/code/[Namespace]/[Module]):

Step 2 - app/code/[Namespace]/[Module]/etc/module.xml - the module declaration file

Step 3 - app/code/[Namespace]/[Module]/registration.php - the registration file

Step 4 - app/code/[Namespace]/[Module]/etc/frontend/events.xml - the events declaration file

Step 5 - app/code/[Namespace]/[Module]/Observer/Topmenu.php - the actual observer

The simple way to do this is here given below. For example Here I am using Solwin/freego theme so I have to navigate


This is possible in Pages '09, so it probably works in Pages '08 as well.

Open the Inspector (in menu bar click View -> Show Inspector)

  1. Select the Text section
  2. Select the "More" tab
  3. Under "Borders & Rules", click the dropdown that says "none" and select the line you want to use
  4. Below the dropdown select the icon depicting the line above the content

Open the Styles Drawer (in menu bar click View -> Show Styles Drawer)

  1. Since the text is still selected, the heading you're using should already be highlighted
  2. Click the arrow beside the style
  3. Click "Redefine style from selection"

Now everywhere that you used that heading will now have a horizontal line over it, and it will automatically appear whenever you insert new headings.


18 Answers 18

  1. Set the custom link to # which won't return anything
  2. Use the Disable Parent Menu Link plugin (or take it apart and write your own)

The easiest way to do it without a plugin or anything is to use the "Menus" function of WordPress. Here are the instructions for WordPress 4.8:

  1. From your WordPress dashboard, go to "Appearance -> Menus"
  2. In the "Edit Menus" tab, select "Custom Links"
  3. For the URL, Enter "#" (no quotes)
  4. For the link text, enter your desired text for the top level of your drop-down menu
  5. Click the "Add to Menu" button
  6. Drag the menu item to its desired position within your menu
  7. For the menu item you just added, click the down arrow to the right of the item (it will read "custom link" to the left of the item)
  8. Remove the "#" from the URL. This - in all browsers - will convert the link to plain text.
  9. Click on the "Save Menu" button

The simplest method I came up with was to create a Custom Link item with the Link URL value of # . This is sending the user to an empty hash on the same page, so basically links nowhere.

However, there are some side-effects of using empty hashes for placeholder links. The link will still appear and behave like a link, so it could confuse a user when they are clicking on what appears to be a link but nothing happens. The other effect is that clicking on an empty hash link will override any existing hash, sending the user to the top of the page. This might not be so worrying for a menu which is at the top of the page anyway, but it is quite jarring when the page unexpectedly jumps when you are not expecting it, especially if this is for a footer menu.

The solution is to combine the empty hash method with a piece of code to detect when empty hash links are used in the menu and to remove the href attribute from that link entirely. An a element without a href attribute is the correct HTML 5 method of creating an placeholder link.


DNS itself has a root zone. this zone it called literally ".". Bind requires that you fully qualify a DNS name (this includes the . or root zone). Other UIs simplify this by assuming the root zone for you.

Within Bind, you may define a variable ORIGIN that will be automatically appended if you do not specify a FQDN (Fully Qualified Domain Name, including the trailing .). Alnitak has an excelent example of the syntax and various uses of this.

The trailing '.' makes the name into a "Fully Qualified Domain Name", i.e. an absolute domain name.

In standard "master file format" files if you don't add the trailing '.' then the name is assumed to be relative to the current zone file's $ORIGIN (which is either specified in the zone file as shown below, or taken from the zone statement in named.conf otherwise).

The . makes the name be relative to the root, without it, it the name will be relative to the current zone. The standard zone format is defined in rfc1035 and rfc1034.

How come when I use everydns.net, they do not require me to add a trailing period?

Is this an implementation quirk?

Yeah, it sounds like easydns.net is doing it a bit quirky.

If you do not enter the trailing "." then the server will add the value of $ORIGIN to the end of the record. This can be a very useful shortcut and save a lot of typing if used well.

Unfortunately it is also easy to forget the "." which can result in hard to diagnose problems.

Technically the "." on the end of a record such as www.serverfault.com. indicates the separator between the "com" gTLD and the "" root zone.

The trailing dot tells the DNS server that this is a fully qualified name. The dot is the root of the DNS heirarchy. If you don't use the dot, the DNS server will assume that it's a record in the current zone and will append it for you. For example, if you have a CNAME in exmaple.com that points to host.example.org, when you query for that, you'll get host.example.org.example.com, which probably isn't what you wanted.

The reason why you didn't have to with everydns.net is because they probably wrote their UI so you didn't have to worry about this technical detail.

In an fqdn, the dots are the actual identifiers. "com" and "edu", "hp" and "stanford" are just arbitrary delimiters. The dot's are uniquely identified by their spin.


In central admin go to Manage Content Databases [ http://CentralAdminURL/_admin/CNTDBADM.aspx ] and select your Web Application. Click "Add a content database" and fill in the form.

When done, you can move sites from one ContentDB to another by using the following PowerShell script

For the record, SharePoint self-balance new sites to try to keep the number of Site Collection equal (by number) when new are created. That means a new ContenDB will get all new Site Collections until the numbers are equal with other Content Databases on the same Web Application.


Watch the video: GIS Tools: ArcMapArcGIS Tool for counting inside features. points