![JAR search and dependency download from the Maven repository](/logo.png)
uk.theretiredprogrammer.nbreleaseplugin.ViewerWarningDialog Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nbreleaseplugin Show documentation
Show all versions of nbreleaseplugin Show documentation
Plugin to support the Maven Release Processes from within Netbeans IDE
The newest version!
/*
* Copyright 2017 Richard Linsdale.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package uk.theretiredprogrammer.nbreleaseplugin;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import org.openide.DialogDescriptor;
import org.openide.DialogDisplayer;
/**
* The Warning Dialog class which provides direction for modifying/adding more
* complex POM elements. It is used by the viewer.
*
* @author richard linsdale (richard at theretiredprogrammer.uk)
*/
public class ViewerWarningDialog {
private static ViewerWarningDialog instance = null;
/**
* Display the Warning.
*
* @param title the warning title
* @param panel the warning panel
*/
public static void show(String title, ViewerWarningPanel panel) {
instance = new ViewerWarningDialog(title, panel);
}
private final DialogDescriptor dd;
private final DialogCloseListener dcl = new DialogCloseListener();
private ViewerWarningDialog(String title, ViewerWarningPanel panel) {
dd = new DialogDescriptor(
panel,
title,
false, //isModal,
DialogDescriptor.OK_CANCEL_OPTION,
DialogDescriptor.OK_OPTION,
new DialogDoneListener()
);
dd.setClosingOptions(new Object[]{});
dd.addPropertyChangeListener(dcl);
DialogDisplayer.getDefault().notifyLater(dd);
}
private final class DialogDoneListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == DialogDescriptor.OK_OPTION) {
dd.removePropertyChangeListener(dcl);
dd.setClosingOptions(null); // and allow closing
instance = null;
}
}
}
private final class DialogCloseListener implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent evt) {
dd.removePropertyChangeListener(dcl);
dd.setClosingOptions(null); // and allow closing
instance = null;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy