use of com.igormaznitsa.meta.annotation.MustNotContainNull in project netbeans-mmd-plugin by raydac.
the class CoggleMM2MindMapImporter method extractURLs.
@Nonnull
@MustNotContainNull
private List<String> extractURLs(@Nonnull final String mdText, @Nonnull final StringBuilder resultText) {
final List<String> result = new ArrayList<String>();
final Matcher matcher = MD_URL_LINK.matcher(mdText);
int lastFoundEnd = 0;
while (matcher.find()) {
final String text = matcher.group(1);
result.add(matcher.group(2));
resultText.append(mdText, lastFoundEnd, matcher.start()).append(text);
lastFoundEnd = matcher.end();
}
if (lastFoundEnd < mdText.length()) {
resultText.append(mdText, lastFoundEnd, mdText.length());
}
return result;
}
use of com.igormaznitsa.meta.annotation.MustNotContainNull in project netbeans-mmd-plugin by raydac.
the class Utils method findDirectChildrenForName.
/**
* Find all direct children with defined name.
*
* @param element parent element
* @param childElementname child element name
* @return list of found elements
* @since 1.4.0
*/
@Nonnull
@MustNotContainNull
public static List<Element> findDirectChildrenForName(@Nonnull final Element element, @Nonnull final String childElementname) {
final NodeList found = element.getElementsByTagName(childElementname);
final List<Element> resultList = new ArrayList<Element>();
for (int i = 0; i < found.getLength(); i++) {
if (found.item(i).getParentNode().equals(element) && found.item(i) instanceof Element) {
resultList.add((Element) found.item(i));
}
}
return resultList;
}
use of com.igormaznitsa.meta.annotation.MustNotContainNull in project netbeans-mmd-plugin by raydac.
the class RefactoringUtils method findAllMindMapsInProject.
@Nonnull
@MustNotContainNull
public static List<FileObject> findAllMindMapsInProject(@Nonnull final Project project, @Nullable final AbstractPlugin plugin) {
final List<FileObject> result = new ArrayList<FileObject>();
final Sources sources = ProjectUtils.getSources(project);
final SourceGroup[] groups = sources.getSourceGroups(Sources.TYPE_GENERIC);
for (final SourceGroup g : groups) {
if (plugin != null && plugin.isCanceled()) {
return result;
}
final FileObject gobject = g.getRootFolder();
if (gobject != null) {
final Enumeration<? extends FileObject> e = gobject.getChildren(true);
while (e.hasMoreElements()) {
if (plugin != null && plugin.isCanceled()) {
return result;
}
final FileObject nxt = e.nextElement();
if (nxt.isData() && nxt.hasExt("mmd")) {
result.add(nxt);
}
}
}
}
return result;
}
use of com.igormaznitsa.meta.annotation.MustNotContainNull in project netbeans-mmd-plugin by raydac.
the class MouseSelectedArea method getAllSelectedElements.
@Nonnull
@MustNotContainNull
public List<Topic> getAllSelectedElements(@Nonnull final MindMap map) {
final List<Topic> result = new ArrayList<Topic>();
final Rectangle rect = asRectangle();
addCoveredToList(result, map.getRoot(), rect.getBounds2D());
return result;
}
use of com.igormaznitsa.meta.annotation.MustNotContainNull in project netbeans-mmd-plugin by raydac.
the class MapUtils method findTopicsRelatedToFile.
@Nonnull
@MustNotContainNull
public static List<Topic> findTopicsRelatedToFile(@Nullable final File baseFolder, @Nonnull final File file, @Nonnull final MindMap map) {
final List<Topic> result = new ArrayList<>();
final Path theFile = file.isAbsolute() ? file.toPath() : new File(baseFolder, file.getAbsolutePath()).toPath();
final boolean folder = file.isDirectory();
for (final Topic t : map) {
final ExtraFile linkToFile = (ExtraFile) t.getExtras().get(Extra.ExtraType.FILE);
if (linkToFile != null) {
final MMapURI uri = linkToFile.getAsURI();
final Path linkFile = uri.asFile(baseFolder).toPath();
if (folder) {
if (linkFile.startsWith(theFile)) {
result.add(t);
}
} else if (linkFile.equals(theFile)) {
result.add(t);
}
}
}
return result;
}
Aggregations