use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class ManualBugReporter method openBugTracker.
private void openBugTracker(final String log, final String hash) {
final String option = showBugReportDialog(log, hash);
if (!BugReportDialogManager.ALLOWED.equals(option)) {
return;
}
try {
final ResourceController resourceController = ResourceController.getResourceController();
final String location = resourceController.getProperty("bugTrackerLocation");
final Controller controller = Controller.getCurrentController();
controller.getViewController().openDocument(new URL(location));
} catch (final MalformedURLException ex) {
UITools.errorMessage(TextUtils.getText("url_error") + "\n" + ex);
LogUtils.warn(ex);
} catch (final Exception ex) {
UITools.errorMessage(ex);
LogUtils.warn(ex);
}
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class ReportGenerator method publish.
@Override
public synchronized void publish(final LogRecord record) {
final Controller controller = Controller.getCurrentController();
if (controller == null) {
// ReportGenerator is not available during controller initialization
return;
}
final ViewController viewController = controller.getViewController();
if (viewController == null) {
// ReportGenerator is not available during controller initialization
return;
}
if (out == null) {
out = new ByteArrayOutputStream();
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
setOutputStream(out);
return null;
}
});
}
if (!isLoggable(record)) {
return;
}
if (!(isReportGenerationInProgress)) {
isReportGenerationInProgress = true;
viewController.invokeLater(new Runnable() {
@Override
@SuppressWarnings("serial")
public void run() {
try {
errorCounter++;
if (TextUtils.getRawText("internal_error_tooltip", null) != null) {
if (logButton == null) {
final Icon errorIcon = ResourceController.getResourceController().getIcon("messagebox_warning_icon");
logButton = new JButton() {
@Override
public Dimension getPreferredSize() {
Dimension preferredSize = super.getPreferredSize();
preferredSize.height = Math.max(getIcon().getIconHeight(), getFont().getSize());
return preferredSize;
}
};
logButton.addActionListener(new LogOpener());
logButton.setIcon(errorIcon);
String tooltip = TextUtils.getText("internal_error_tooltip");
logButton.setToolTipText(tooltip);
viewController.addStatusComponent("internal_error", logButton);
}
logButton.setText(TextUtils.format("errornumber", errorCounter));
final JComponent statusBar = viewController.getStatusBar();
if (!statusBar.isVisible())
UIComponentVisibilityDispatcher.dispatcher(statusBar).setVisible(true);
}
} catch (Exception e) {
}
runSubmitAfterTimeout();
}
});
}
if (!isDisabled)
super.publish(record);
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class NodeIdHighLighter method deHighlight.
public void deHighlight() {
if (originallySelectedNode == null)
return;
final Controller controller = Controller.getCurrentController();
if (controller == null)
return;
final MapController mapController = controller.getModeController().getMapController();
mapController.displayNode(originallySelectedNode);
mapController.select(originallySelectedNode);
foldOriginallyFolded(mapController);
originallySelectedNode = null;
pane.setToolTipText(null);
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class UITools method setDialogLocationUnder.
public static void setDialogLocationUnder(final JDialog dialog, final NodeModel node) {
final Controller controller = Controller.getCurrentController();
final IMapViewManager viewController = controller.getMapViewManager();
final JComponent c = (JComponent) viewController.getComponent(node);
final int x = 0;
final int y = c.getHeight();
final Point location = new Point(x, y);
SwingUtilities.convertPointToScreen(location, c);
UITools.setBounds(dialog, location.x, location.y, dialog.getWidth(), dialog.getHeight());
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class UITools method showConfirmDialog.
public static int showConfirmDialog(final NodeModel node, final Object message, final String title, final int optionType, final int messageType) {
final Controller controller = Controller.getCurrentController();
final IMapViewManager viewController = controller.getMapViewManager();
final Component parentComponent;
if (node == null) {
parentComponent = getCurrentRootComponent();
} else {
viewController.scrollNodeToVisible(node);
parentComponent = viewController.getComponent(node);
}
return JOptionPane.showConfirmDialog(parentComponent, message, title, optionType, messageType);
}
Aggregations