@Override protected void createFieldEditors() { Group group = SWTUtil.createGroup(getFieldEditorParent(), "FreeMarker Debugger", 1); // $NON-NLS-1$ GridData gd = new GridData(GridData.FILL_HORIZONTAL); group.setLayoutData(gd); Composite composite = SWTUtil.createComposite(group, 2, 2, GridData.FILL_HORIZONTAL); StringFieldEditor passwordEditor = new StringFieldEditor( LiferayDebugCore.PREF_FM_DEBUG_PASSWORD, "Password:"******"Password is invalid."); passwordEditor.setPreferenceStore(getPreferenceStore()); addField(passwordEditor); IntegerFieldEditor portEditor = new IntegerFieldEditor( LiferayDebugCore.PREF_FM_DEBUG_PORT, "Port:", composite); // $NON-NLS-1$ portEditor.setValidRange(1025, 65535); portEditor.setEmptyStringAllowed(false); portEditor.setPreferenceStore(getPreferenceStore()); portEditor.setErrorMessage("Port value ranges from integer 1025 to 65535."); // $NON-NLS-1$ portEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); addField(portEditor); }
protected void createControl() { setLayout(new GridLayout(1, false)); disableValidation = true; Group connectionGroup = SWTUtil.createGroup(this, Msgs.connectionSettings, 2); connectionGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); Label labelHostname = new Label(connectionGroup, SWT.NONE); labelHostname.setText(Msgs.hostname); textHostname = new Text(connectionGroup, SWT.BORDER); textHostname.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textHostname.addModifyListener(this); labelHttpPort = new Label(connectionGroup, SWT.NONE); labelHttpPort.setText(Msgs.httpPortLabel); textHTTP = new Text(connectionGroup, SWT.BORDER); textHTTP.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); textHTTP.addModifyListener(this); labelUsername = new Label(connectionGroup, SWT.NONE); labelUsername.setText(Msgs.username); textUsername = new Text(connectionGroup, SWT.BORDER); textUsername.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); textUsername.addModifyListener(this); labelPassword = new Label(connectionGroup, SWT.NONE); labelPassword.setText(Msgs.password); textPassword = new Text(connectionGroup, SWT.BORDER | SWT.PASSWORD); textPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textPassword.addModifyListener(this); labelLiferayPortalContextPath = new Label(connectionGroup, SWT.NONE); labelLiferayPortalContextPath.setText(Msgs.liferayPortalContextPath); labelLiferayPortalContextPath.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); textLiferayPortalContextPath = new Text(connectionGroup, SWT.BORDER); textLiferayPortalContextPath.setLayoutData( new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textLiferayPortalContextPath.addModifyListener(this); labelServerManagerContextPath = new Label(connectionGroup, SWT.NONE); labelServerManagerContextPath.setText(Msgs.serverManagerContextPath); labelServerManagerContextPath.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); textServerManagerContextPath = new Text(connectionGroup, SWT.BORDER); textServerManagerContextPath.setLayoutData( new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textServerManagerContextPath.addModifyListener(this); final String marketplaceLinkLabel = Msgs.installRemoteIDEConnector; final String appUrl = "http://www.liferay.com/marketplace/-/mp/application/15193785"; //$NON-NLS-1$ SWTUtil.createHyperLink(this, SWT.NONE, marketplaceLinkLabel, 1, appUrl); final String installLabel = NLS.bind("<a>{0}</a>", Msgs.clickHereLink); // $NON-NLS-1$ final String installUrl = "{0}/group/control_panel/manage?p_p_id=1_WAR_marketplaceportlet&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&appId=15193785"; //$NON-NLS-1$ final Link installLink = SWTUtil.createLink(this, SWT.NONE, installLabel, 1); installLink.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { try { final String url = MessageFormat.format( installUrl, "http://" + textHostname.getText() + ":" + textHTTP.getText()); // $NON-NLS-1$ //$NON-NLS-2$ PlatformUI.getWorkbench() .getBrowserSupport() .getExternalBrowser() .openURL(new URL(url)); } catch (Exception e1) { LiferayUIPlugin.logError("Could not open external browser.", e1); // $NON-NLS-1$ } }; }); Composite validateComposite = new Composite(this, SWT.NONE); validateComposite.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, false, true)); validateComposite.setLayout(new GridLayout(1, false)); Button validateButton = new Button(validateComposite, SWT.PUSH); validateButton.setText(Msgs.validateConnection); validateButton.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, false, false)); validateButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { validate(); } }); // initDataBindings(); disableValidation = false; validate(); }