use of org.freeplane.core.resources.ResourceController in project freeplane by freeplane.
the class ActionAcceleratorManager method loadDefaultAccelerators.
private void loadDefaultAccelerators(String resource) {
final ResourceController resourceController = ResourceController.getResourceController();
final URL resourceUrl = resourceController.getResource(resource);
if (resourceUrl == null)
return;
try (final InputStream resourceStream = new BufferedInputStream(resourceUrl.openStream())) {
overwritttenDefaultProps.load(resourceStream);
} catch (Exception e) {
LogUtils.warn(e);
}
}
use of org.freeplane.core.resources.ResourceController in project freeplane by freeplane.
the class MClipboardController method getFlavorHandler.
private IDataFlavorHandler getFlavorHandler(final Transferable t) {
if (t.isDataFlavorSupported(MindMapNodesSelection.mindMapNodesFlavor)) {
try {
final String textFromClipboard = t.getTransferData(MindMapNodesSelection.mindMapNodesFlavor).toString();
return new MindMapNodesFlavorHandler(textFromClipboard);
} catch (final UnsupportedFlavorException e) {
} catch (final IOException e) {
}
}
final ResourceController resourceController = ResourceController.getResourceController();
DataFlavor supportedHtmlFlavor = getSupportedHtmlFlavor(t);
if (supportedHtmlFlavor != null) {
try {
final String textFromClipboard = t.getTransferData(supportedHtmlFlavor).toString();
if (textFromClipboard.charAt(0) != 65533) {
if (t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
final MTextController textController = (MTextController) TextController.getController();
final boolean richText = textController.useRichTextInEditor(RESOURCES_REMIND_USE_RICH_TEXT_IN_NEW_NODES);
if (richText) {
final boolean structuredHtmlImport = resourceController.getBooleanProperty("structured_html_import");
final IDataFlavorHandler htmlFlavorHandler;
if (structuredHtmlImport) {
htmlFlavorHandler = new StructuredHtmlFlavorHandler(textFromClipboard);
} else {
htmlFlavorHandler = new DirectHtmlFlavorHandler(textFromClipboard);
}
return htmlFlavorHandler;
}
}
}
} catch (final UnsupportedFlavorException e) {
} catch (final IOException e) {
}
}
if (t.isDataFlavorSupported(MindMapNodesSelection.fileListFlavor)) {
try {
final List<File> fileList = castToFileList(t.getTransferData(MindMapNodesSelection.fileListFlavor));
if (!shouldIgnoreFileListFlavor(fileList))
return new FileListFlavorHandler(fileList);
} catch (final UnsupportedFlavorException e) {
} catch (final IOException e) {
}
}
if (t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
try {
final String plainTextFromClipboard = t.getTransferData(DataFlavor.stringFlavor).toString();
return new StringFlavorHandler(plainTextFromClipboard);
} catch (final UnsupportedFlavorException e) {
} catch (final IOException e) {
}
}
if (t.isDataFlavorSupported(DataFlavor.imageFlavor)) {
try {
Image image = (Image) t.getTransferData(DataFlavor.imageFlavor);
return new ImageFlavorHandler(image);
} catch (final UnsupportedFlavorException e) {
} catch (final IOException e) {
}
}
return null;
}
use of org.freeplane.core.resources.ResourceController in project freeplane by freeplane.
the class FormatController method getDefaultNumberFormat.
public DecimalFormat getDefaultNumberFormat() {
if (defaultNumberFormat != null)
return defaultNumberFormat;
final ResourceController resourceController = ResourceController.getResourceController();
// an empty number format does not make sense!
fixEmptyDataFormatProperty(resourceController, RESOURCES_NUMBER_FORMAT, "#0.####");
defaultNumberFormat = getDecimalFormat(resourceController.getProperty(RESOURCES_NUMBER_FORMAT));
return defaultNumberFormat;
}
use of org.freeplane.core.resources.ResourceController in project freeplane by freeplane.
the class FormatController method getDefaultDateFormat.
public SimpleDateFormat getDefaultDateFormat() {
if (defaultDateFormat != null)
return defaultDateFormat;
final ResourceController resourceController = ResourceController.getResourceController();
// DateFormatParser cannot handle empty date format!
fixEmptyDataFormatProperty(resourceController, RESOURCES_DATE_FORMAT, "SHORT");
String datePattern = resourceController.getProperty(RESOURCES_DATE_FORMAT);
defaultDateFormat = createDateFormat(datePattern);
return defaultDateFormat;
}
use of org.freeplane.core.resources.ResourceController in project freeplane by freeplane.
the class PresentationKeyEventDispatcher method of.
static PresentationKeyEventDispatcher of(KeyEventDispatcher upDownKeyEventDispatcher, String propertyName) {
ResourceController resourceController = ResourceController.getResourceController();
final boolean processKeys = ResourceController.getResourceController().getBooleanProperty(propertyName);
final PresentationKeyEventDispatcher presentationKeyEventDispatcher = new PresentationKeyEventDispatcher(propertyName, upDownKeyEventDispatcher, processKeys);
resourceController.addPropertyChangeListener(presentationKeyEventDispatcher);
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(presentationKeyEventDispatcher);
resourceController.addPropertyChangeListener(presentationKeyEventDispatcher);
return presentationKeyEventDispatcher;
}
Aggregations