本文整理汇总了Java中org.eclipse.jface.dialogs.InputDialog.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java InputDialog.getValue方法的具体用法?Java InputDialog.getValue怎么用?Java InputDialog.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.dialogs.InputDialog
的用法示例。
在下文中一共展示了InputDialog.getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInputObject
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
/**
* @param current
* @return
*/
protected String getInputObject(final String current) {
final InputDialog dialog = new InputDialog(this.getShell(), JVM_NEW_LABEL, JVM_ENTER_LABEL, current, null);
String param = null;
final int dialogCode = dialog.open();
if (dialogCode == 0) {
param = dialog.getValue();
if (param != null) {
param = param.trim();
if (param.length() == 0) {
return null;
}
}
}
return param;
}
示例2: execute
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
NamedElement element = refactoring.getContextObject();
if (element != null) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
InputDialog dialog = new InputDialog(window.getShell(), "Rename..", "Please enter new name:", element.getName(), new NameUniquenessValidator(element));
if (dialog.open() == Window.OK) {
String newName = dialog.getValue();
if (newName != null) {
((RenameRefactoring)refactoring).setNewName(newName);
refactoring.execute();
}
}
}
return null;
}
示例3: run
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
/**
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
KeyTreeNode node = getNodeSelection();
String key = node.getMessageKey();
String msgHead = MessagesEditorPlugin.getString("dialog.add.head");
String msgBody = MessagesEditorPlugin.getString("dialog.add.body");
InputDialog dialog = new InputDialog(
getShell(), msgHead, msgBody, key, new IInputValidator() {
public String isValid(String newText) {
if (getBundleGroup().isMessageKey(newText)) {
return MessagesEditorPlugin.getString(
"dialog.error.exists");
}
return null;
}
});
dialog.open();
if (dialog.getReturnCode() == Window.OK ) {
String inputKey = dialog.getValue();
MessagesBundleGroup messagesBundleGroup = getBundleGroup();
messagesBundleGroup.addMessages(inputKey);
}
}
示例4: run
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
@Override
public void run() {
InputDialog inputDialog = new InputDialog(null, "Provide String", "Provide a new Name for the EClass", eclass.getName(), null);
int open = inputDialog.open();
if (open == Dialog.OK) {
String newName = inputDialog.getValue();
Resource resource = eclass.eResource();
ResourceSet resourceSet = resource.getResourceSet();
TransactionalEditingDomain domain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(resourceSet);
try{
if (domain != null){
Command setCommand = domain.createCommand(SetCommand.class, new CommandParameter(eclass,
EcorePackage.Literals.ENAMED_ELEMENT__NAME, newName));
domain.getCommandStack().execute(setCommand);
try {
resource.save(Collections.emptyMap());
} catch (IOException e) {
e.printStackTrace();
}
}
}finally{
domain.dispose();
}
}
}
示例5: run
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
public void run() {
IPresentablePart[] partList = site.getPartList();
List/*<EditorInfo>*/ infos = new ArrayList();
for (int i = 0; i < partList.length; i++) {
EditorInfo info = presentation.createEditorInfo(partList[i]);
if(info != null){
infos.add(info);
}
}
if(infos.isEmpty()){
// TODO show message
return;
}
boolean createNew = sessionName == null;
if(createNew){
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
InputDialog dialog = new InputDialog(window.getShell(), "Save session",
"Enter session name", null, new SessionNameValidator(true));
int result = dialog.open();
if(result == Window.CANCEL){
return;
}
sessionName = dialog.getValue();
}
Sessions.getInstance().createSession(sessionName, infos, !createNew);
}
示例6: queryNewResourceName
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
/**
* Return the new name to be given to the target resource.
*
* @return java.lang.String
* @param resource
* the resource to query status on
*/
protected String queryNewResourceName(final IResource resource) {
final IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace();
final IPath prefix = resource.getFullPath().removeLastSegments(1);
final IInputValidator validator = string -> {
if (resource.getName()
.equals(string)) { return IDEWorkbenchMessages.RenameResourceAction_nameMustBeDifferent; }
final IStatus status = workspace.validateName(string, resource.getType());
if (!status.isOK()) { return status.getMessage(); }
if (workspace.getRoot()
.exists(prefix.append(string))) { return IDEWorkbenchMessages.RenameResourceAction_nameExists; }
return null;
};
final InputDialog dialog =
new InputDialog(WorkbenchHelper.getShell(), IDEWorkbenchMessages.RenameResourceAction_inputDialogTitle,
IDEWorkbenchMessages.RenameResourceAction_inputDialogMessage, resource.getName(), validator);
dialog.setBlockOnOpen(true);
final int result = dialog.open();
if (result == Window.OK)
return dialog.getValue();
return null;
}
示例7: getInput
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
@Override
public String getInput(String title, String description, String defaultText)
{
InputDialog dlgName =
new InputDialog(Display.getCurrent().getActiveShell(), title,
description, defaultText, null);
if (dlgName.open() == Window.OK)
{
// User clicked OK; update the label with the input
return dlgName.getValue();
}
else
{
return null;
}
}
示例8: execute
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
@Override
public void execute(Event event) {
final ERDiagram diagram = getDiagram();
final List<?> selectedEditParts = getTreeViewer().getSelectedEditParts();
final EditPart editPart = (EditPart) selectedEditParts.get(0);
final Object model = editPart.getModel();
if (model instanceof ERVirtualDiagram) {
final ERVirtualDiagram vdiagram = (ERVirtualDiagram) model;
final InputVirtualDiagramNameValidator validator = new InputVirtualDiagramNameValidator(diagram, vdiagram.getName());
final InputDialog dialog = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Rename",
"Input new name", vdiagram.getName(), validator);
if (dialog.open() == IDialogConstants.OK_ID) {
final ChangeVirtualDiagramNameCommand command = new ChangeVirtualDiagramNameCommand(vdiagram, dialog.getValue());
execute(command);
}
}
}
示例9: createStaticQuery
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
private static INewNameQuery createStaticQuery(final IInputValidator validator, final String message, final String initial, final Shell shell){
return new INewNameQuery(){
public String getNewName() throws OperationCanceledException {
InputDialog dialog= new InputDialog(shell, ReorgMessages.ReorgQueries_nameConflictMessage, message, initial, validator) {
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.InputDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
Control area= super.createDialogArea(parent);
TextFieldNavigationHandler.install(getText());
return area;
}
};
if (dialog.open() == Window.CANCEL)
throw new OperationCanceledException();
return dialog.getValue();
}
};
}
示例10: getGraphingRadius
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
protected int getGraphingRadius(int defaultSize) {
Shell shell = new Shell();
InputDialog dlg = new InputDialog(
shell,
"Graph Radius",
"How many edges from anchor?",
"" + defaultSize,
null);
dlg.open();
if (dlg.getReturnCode() == Window.CANCEL) {
throw new CancellationException();
}
if (dlg.getReturnCode() != Window.OK) {
return defaultSize;
}
String strval = dlg.getValue();
try {
int intVal = Integer.parseInt(strval.trim());
return intVal;
}
catch (Throwable t) {
t.printStackTrace();
}
return defaultSize;
}
示例11: showProjectNameDialog
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
/**
* Shows a dialog so that the user can provide a name for the imported project.
*
* @param initialProjectName the name of the project that should be shown when opening the dialog
* @return the entered project name
*/
private String showProjectNameDialog(String initialProjectName) {
IInputValidator inputValidator = new IInputValidator() {
public String isValid(String newText) {
if (newText == null || newText.equals("") || newText.matches("\\s*")) {
return "No project name provided!";
}
return null;
}
};
InputDialog inputDialog = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
"Project Name", "Please enter a name for the imported project:", initialProjectName, inputValidator);
if (inputDialog.open() == Dialog.OK) {
return inputDialog.getValue();
} else {
return null;
}
}
示例12: execute
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
String title = "Connect to remote actor";
String question = "What is the address of the remote actor?";
InputDialog dialog = new InputDialog(shell, title, question, null, null);
dialog.open();
if (dialog.getReturnCode() == Window.OK) {
String path = dialog.getValue();
try {
PluginHelper.start(path);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
示例13: handleDefaultValueEditEvent
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
private void handleDefaultValueEditEvent( )
{
InputDialog dialog = new InputDialog(this.getShell( ), DEFAULTVALUE_EDIT_TITLE, DEFAULTVALUE_EDIT_LABEL, DEUtil.resolveNull( input.getDefaultValue( )), null);
if(dialog.open( ) == Window.OK){
String value = dialog.getValue( );
try
{
if(value==null || value.trim( ).length( ) == 0)
input.setDefaultValue( null );
else input.setDefaultValue( value.trim( ) );
defaultValueViewer.refresh( );
}
catch ( SemanticException e )
{
ExceptionHandler.handle( e );
}
}
}
示例14: doSaveAs
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void doSaveAs() {
InputDialog diag = new InputDialog(UI.shell(), M.SaveAs, M.SaveAs,
model.getName() + " - Copy", (name) -> {
if (Strings.nullOrEmpty(name))
return M.NameCannotBeEmpty;
if (Strings.nullOrEqual(name, model.getName()))
return M.NameShouldBeDifferent;
return null;
});
if (diag.open() != Window.OK)
return;
String newName = diag.getValue();
try {
T clone = (T) model.clone();
clone.setName(newName);
clone = dao.insert(clone);
App.openEditor(clone);
} catch (Exception e) {
log.error("failed to save " + model + " as " + newName, e);
}
}
示例15: createNewHost
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
private void createNewHost() {
final IHost[] hosts = getHosts();
IInputValidator validator = new HostNameInputValidator(hosts);
InputDialog inputDialog = new InputDialog(getShell(), Messages.New_RPI_Host, Messages.Enter_Host_Name, "", validator); //$NON-NLS-3$ //$NON-NLS-1$
int result = inputDialog.open();
if (result == Dialog.OK) {
String hostName = inputDialog.getValue();
inputDialog.close();
try {
IHost host = RSECorePlugin.getTheSystemRegistry().createHost(
RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID), hostName, hostName, hostName);
updateRPICombo(getHosts(), host);
} catch (Exception ex) {
LaunchPlugin.reportError(Messages.Create_Config_Failed, ex);
}
}
}