diff -r b245a84213a6 xml.schema/src/org/netbeans/modules/xml/schema/Bundle.properties --- a/xml.schema/src/org/netbeans/modules/xml/schema/Bundle.properties Thu Oct 16 16:12:57 2008 +0200 +++ b/xml.schema/src/org/netbeans/modules/xml/schema/Bundle.properties Thu Oct 16 19:10:16 2008 +0400 @@ -193,3 +193,5 @@ TotalDigits=Total Digits Union=Union Unique=Unique + +ERR_File_was_deleted=File was deleted. diff -r b245a84213a6 xml.schema/src/org/netbeans/modules/xml/schema/SearchProvider.java --- a/xml.schema/src/org/netbeans/modules/xml/schema/SearchProvider.java Thu Oct 16 16:12:57 2008 +0200 +++ b/xml.schema/src/org/netbeans/modules/xml/schema/SearchProvider.java Thu Oct 16 19:10:16 2008 +0400 @@ -42,8 +42,11 @@ import java.awt.Container; +import org.openide.DialogDisplayer; +import org.openide.NotifyDescriptor; import org.openide.loaders.DataObject; import org.openide.nodes.Node; +import org.openide.util.NbBundle; import org.openide.util.lookup.Lookups; import org.netbeans.modules.xml.xam.Component; @@ -103,11 +106,17 @@ @Override protected void gotoSource(Component component) { - getDataObject().getCookie(ShowCookie.class).show(new ResultItem(null, null, component, null)); + if ( !isValid()) { + return; + } + getDataObject().getCookie(ShowCookie.class).show(new ResultItem(null, null, component, null)); } @Override protected final void gotoVisual(Component component) { + if ( !isValid()) { + return; + } openDocument(component); if (myView instanceof SchemaTreeView) { SchemaMultiViewSupport.requestMultiviewActive(SchemaColumnViewMultiViewDesc.PREFERRED_ID); @@ -118,7 +127,19 @@ } highlight(component); } + + private boolean isValid() { + if ( !getDataObject().isValid()) { + printError(NbBundle.getMessage(SearchProvider.class, "ERR_File_was_deleted")); // NOI18N + return false; + } + return true; + } + private void printError(String message) { + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(message, NotifyDescriptor.ERROR_MESSAGE)); + } + //The searched component is in output window. The document may/maynot be open //hence just open the document and this will make the TC active as well. private void openDocument(Component component) {