本文整理汇总了Java中com.rapidminer.gui.tools.dialogs.ConfirmDialog.YES_OPTION属性的典型用法代码示例。如果您正苦于以下问题:Java ConfirmDialog.YES_OPTION属性的具体用法?Java ConfirmDialog.YES_OPTION怎么用?Java ConfirmDialog.YES_OPTION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.rapidminer.gui.tools.dialogs.ConfirmDialog
的用法示例。
在下文中一共展示了ConfirmDialog.YES_OPTION属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: overwriteProcess
private void overwriteProcess(final ProcessEntry processEntry) {
if (SwingTools.showConfirmDialog("overwrite", ConfirmDialog.YES_NO_OPTION, processEntry.getLocation()) == ConfirmDialog.YES_OPTION) {
ProgressThread storeProgressThread = new ProgressThread("store_process") {
@Override
public void run() {
getProgressListener().setTotal(100);
getProgressListener().setCompleted(10);
try {
Process process = RapidMinerGUI.getMainFrame().getProcess();
process.setProcessLocation(new RepositoryProcessLocation(processEntry.getLocation()));
processEntry.storeXML(process.getRootOperator().getXML(false));
RapidMinerGUI.addToRecentFiles(process.getProcessLocation());
RapidMinerGUI.getMainFrame().processHasBeenSaved();
} catch (Exception e) {
SwingTools.showSimpleErrorMessage("cannot_store_process_in_repository", e, processEntry.getName());
} finally {
getProgressListener().setCompleted(100);
getProgressListener().complete();
}
}
};
storeProgressThread.start();
}
}
示例2: actionPerformed
@Override
public void actionPerformed(ActionEvent e) {
boolean res = false;
String itemString = (isDirectory() ? "directory" : "file") + " " + getItemName();
int resInt = SwingTools.showConfirmDialog("file_chooser.delete", ConfirmDialog.YES_NO_CANCEL_OPTION, itemString);
if (resInt == ConfirmDialog.YES_OPTION) {
try {
res = delete();
} catch (Exception exp) {
// do nothing
}
if (!res) {
SwingTools.showVerySimpleErrorMessage("file_chooser.delete.error", itemString);
} else {
getParentPane().getFilePane().rescanDirectory();
}
}
}
示例3: loggedActionPerformed
@Override
public void loggedActionPerformed(ActionEvent e) {
boolean res = false;
String itemString = (isDirectory() ? "directory" : "file") + " " + getItemName();
int resInt = SwingTools.showConfirmDialog("file_chooser.delete", ConfirmDialog.YES_NO_CANCEL_OPTION, itemString);
if (resInt == ConfirmDialog.YES_OPTION) {
try {
res = delete();
} catch (Exception exp) {
// do nothing
}
if (!res) {
SwingTools.showVerySimpleErrorMessage("file_chooser.delete.error", itemString);
} else {
getParentPane().getFilePane().rescanDirectory();
}
}
}
示例4: checkUnsavedChanges
/** Checks if the user changed any values or have an unsaved Item opened and asks him to save those changes before closing the dialog.
* Returns true if the dialog can be closed, false otherwise.
* @throws ConfigurationException **/
protected boolean checkUnsavedChanges() throws ConfigurationException {
//T inputFieldEntry = getConfigurableFromInputFields();
if (hasUnsavedChanges()) {
// If the user has changed any values / new unsaved entry
int saveBeforeOpen = SwingTools.showConfirmDialog("configuration.dialog.savecurrent", ConfirmDialog.YES_NO_CANCEL_OPTION, getConfigurableFromInputFields().getName());
if (saveBeforeOpen == ConfirmDialog.YES_OPTION) {
// YES: Speichere alles
entrySaved = false;
SAVE_ENTRY_ACTION.actionPerformed(null);
if (entrySaved) {
return true;
} else {
return false;
}
} else if (saveBeforeOpen == ConfirmDialog.NO_OPTION) {
// NO: Verwerfe alles
return true;
} else if (saveBeforeOpen == ConfirmDialog.CANCEL_OPTION) {
return false;
}
}
return true;
}
示例5: windowClosing
@Override
public void windowClosing(WindowEvent event) {
if (backgroundJob != null) {
if (SwingTools.invokeAndWaitWithResult(confirmResultRunnable) != ConfirmDialog.YES_OPTION) {
closeDialog = false;
} else {
closeDialog = true;
}
confirmDialog = null;
if (closeDialog && backgroundJob != null) {
stopButton.doClick();
}
}
}
示例6: actionPerformed
@Override
public void actionPerformed(ActionEvent e) {
List<Entry> entries = tree.getSelectedEntries();
// Deletion of elements
if (e.getActionCommand().equals(DeleteRepositoryEntryAction.I18N_KEY)
|| e.getActionCommand().equals(CutCopyPasteDeleteAction.DELETE_ACTION_COMMAND_KEY)) {
if (entries.size() == 1) {
if (SwingTools.showConfirmDialog("file_chooser.delete", ConfirmDialog.YES_NO_OPTION, entries.get(0)
.getName()) != ConfirmDialog.YES_OPTION) {
return;
}
} else {
if (SwingTools
.showConfirmDialog("file_chooser.delete_multiple", ConfirmDialog.YES_NO_OPTION, entries.size()) != ConfirmDialog.YES_OPTION) {
return;
}
}
}
// Do not treat entries, whose are already included in selected folders
entries = removeIntersectedEntries(tree.getSelectedEntries());
for (Entry entry : entries) {
actionPerformed(requiredSelectionType.cast(entry));
}
}
示例7: noMoreHits
private void noMoreHits() {
String restartAt = backwardRadioButton.isSelected() ? "end" : "beginning";
switch (SwingTools.showConfirmDialog("editor.search_replace.no_more_hits", ConfirmDialog.YES_NO_OPTION, restartAt)) {
case ConfirmDialog.YES_OPTION:
textComponent.setCaretPosition(
backwardRadioButton.isSelected() ? textComponent.getText().replaceAll("\r", "").length() : 0);
search();
break;
case ConfirmDialog.NO_OPTION:
default:
return;
}
}
示例8: noMoreHits
private void noMoreHits() {
String restartAt = backwardRadioButton.isSelected() ? "end" : "beginning";
switch (SwingTools.showConfirmDialog(SearchDialog.this, "editor.search_replace.no_more_hits",
ConfirmDialog.YES_NO_OPTION, restartAt)) {
case ConfirmDialog.YES_OPTION:
textComponent.setCaretPosition(
backwardRadioButton.isSelected() ? textComponent.getText().replaceAll("\r", "").length() : 0);
search();
break;
case ConfirmDialog.NO_OPTION:
default:
return;
}
}
示例9: newProcess
/**
* Creates a new process. Depending on the given parameter, the user will or will not be asked
* to save unsaved changes.
*
* @param checkforUnsavedWork
* Iff {@code true} the user is asked to save their unsaved work (if any), otherwise
* unsaved work is discarded without warning.
*/
public void newProcess(final boolean checkforUnsavedWork) {
// ask for confirmation before stopping the currently running process and opening a new one!
if (getProcessState() == Process.PROCESS_STATE_RUNNING || getProcessState() == Process.PROCESS_STATE_PAUSED) {
if (SwingTools.showConfirmDialog("close_running_process",
ConfirmDialog.YES_NO_OPTION) != ConfirmDialog.YES_OPTION) {
return;
}
}
ProgressThread newProgressThread = new ProgressThread("new_process") {
@Override
public void run() {
// Invoking close() will ask the user to save their work if there are unsaved
// changes. This method can be skipped if it is already clear that changes should be
// discarded.
boolean resetProcess = checkforUnsavedWork ? close(false) : true;
if (resetProcess) {
// process changed -> clear undo history
stopProcess();
setProcess(new Process(), true);
if (!"false"
.equals(ParameterService.getParameterValue(PROPERTY_RAPIDMINER_GUI_SAVE_ON_PROCESS_CREATION))) {
SaveAction.saveAsync(getProcess());
}
// always have save action enabled. If process is not yet associated with
// location SaveAs will be used
SAVE_ACTION.setEnabled(true);
}
}
};
newProgressThread.setIndeterminate(true);
newProgressThread.setCancelable(false);
newProgressThread.start();
}
示例10: close
@Override
protected void close() {
if (changed) {
ManagedExtension.saveConfiguration();
if (SwingTools.showConfirmDialog("manage_extensions.restart", ConfirmDialog.YES_NO_OPTION) == ConfirmDialog.YES_OPTION) {
RapidMinerGUI.getMainFrame().exit(true);
}
}
super.close();
}
示例11: actionPerformed
@Override
public void actionPerformed(Entry entry) {
if (SwingTools.showConfirmDialog("file_chooser.delete", ConfirmDialog.YES_NO_OPTION, entry.getName()) == ConfirmDialog.YES_OPTION) {
try {
final RepositoryLocation location;
if (entry.getContainingFolder() != null) {
location = entry.getContainingFolder().getLocation();
} else {
location = null;
}
entry.delete();
// select parent node (if possible)
// invoke later because a JTree will select another node as a result of a deletion event
// we want to select our parent node afterwards
if (location == null) {
return;
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
tree.expandAndSelectIfExists(location);
}
});
} catch (Exception e1) {
SwingTools.showSimpleErrorMessage("cannot_delete_entry", e1, entry.getLocation());
}
}
}
示例12: noMoreHits
private void noMoreHits() {
String restartAt = backwardRadioButton.isSelected() ? "end" : "beginning";
switch (SwingTools.showConfirmDialog("editor.search_replace.no_more_hits", ConfirmDialog.YES_NO_OPTION, restartAt)) {
case ConfirmDialog.YES_OPTION:
textComponent.setCaretPosition(backwardRadioButton.isSelected() ? textComponent.getText().replaceAll("\r","").length() : 0);
search();
break;
case ConfirmDialog.NO_OPTION:
default:
return;
}
}
示例13: startNext
/**
* Starts the next Tour in the tourList
*/
private void startNext() {
if (!newTours.isEmpty()) {
String currentTourKey = newTours.remove();
String propertyKey = "DontAskAgainTourChoosen";
ParameterService.setParameterValue(propertyKey, "null");
int returnValue = ConfirmDialog.showConfirmDialogWithOptionalCheckbox("new_tour_found", ConfirmDialog.YES_NO_OPTION, propertyKey, ConfirmDialog.NO_OPTION, true, currentTourKey);
// save whether we will ask again
if (!Boolean.parseBoolean(ParameterService.getParameterValue(propertyKey))) {
tourManager.setTourState(currentTourKey, TourState.NEVER_ASK);
}
//handle returnValue
if (returnValue == ConfirmDialog.YES_OPTION) {
IntroductoryTour currentTour = tourManager.get(currentTourKey);
currentTour.addListener(new TourListener() {
@Override
public void tourClosed() {
WelcomeTourAction.this.startNext();
}
});
currentTour.startTour();
}
if (returnValue == ConfirmDialog.NO_OPTION) {
this.startNext();
}
}
}
示例14: exit
public void exit(boolean relaunch) {
if (changed) {
ProcessLocation loc = process.getProcessLocation();
String locName;
if (loc != null) {
locName = loc.getShortName();
} else {
locName = "unnamed";
}
switch (SwingTools.showConfirmDialog("save", ConfirmDialog.YES_NO_CANCEL_OPTION, locName)) {
case ConfirmDialog.YES_OPTION:
SaveAction.save(process);
if (changed)
return;
break;
case ConfirmDialog.NO_OPTION:
break;
case ConfirmDialog.CANCEL_OPTION:
default:
return;
}
} else {
if (!relaunch) { // in this case we have already confirmed
// ask for special confirmation before exiting RapidMiner while a process is running!
if (getProcessState() == Process.PROCESS_STATE_RUNNING || getProcessState() == Process.PROCESS_STATE_PAUSED) {
if (SwingTools.showConfirmDialog("exit_despite_running_process", ConfirmDialog.YES_NO_OPTION) == ConfirmDialog.NO_OPTION) {
return;
}
} else {
int answer = ConfirmDialog.showConfirmDialog("exit", ConfirmDialog.YES_NO_OPTION, RapidMinerGUI.PROPERTY_CONFIRM_EXIT, ConfirmDialog.YES_OPTION);
if (answer != ConfirmDialog.YES_OPTION) {
return;
}
}
}
}
stopProcess();
dispose();
RapidMinerGUI.quit(relaunch ? RapidMiner.ExitMode.RELAUNCH : RapidMiner.ExitMode.NORMAL);
}
示例15: askForSafeMode
private boolean askForSafeMode() {
int result = SafeModeDialog.showSafeModeDialog("safemode.enter_safe_mode", ConfirmDialog.YES_NO_OPTION);
return result == ConfirmDialog.YES_OPTION;
}