use of com.igormaznitsa.meta.annotation.MustNotContainNull in project netbeans-mmd-plugin by raydac.
the class NodeProject method replaceAllLinksToFile.
@Nonnull
@MustNotContainNull
public List<File> replaceAllLinksToFile(@Nonnull @MustNotContainNull final List<File> listOfFilesToProcess, @Nonnull final File oldFile, @Nonnull final File newFile) {
final List<File> affectedFiles = new ArrayList<>();
final File baseFolder = makeFileForNode();
final MMapURI oldFileURI = new MMapURI(baseFolder, oldFile, null);
final MMapURI newFileURI = new MMapURI(baseFolder, newFile, null);
for (final File file : listOfFilesToProcess) {
if (file.isFile()) {
try {
// NOI18N
final MindMap map = new MindMap(null, new StringReader(FileUtils.readFileToString(file, "UTF-8")));
if (map.replaceAllLinksToFile(baseFolder, oldFileURI, newFileURI)) {
SystemUtils.saveUTFText(file, map.packToString());
affectedFiles.add(file);
}
} catch (IOException ex) {
// NOI18N
LOGGER.error("Can't process mind map file", ex);
}
}
}
return affectedFiles;
}
use of com.igormaznitsa.meta.annotation.MustNotContainNull in project netbeans-mmd-plugin by raydac.
the class NbUtils method findAllSourceGroups.
@Nonnull
@MustNotContainNull
public static Collection<SourceGroup> findAllSourceGroups(@Nonnull final Project project) {
final Sources sources = ProjectUtils.getSources(project);
final Set<SourceGroup> result = new HashSet<SourceGroup>();
for (final String scopeType : ALL_KNOWN_SCOPE_TYPES) {
for (final SourceGroup s : sources.getSourceGroups(scopeType)) {
result.add(s);
}
}
if (result.isEmpty() && !project.getClass().getName().equals("org.netbeans.modules.maven.NbMavenProjectImpl")) {
for (final SourceGroup s : sources.getSourceGroups(Sources.TYPE_GENERIC)) {
result.add(s);
}
}
return result;
}
use of com.igormaznitsa.meta.annotation.MustNotContainNull in project netbeans-mmd-plugin by raydac.
the class CoggleMM2MindMapImporter method extractImageURLs.
@Nonnull
@MustNotContainNull
private List<String> extractImageURLs(@Nonnull final String mdText, @Nonnull final StringBuilder resultText) {
final List<String> result = new ArrayList<String>();
final Matcher matcher = MD_IMAGE_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 Freemind2MindMapImporter method extractRichContent.
@Nonnull
@MustNotContainNull
private static List<RichContent> extractRichContent(@Nonnull final Element richContentElement) {
final List<Element> richContents = Utils.findDirectChildrenForName(richContentElement, "richcontent");
final List<RichContent> result = new ArrayList<RichContent>();
final List<String> foundImageUrls = new ArrayList<String>();
for (final Element e : richContents) {
final String textType = e.getAttribute("TYPE");
try {
foundImageUrls.clear();
final RichContentType type = RichContentType.valueOf(textType);
final String text = extractTextFromHtmlElement(e, new StringBuilder(), foundImageUrls).toString().replace("\r", "");
result.add(new RichContent(type, text, foundImageUrls));
} catch (IllegalArgumentException ex) {
LOGGER.warn("Unknown node type : " + textType);
}
}
return result;
}
Aggregations