当前位置: 首页>>代码示例>>Java>>正文


Java SwingTools.showConfirmDialog方法代码示例

本文整理汇总了Java中com.rapidminer.gui.tools.SwingTools.showConfirmDialog方法的典型用法代码示例。如果您正苦于以下问题:Java SwingTools.showConfirmDialog方法的具体用法?Java SwingTools.showConfirmDialog怎么用?Java SwingTools.showConfirmDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.rapidminer.gui.tools.SwingTools的用法示例。


在下文中一共展示了SwingTools.showConfirmDialog方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: overwriteProcess

import com.rapidminer.gui.tools.SwingTools; //导入方法依赖的package包/类
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();
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:26,代码来源:StoreProcessAction.java

示例2: actionPerformed

import com.rapidminer.gui.tools.SwingTools; //导入方法依赖的package包/类
@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();
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:19,代码来源:Item.java

示例3: actionPerformed

import com.rapidminer.gui.tools.SwingTools; //导入方法依赖的package包/类
@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));
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:29,代码来源:AbstractRepositoryAction.java

示例4: noMoreHits

import com.rapidminer.gui.tools.SwingTools; //导入方法依赖的package包/类
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;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:14,代码来源:SearchDialog.java

示例5: newProcess

import com.rapidminer.gui.tools.SwingTools; //导入方法依赖的package包/类
/**
 * 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.NO_OPTION) {
			return;
		}
	}

	ProgressThread newProcessThread = 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
				resetUndo();

				stopProcess();
				changed = false;
				setProcess(new Process(), true);
				addToUndoList();
				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);
			}
		}
	};
	newProcessThread.setIndeterminate(true);
	newProcessThread.setCancelable(false);
	newProcessThread.start();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:48,代码来源:MainFrame.java

示例6: close

import com.rapidminer.gui.tools.SwingTools; //导入方法依赖的package包/类
protected void close() {
    if(this.changed) {
        ManagedExtension.saveConfiguration();
        if(SwingTools.showConfirmDialog("manage_extensions.restart", 0, new Object[0]) == 0) {
            RapidMinerGUI.getMainFrame().exit(true);
        }
    }

    super.close();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:11,代码来源:ExtensionDialog.java

示例7: close

import com.rapidminer.gui.tools.SwingTools; //导入方法依赖的package包/类
/**
 * Closes the current process
 *
 * @param askForConfirmation
 *            if <code>true</code>, will prompt the user if he really wants to close the current
 *            process
 * @return
 */
public boolean close(final boolean askForConfirmation) {
	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(getProcess());

				// it may happen that save() does not actually save the process, because the
				// user hits cancel in the
				// saveAs dialog or an error occurs. In this case the process won't be marked as
				// unchanged. Thus,
				// we return the process changed status.
				return !isChanged();
			case ConfirmDialog.NO_OPTION:
				// ask for confirmation before stopping the currently running process (if
				// askForConfirmation=true)
				if (askForConfirmation) {
					if (RapidMinerGUI.getMainFrame().getProcessState() == Process.PROCESS_STATE_RUNNING
							|| RapidMinerGUI.getMainFrame().getProcessState() == Process.PROCESS_STATE_PAUSED) {
						if (SwingTools.showConfirmDialog("close_running_process",
								ConfirmDialog.YES_NO_OPTION) == ConfirmDialog.NO_OPTION) {
							return false;
						}
					}
				}
				if (getProcessState() != Process.PROCESS_STATE_STOPPED) {
					synchronized (processThread) {
						processThread.stopProcess();
					}
				}
				return true;
			default: // cancel
				return false;
		}
	} else {
		return true;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:53,代码来源:MainFrame.java

示例8: exit

import com.rapidminer.gui.tools.SwingTools; //导入方法依赖的package包/类
public void exit(final 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(ApplicationFrame.getApplicationFrame(), "exit",
						ConfirmDialog.YES_NO_OPTION, RapidMinerGUI.PROPERTY_CONFIRM_EXIT, ConfirmDialog.YES_OPTION);
				if (answer != ConfirmDialog.YES_OPTION) {
					return;
				}
			}
		}
	}
	stopProcess();
	dispose();
	RapidMiner.quit(relaunch ? RapidMiner.ExitMode.RELAUNCH : RapidMiner.ExitMode.NORMAL);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:46,代码来源:MainFrame.java


注:本文中的com.rapidminer.gui.tools.SwingTools.showConfirmDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。