Skip to content

Commit

Permalink
changes in file opeining logic
Browse files Browse the repository at this point in the history
  • Loading branch information
raydac committed Oct 3, 2015
1 parent 06939bb commit 185e2e8
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
import org.openide.filesystems.FileChooserBuilder;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.filesystems.URLMapper;
import org.openide.loaders.DataFolder;
import org.openide.loaders.DataObject;
import org.openide.nodes.Node;
Expand Down Expand Up @@ -373,10 +374,17 @@ public void onClickOnExtra(final MindMapPanel source, final int clicks, final To
case FILE: {
final FileObject fileObj;
final MMapURI uri = (MMapURI) extra.getValue();
final File theFile = uri.asFile(this.editorSupport.getProjectDirectory());
try {
fileObj = FileUtil.toFileObject(uri.asFile(this.editorSupport.getProjectDirectory()));
fileObj = FileUtil.toFileObject(theFile);
if (fileObj == null) {
NbUtils.msgError(String.format(BUNDLE.getString("MMDGraphEditor.onClickExtra.errorCanfFindFile"), uri.toString()));
logger.warn("Can't find FileObject for " + theFile);
if (theFile.exists()) {
NbUtils.openInExternalEditor(theFile);
}
else {
NbUtils.msgError(String.format(BUNDLE.getString("MMDGraphEditor.onClickExtra.errorCanfFindFile"), theFile.getAbsolutePath()));
}
return;
}
}
Expand All @@ -387,8 +395,6 @@ public void onClickOnExtra(final MindMapPanel source, final int clicks, final To
}

try {
final File theFile = uri.asFile(this.editorSupport.getProjectDirectory());

if (Boolean.parseBoolean(uri.getParameters().getProperty(FILELINK_ATTR_OPEN_IN_SYSTEM, "false"))) { //NOI18N
NbUtils.openInExternalEditor(theFile);
}
Expand Down

0 comments on commit 185e2e8

Please sign in to comment.