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


Java InputDialog.getValue方法代码示例

本文整理汇总了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;
}
 
开发者ID:rajendarreddyj,项目名称:eclipse-weblogic-plugin,代码行数:20,代码来源:JVMOptionEditor.java

示例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;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:18,代码来源:RenameElementHandler.java

示例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);
    }
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:26,代码来源:AddKeyAction.java

示例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();
		}
	}
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:26,代码来源:RenameActionProvider.java

示例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);
}
 
开发者ID:iloveeclipse,项目名称:skin4eclipse,代码行数:27,代码来源:SystemMenuSaveSession.java

示例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;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:30,代码来源:RenameResourceAction.java

示例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;
  }

}
 
开发者ID:debrief,项目名称:limpet,代码行数:18,代码来源:RCPContext.java

示例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);
        }
    }
}
 
开发者ID:dbflute-session,项目名称:erflute,代码行数:18,代码来源:ChangeVirtualDiagramNameAction.java

示例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();
		}
	};
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:NewNameQueries.java

示例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;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:26,代码来源:GraphGeneratorHandler.java

示例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;
	}

}
 
开发者ID:edgarmueller,项目名称:emfstore-rest,代码行数:29,代码来源:ImportProjectHandler.java

示例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;
}
 
开发者ID:chrrasmussen,项目名称:NTNU-Master-Project,代码行数:24,代码来源:ConnectHandler.java

示例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 );
		}
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:19,代码来源:LevelPropertyDialog.java

示例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);
	}
}
 
开发者ID:GreenDelta,项目名称:olca-app,代码行数:24,代码来源:ModelEditor.java

示例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);
		}
	}

}
 
开发者ID:tsvetan-stoyanov,项目名称:launchpi,代码行数:19,代码来源:RPITab.java


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