use of au.gov.asd.tac.constellation.plugins.gui.PluginParametersSwingDialog in project constellation by constellation-app.
the class SaveTemplateAction method actionPerformed.
@Override
public void actionPerformed(final ActionEvent e) {
final Plugin plugin = PluginRegistry.get(GraphNodePluginRegistry.SAVE_TEMPLATE);
final PluginParameters params = plugin.createParameters();
while (true) {
final PluginParametersSwingDialog dialog = new PluginParametersSwingDialog(Bundle.CTL_SaveTemplateAction(), params);
dialog.showAndWait();
if (PluginParametersDialog.OK.equals(dialog.getResult())) {
if (NewSchemaGraphAction.getTemplateNames().containsKey(params.getStringValue(SaveTemplatePlugin.TEMPLATE_NAME_PARAMETER_ID))) {
final PluginParameters warningParams = new PluginParameters();
final PluginParameter<StringParameterValue> warningMessageParam = StringParameterType.build("");
warningMessageParam.setName("");
warningMessageParam.setStringValue("Warning template with that name already exists - really overwrite?");
StringParameterType.setIsLabel(warningMessageParam, true);
warningParams.addParameter(warningMessageParam);
final PluginParametersSwingDialog overwrite = new PluginParametersSwingDialog("Overwrite?", warningParams);
overwrite.showAndWait();
if (!PluginParametersDialog.OK.equals(overwrite.getResult())) {
continue;
}
}
Future<?> f = PluginExecution.withPlugin(plugin).withParameters(params).executeLater(context.getGraph());
PluginExecution.withPlugin(new SimplePlugin() {
@Override
public String getName() {
return "Update Template Menu";
}
@Override
protected void execute(final PluginGraphs graphs, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException, PluginException {
NewSchemaGraphAction.recreateTemplateMenuItems();
}
}).waitingFor(f).executeLater(null);
}
break;
}
}
use of au.gov.asd.tac.constellation.plugins.gui.PluginParametersSwingDialog in project constellation by constellation-app.
the class ManageTemplatesAction method actionPerformed.
@Override
public void actionPerformed(final ActionEvent e) {
final Plugin plugin = PluginRegistry.get(GraphNodePluginRegistry.MANAGE_TEMPLATES);
final PluginParameters params = plugin.createParameters();
final PluginParametersSwingDialog dialog = new PluginParametersSwingDialog(Bundle.CTL_ManageTemplatesAction(), params);
dialog.showAndWait();
if (PluginParametersDialog.OK.equals(dialog.getResult())) {
Future<?> f = PluginExecution.withPlugin(plugin).withParameters(params).executeLater(null);
PluginExecution.withPlugin(new SimplePlugin() {
@Override
public String getName() {
return "Update Template Menu";
}
@Override
protected void execute(final PluginGraphs graphs, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException, PluginException {
NewSchemaGraphAction.recreateTemplateMenuItems();
}
}).waitingFor(f).executeLater(null);
}
}
use of au.gov.asd.tac.constellation.plugins.gui.PluginParametersSwingDialog in project constellation by constellation-app.
the class TestNotificationsAction method actionPerformed.
@Override
public void actionPerformed(final ActionEvent e) {
// plugin notifications
final Plugin plugin = new TestNotificationsPlugin();
final PluginParameters pp = plugin.createParameters();
final PluginParametersSwingDialog dialog = new PluginParametersSwingDialog(Bundle.CTL_TestNotificationsAction(), pp);
dialog.showAndWait();
if (PluginParametersDialog.OK.equals(dialog.getResult())) {
PluginExecution.withPlugin(plugin).withParameters(pp).executeLater(context.getGraph());
}
// NetBeans NotifyDisplayer options
NotifyDisplayer.display(PLAIN_MESSAGE, NotifyDescriptor.PLAIN_MESSAGE);
NotifyDisplayer.display(QUESTION_MESSAGE, NotifyDescriptor.QUESTION_MESSAGE);
NotifyDisplayer.display(INFORMATION_MESSAGE, NotifyDescriptor.INFORMATION_MESSAGE);
NotifyDisplayer.display(WARNING_MESSAGE, NotifyDescriptor.WARNING_MESSAGE);
NotifyDisplayer.display(ERROR_MESSAGE, NotifyDescriptor.ERROR_MESSAGE);
// Constellation Utility options
Platform.runLater(() -> {
NotifyDisplayer.displayAlert(DISPLAY_ALERT, PLAIN, PLAIN_MESSAGE, Alert.AlertType.NONE);
NotifyDisplayer.displayAlert(DISPLAY_ALERT, INFORMATION, INFORMATION_MESSAGE, Alert.AlertType.INFORMATION);
NotifyDisplayer.displayAlert(DISPLAY_ALERT, WARNING, WARNING_MESSAGE, Alert.AlertType.WARNING);
NotifyDisplayer.displayAlert(DISPLAY_ALERT, ERROR, ERROR_MESSAGE, Alert.AlertType.ERROR);
NotifyDisplayer.displayLargeAlert(DISPLAY_LARGE_ALERT, PLAIN, PLAIN_MESSAGE, Alert.AlertType.NONE);
NotifyDisplayer.displayLargeAlert(DISPLAY_LARGE_ALERT, INFORMATION, INFORMATION_MESSAGE, Alert.AlertType.INFORMATION);
NotifyDisplayer.displayLargeAlert(DISPLAY_LARGE_ALERT, WARNING, WARNING_MESSAGE, Alert.AlertType.WARNING);
NotifyDisplayer.displayLargeAlert(DISPLAY_LARGE_ALERT, ERROR, ERROR_MESSAGE, Alert.AlertType.ERROR);
});
}
use of au.gov.asd.tac.constellation.plugins.gui.PluginParametersSwingDialog in project constellation by constellation-app.
the class TestParameterBuildingAction method actionPerformed.
@Override
public void actionPerformed(final ActionEvent e) {
final Plugin plugin = new TestParameterBuildingPlugin();
final PluginParameters pp = plugin.createParameters();
final PluginParametersSwingDialog dialog = new PluginParametersSwingDialog(Bundle.CTL_TestParameterBuildingAction(), pp);
dialog.showAndWait();
if (PluginParametersDialog.OK.equals(dialog.getResult())) {
PluginExecution.withPlugin(plugin).withParameters(pp).executeLater(context.getGraph());
}
}
use of au.gov.asd.tac.constellation.plugins.gui.PluginParametersSwingDialog in project constellation by constellation-app.
the class BlazeUtilities method colorDialog.
/**
* Display a dialog box to select a color. Option to save color as a preset
* is represented by a checkbox. The preset will be saved in the first
* instance of a free position, otherwise the last index of the presets will
* be used and overridden.
*
* @param blazeColor The initial value of the color.
*
* @return a pair containing 1) if the user pressed OK and 2) the selected
* blaze color.
*/
public static Pair<Boolean, ConstellationColor> colorDialog(final ConstellationColor blazeColor) {
final PluginParameters dlgParams = new PluginParameters();
final PluginParameter<ColorParameterValue> colorParam = ColorParameterType.build(COLOR_PARAMETER_ID);
colorParam.setName("Color");
colorParam.setDescription(BLAZE_COLOR_PARAMETER_ID);
dlgParams.addParameter(colorParam);
final PluginParameter<BooleanParameterValue> presetParam = BooleanParameterType.build(PRESET_PARAMETER_ID);
presetParam.setName("Preset");
presetParam.setDescription("Save as Preset");
presetParam.setBooleanValue(false);
dlgParams.addParameter(presetParam);
final PluginParametersSwingDialog dialog = new PluginParametersSwingDialog(BLAZE_COLOR_PARAMETER_ID, dlgParams);
dialog.showAndWait();
final boolean isOk = PluginParametersDialog.OK.equals(dialog.getResult());
ConstellationColor colorResult = blazeColor;
if (isOk) {
colorResult = dlgParams.getColorValue(COLOR_PARAMETER_ID);
if (dlgParams.getBooleanValue(PRESET_PARAMETER_ID)) {
savePreset(colorResult.getJavaColor());
}
}
return new Pair<>(isOk, colorResult);
}
Aggregations