Java Code Examples for org.eclipse.swt.widgets.Text.addModifyListener()

The following are Jave code examples for showing how to use addModifyListener() of the org.eclipse.swt.widgets.Text class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: gw4e.project   File: GW4ELaunchConfigurationTab.java   Source Code and License Vote up 6 votes
/**
 * Create the element that allow to select a start element See the
 * GraphWalker offline command for more information
 */
private void createStartElementSection(Composite parent) {

	Label fGeneratorLabel = new Label(parent, SWT.NONE);
	fGeneratorLabel.setText("Start Element");
	gd = new GridData();
	gd.horizontalSpan = 1;
	gd.horizontalIndent = 25;
	fGeneratorLabel.setLayoutData(gd);

	fStartNodeText = new Text(parent, SWT.SINGLE | SWT.BORDER);
	fStartNodeText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	fStartNodeText.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent evt) {
			validatePage();
			updateConfigState();
			fStartNodeText.setFocus();
		}
	});
	fStartNodeText.setData(GW4E_LAUNCH_CONFIGURATION_CONTROL_ID, GW4E_LAUNCH_CONFIGURATION_TEXT_ID_START_ELEMENT);
}
 
Example 2
Project: Hydrograph   File: TransformDialog.java   Source Code and License Vote up 6 votes
private void addModifyListenerToAccumulator(Text text,final AbstractExpressionComposite expressionComposite,MappingSheetRow mappingSheetRow) {
	text.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			Text accumulatorTextBox=(Text)e.widget;
			mappingSheetRow.setAccumulator(accumulatorTextBox.getText());
			boolean isValidValue = validate(accumulatorTextBox.getText(),expressionComposite.getComboDataTypes().getText());
			if(!isValidValue && (!expressionComposite.getIsParamAccumulator().getSelection()||StringUtils.isBlank(accumulatorTextBox.getText()))){
				expressionComposite.getTextAccumulator().setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,255,000));
			}else{
				expressionComposite.getTextAccumulator().setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,255,255));
			}
			showHideValidationMessage();
		}
	});
}
 
Example 3
Project: dsp4e   File: DSPMainTab.java   Source Code and License Vote up 6 votes
private void createDebugJSonComponent(Composite parent) {
	Composite comp = new Group(parent, SWT.NONE);
	comp.setLayout(new GridLayout());
	comp.setLayoutData(new GridData(GridData.FILL_BOTH));

	Label jsonLabel = new Label(comp, SWT.NONE);
	jsonLabel.setText("&Launch Parameters (Json):");
	jsonLabel.setLayoutData(new GridData(GridData.BEGINNING));

	jsonText = new Text(comp, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
	jsonText.setLayoutData(new GridData(GridData.FILL_BOTH));
	jsonText.addModifyListener(new ModifyListener() {

		@Override
		public void modifyText(ModifyEvent e) {
			updateLaunchConfigurationDialog();
		}
	});

}
 
Example 4
Project: convertigo-eclipse   File: NewProjectWizardComposite2.java   Source Code and License Vote up 6 votes
/**
 * This method initializes this
 * 
 */
private void initialize() {
       GridData gridData2 = new org.eclipse.swt.layout.GridData();
       gridData2.horizontalSpan = 3;
       label1 = new Label(this, SWT.NONE);
       label1.setText("A connector establishes the connection between a data source and Convertigo.\nThe connector is used by Convertigo to collect the data that will be formatted as an XML document.\n\nYou will be able later on to add new connectors to your project.\n\nPlease choose a name for this connector.\n");
       label1.setLayoutData(gridData2);
       GridData gridData1 = new org.eclipse.swt.layout.GridData();
       gridData1.grabExcessHorizontalSpace = true;
       gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
       gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
       GridData gridData = new org.eclipse.swt.layout.GridData();
       gridData.grabExcessHorizontalSpace = false;
       gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
       gridData.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
       gridData.grabExcessVerticalSpace = false;
       label = new Label(this, SWT.NONE);
       label.setText("Connector name");
       label.setLayoutData(gridData);
       connectorName = new Text(this, SWT.BORDER);
       connectorName.setLayoutData(gridData1);
       connectorName.addModifyListener(modifyListener);
       GridLayout gridLayout = new GridLayout();
       gridLayout.numColumns = 2;
       this.setLayout(gridLayout);
}
 
Example 5
Project: orientdb-oda-birt   File: CustomDataSetWizardPage.java   Source Code and License Vote up 5 votes
/**
 * Creates custom control for user-defined query text.
 */
private Control createPageControl( Composite parent )
{
    Composite composite = new Composite( parent, SWT.NONE );
    composite.setLayout( new GridLayout( 1, false ) );
    GridData gridData = new GridData( GridData.HORIZONTAL_ALIGN_FILL
            | GridData.VERTICAL_ALIGN_FILL );

    composite.setLayoutData( gridData );

    Label fieldLabel = new Label( composite, SWT.NONE );
    fieldLabel.setText( "&Query Text:" );
    
    m_queryTextField = new Text( composite, SWT.BORDER
            | SWT.V_SCROLL | SWT.H_SCROLL );
    GridData data = new GridData( GridData.FILL_HORIZONTAL );
    data.heightHint = 100;
    m_queryTextField.setLayoutData( data );
    m_queryTextField.addModifyListener( new ModifyListener( ) 
    {
        public void modifyText( ModifyEvent e )
        {
            validateData();
        }
    } );
   
    setPageComplete( false );
    return composite;
}
 
Example 6
Project: Hydrograph   File: TransformDialog.java   Source Code and License Vote up 5 votes
private void attachModifyListenerToIdTextBox(
		final MappingSheetRow mappingSheetRow,Text operationIDTextBox) {
	operationIDTextBox.addModifyListener(new ModifyListener() {

		@Override
		public void modifyText(ModifyEvent e) {
			Text textBox = (Text) e.widget;

			ExpandItem expandItem = (ExpandItem) textBox.getData();

			expandItem.setText(textBox.getText());
			mappingSheetRow.setOperationID(textBox.getText());
		}
	});
}
 
Example 7
Project: eZooKeeper   File: ZnodeAclComposite.java   Source Code and License Vote up 5 votes
private void initIdTableEditor(TableItem item) {

        Control oldEditor = _IdTableEditor.getEditor();
        if (oldEditor != null) {
            oldEditor.dispose();
        }

        if (item == null) {
            return;
        }

        Table table = getTable();

        Text newEditor = new Text(table, SWT.SINGLE);

        newEditor.setText(item.getText(TABLE_COLUMN_ID));
        newEditor.addModifyListener(new ModifyListener() {

            @Override
            public void modifyText(ModifyEvent e) {
                Text editor = (Text) _IdTableEditor.getEditor();
                _IdTableEditor.getItem().setText(TABLE_COLUMN_ID, editor.getText());

                fireOrchestrationChange();
            }
        });

        _IdTableEditor.setEditor(newEditor, item, TABLE_COLUMN_ID);
    }
 
Example 8
Project: Hydrograph   File: OutputAdditionalParametersDialog.java   Source Code and License Vote up 5 votes
private void addModifyListener(Text text){
	text.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			Utils.INSTANCE.addMouseMoveListener(text, cursor);	
			
		}
	});
}
 
Example 9
Project: Hydrograph   File: FilterOperationClassUtility.java   Source Code and License Vote up 5 votes
private void addModifyListenerToFileNameTextBox(Text fileName) {
	fileName.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			Text classNameTextBox=(Text)e.widget;
			openBtn.setEnabled(StringUtils.isNotBlank(classNameTextBox.getText())&&!btnCheckButton.getSelection());
		}
	});
}
 
Example 10
Project: gw4e.project   File: MavenTemplatePage.java   Source Code and License Vote up 5 votes
private void createNameArea (Composite composite) {
	Label lblNewLabel = new Label(composite, SWT.NONE);
	lblNewLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
	lblNewLabel.setText(MessageUtil.getString("mvn_name"));
	textName = new Text(composite, SWT.BORDER);
	textName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 8, 1));
	textName.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent evt) {
			MavenTemplatePage.this.setName(textName.getText());
			validatePage();
		}
	});	
}
 
Example 11
Project: Hydrograph   File: FTPOperationConfigDialog.java   Source Code and License Vote up 5 votes
private void addModifyListener(Text text){
	if(text != null && !text.isDisposed()){
		text.addModifyListener(new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent e) {
				Utils.INSTANCE.addMouseMoveListener(text, cursor);	
			}
		});
	}
}
 
Example 12
Project: convertigo-eclipse   File: NewProjectWizardComposite3.java   Source Code and License Vote up 5 votes
/**
 * This method initializes this
 * 
 */
private void initialize() {
       GridData gridData2 = new org.eclipse.swt.layout.GridData();
       gridData2.horizontalSpan = 2;
       label1 = new Label(this, SWT.NONE);
       label1.setText("The chosen project template includes a ''screen type'' connector. \n\nThis connector needs a destination address as an hostname (or IP adress) and optionally a port.\n ");
       label1.setLayoutData(gridData2);
       GridData gridData1 = new org.eclipse.swt.layout.GridData();
       gridData1.grabExcessHorizontalSpace = true;
       gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
       gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
       GridData gridData = new org.eclipse.swt.layout.GridData();
       gridData.grabExcessHorizontalSpace = false;
       gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
       gridData.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
       gridData.grabExcessVerticalSpace = false;
       label = new Label(this, SWT.NONE);
       label.setText("Server address");
       label.setLayoutData(gridData);
       server = new Text(this, SWT.BORDER);
       server.setLayoutData(gridData1);
       label5 = new Label(this, SWT.NONE);
       label5.setText("Port");
       port = new Text(this, SWT.BORDER);
       server.addModifyListener(modifyListener);
       port.addModifyListener(modifyListener);
       GridLayout gridLayout = new GridLayout();
       gridLayout.numColumns = 2;
       this.setLayout(gridLayout);
}
 
Example 13
Project: gw4e.project   File: MavenTemplatePage.java   Source Code and License Vote up 5 votes
private void createVersionIdArea (Composite composite) {
	Label lblNewLabel = new Label(composite, SWT.NONE);
	lblNewLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
	lblNewLabel.setText(MessageUtil.getString("mvn_version_id"));
	textVersionID = new Text(composite, SWT.BORDER);
	textVersionID.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 8, 1));
	textVersionID.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent evt) {
			MavenTemplatePage.this.setVersion(textVersionID.getText());
			validatePage();
		}
	});		
	textVersionID.setText("1.0-SNAPSHOT");
}
 
Example 14
Project: OCCI-Studio   File: NewConfigurationWizard.java   Source Code and License Vote up 5 votes
@Override
protected WizardNewFileCreationPage createNewFilePage() {
	return new NewFilePage(getSelection(), fileExt) {
		@Override
		public void createControl(Composite parent) {
			super.createControl(parent);
			Composite area = (Composite) getControl();
			Composite container = new Composite(area, SWT.NONE);
			container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
			GridLayout layout = new GridLayout(2, false);
			container.setLayout(layout);
			Label lbtOcciServerUrl = new Label(container, SWT.NONE);
			lbtOcciServerUrl.setText(Messages.NewConfigurationWizard_OcciServerUrl);
			final Text txtOcciServerUrl = new Text(container, SWT.BORDER);
			txtOcciServerUrl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
			txtOcciServerUrl.addModifyListener(new ModifyListener() {
				public void modifyText(ModifyEvent e) {
					occiServerUrl = txtOcciServerUrl.getText();
					setPageComplete(validatePage());
				}
			});
		}

		@Override
		protected boolean validatePage() {
			// TODO add error messages
			return super.validatePage() && !Strings.isNullOrEmpty(occiServerUrl);
		}
	};
}
 
Example 15
Project: gw4e.project   File: GeneratorChoiceComposite.java   Source Code and License Vote up 5 votes
private void createNewMode() {
	btnCreateNewRadioButton = new Button(this, SWT.RADIO);
	btnCreateNewRadioButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
	btnCreateNewRadioButton.setText(MessageUtil.getString("standalone_mode"));
	btnCreateNewRadioButton.setSelection(false);
	btnCreateNewRadioButton.addListener(SWT.Selection, new Listener() {
		public void handleEvent(Event e) {
			switch (e.type) {
			case SWT.Selection:
				updateUI();
				break;
			}
		}
	});
	btnCreateNewRadioButton.setData(GW4E_CONVERSION_WIDGET_ID, GW4E_NEWCLASS_CHECKBOX);

	Composite composite = new Composite(this, SWT.NONE);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
	composite.setLayout(new GridLayout(12, false));

	lblNewClassnameLabel = new Label(composite, SWT.NONE);
	lblNewClassnameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
	lblNewClassnameLabel.setText("Class name");
	lblNewClassnameLabel.setEnabled(false);

	newClassnameText = new Text(composite, SWT.BORDER);
	newClassnameText.setEnabled(false);
	newClassnameText.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent event) {
			listener.handleEvent(null);
		}
	});
	newClassnameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 8, 1));
	newClassnameText.setEnabled(false);
	newClassnameText.setData(GW4E_CONVERSION_WIDGET_ID, GW4E_NEWCLASS_TEXT);
}
 
Example 16
Project: gemoc-studio-modeldebugging   File: LaunchConfigurationMainTab.java   Source Code and License Vote up 4 votes
/***
 * Create the Fields where user enters model to execute
 * 
 * @param parent container composite
 * @param font used font
 * @return the created composite containing the fields
 */
public Composite createModelLayout(Composite parent, Font font) {
	createTextLabelLayout(parent, "Model to execute");
	// Model location text
	_modelLocationText = new Text(parent, SWT.SINGLE | SWT.BORDER);
	_modelLocationText.setLayoutData(createStandardLayout());
	_modelLocationText.setFont(font);
	_modelLocationText.addModifyListener(fBasicModifyListener);
	Button modelLocationButton = createPushButton(parent, "Browse", null);
	modelLocationButton.addSelectionListener(new SelectionAdapter() {

		public void widgetSelected(SelectionEvent evt) {
			// handleModelLocationButtonSelected();
			// TODO launch the appropriate selector

			SelectAnyIFileDialog dialog = new SelectAnyIFileDialog();
			if (dialog.open() == Dialog.OK) {
				String modelPath = ((IResource) dialog.getResult()[0])
						.getFullPath().toPortableString();
				_modelLocationText.setText(modelPath);
				updateLaunchConfigurationDialog();
				_modelProject = ((IResource) dialog.getResult()[0]).getProject();
			}
		}
	});
	createTextLabelLayout(parent, "Model initialization method");
	_modelInitializationMethodText = new Text(parent, SWT.SINGLE | SWT.BORDER);
	_modelInitializationMethodText.setLayoutData(createStandardLayout());
	_modelInitializationMethodText.setFont(font);
	_modelInitializationMethodText.setEditable(false);
	createTextLabelLayout(parent, "");
	createTextLabelLayout(parent, "Model initialization arguments");
	_modelInitializationArgumentsText = new Text(parent, SWT.MULTI | SWT.BORDER |  SWT.WRAP | SWT.V_SCROLL);
	_modelInitializationArgumentsText.setToolTipText("one argument per line");
	GridData gridData = new GridData(GridData.FILL_BOTH);
	gridData.heightHint = 40;
	_modelInitializationArgumentsText.setLayoutData(gridData);
	//_modelInitializationArgumentsText.setLayoutData(createStandardLayout());
	_modelInitializationArgumentsText.setFont(font);
	_modelInitializationArgumentsText.setEditable(true);
	_modelInitializationArgumentsText.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			updateLaunchConfigurationDialog();
		}
	});
	createTextLabelLayout(parent, "");
	
	return parent;
}
 
Example 17
Project: convertigo-eclipse   File: ProjectDeployDialogComposite.java   Source Code and License Vote up 4 votes
/**
 * This method initializes this
 * 
 */
   @Override
protected void initialize() {
	GridLayout gridLayout = new GridLayout();
	gridLayout.numColumns = 2;
	this.setLayout(gridLayout);
	
       label = new Label(this, SWT.NONE);
       label.setText("Convertigo server");
       
       GridData gridData1 = new GridData();
       gridData1.horizontalSpan = 2;
       gridData1.horizontalAlignment = GridData.FILL;
       gridData1.grabExcessHorizontalSpace = true;
       convertigoServer = new Text(this, SWT.BORDER);
       convertigoServer.setLayoutData(gridData1);
       
       convertigoServer.addModifyListener(new ModifyListener() {
           public void modifyText(ModifyEvent e) {
           	changeOkButtonState();
           }
         });

       createList(); 
       createConvertigoGroup();
       createSSLGroup();
       
       GridData gridData3 = new GridData();
       gridData3.horizontalSpan = 2;
       gridData3.horizontalAlignment = GridData.FILL;
       gridData3.grabExcessHorizontalSpace = true;
       gridData3.verticalIndent = 15;
       assembleXsl = new Button(this, SWT.CHECK);
       assembleXsl.setText("Assemble xsl files included in stylesheets");
       assembleXsl.setLayoutData(gridData3);
       
       GridData gridData2 = new GridData();
	gridData2.horizontalSpan = 2;
	gridData2.verticalAlignment = GridData.CENTER;
	gridData2.horizontalAlignment = GridData.FILL;
	gridData2.grabExcessHorizontalSpace = true;
	gridData2.verticalIndent = 20;
       labelProgress = new Label(this, SWT.NONE);
       labelProgress.setText("Progression");
       labelProgress.setLayoutData(gridData2);
       
       GridData gridData4 = new GridData();
	gridData4.horizontalSpan = 2;
	gridData4.verticalAlignment = GridData.CENTER;
	gridData4.horizontalAlignment = GridData.FILL;
	gridData4.grabExcessHorizontalSpace = true;
       progressBar = new ProgressBar(this, SWT.NONE);
       progressBar.setLayoutData(gridData4);
       
       fillList();
}
 
Example 18
Project: convertigo-eclipse   File: ComponentInfoWizardPage.java   Source Code and License Vote up 4 votes
public void createControl(Composite parent) {
	container = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	container.setLayout(layout);
	layout.numColumns = 2;
	layout.verticalSpacing = 9;

	Label label = new Label(container, SWT.NULL);
	label.setText("&Name:");

	beanName = new Text(container, SWT.BORDER | SWT.SINGLE);
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	beanName.setLayoutData(gd);
	beanName.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e) {
			dialogChanged();
		}
	});
	
	if (parentObject instanceof CouchDbConnector || parentObject instanceof FullSyncConnector) {
		couchVariablesComposite = new CouchVariablesComposite(container, SWT.V_SCROLL);
		
		GridData couchVarData = new GridData(GridData.FILL_BOTH);
		couchVarData.horizontalSpan = 2;
		
		couchVariablesComposite.setLayoutData(couchVarData);
		
	} else {
		tree = new Tree(container, SWT.SINGLE | SWT.BORDER);
		tree.setHeaderVisible(false);
		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
		gridData.verticalSpan = 20;
		gridData.horizontalSpan = 2;
		tree.setLayoutData(gridData);		
		tree.addListener(SWT.Selection, new Listener() {
			public void handleEvent(final Event event) {
				TreeItem item = (TreeItem) event.item;
				treeItemName = item.getText();
				String suffix = getBeanName().endsWith(ScHandlerStatement.EVENT_ENTRY_HANDLER) ? 
						ScHandlerStatement.EVENT_ENTRY_HANDLER:
							getBeanName().endsWith(ScHandlerStatement.EVENT_EXIT_HANDLER) ?
									ScHandlerStatement.EVENT_EXIT_HANDLER : "";
				setBeanName("on"+ treeItemName + suffix);
				dialogChanged();
			}
		});
		tree.setVisible(false);
	}
	
	initialize();
	dialogChanged();
	setControl(container);
}
 
Example 19
Project: convertigo-eclipse   File: ObjectInfoWizardPage.java   Source Code and License Vote up 4 votes
public void createControl(Composite parent) {
	container = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	container.setLayout(layout);
	layout.numColumns = 2;
	layout.verticalSpacing = 9;

	Label label = new Label(container, SWT.NULL);
	label.setText("&Name:");

	beanName = new Text(container, SWT.BORDER | SWT.SINGLE);
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	beanName.setLayoutData(gd);
	beanName.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e) {
			dialogChanged();
		}
	});
	
	if (parentObject instanceof CouchDbConnector || parentObject instanceof FullSyncConnector) {
		couchVariablesComposite = new CouchVariablesComposite(container, SWT.V_SCROLL);
		
		GridData couchVarData = new GridData(GridData.FILL_BOTH);
		couchVarData.horizontalSpan = 2;
		
		couchVariablesComposite.setLayoutData(couchVarData);
		
	} else {
		tree = new Tree(container, SWT.SINGLE | SWT.BORDER);
		tree.setHeaderVisible(false);
		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
		gridData.verticalSpan = 20;
		gridData.horizontalSpan = 2;
		tree.setLayoutData(gridData);		
		tree.addListener(SWT.Selection, new Listener() {
			public void handleEvent(final Event event) {
				TreeItem item = (TreeItem) event.item;
				treeItemName = item.getText();
				String suffix = getBeanName().endsWith(ScHandlerStatement.EVENT_ENTRY_HANDLER) ? 
						ScHandlerStatement.EVENT_ENTRY_HANDLER:
							getBeanName().endsWith(ScHandlerStatement.EVENT_EXIT_HANDLER) ?
									ScHandlerStatement.EVENT_EXIT_HANDLER : "";
				setBeanName("on"+ treeItemName + suffix);
				dialogChanged();
			}
		});
		tree.setVisible(false);
	}
	
	initialize();
	dialogChanged();
	setControl(container);
}
 
Example 20
Project: Hydrograph   File: FTPOperationConfigDialog.java   Source Code and License Vote up 4 votes
private Control S3GetPutFile(Composite control){
	Composite composite = new Composite(control, SWT.BORDER);
	composite.setLayout(new GridLayout(3, false));
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
	
	FTPWidgetUtility ftpWidgetUtility = new FTPWidgetUtility();
	Label localLbl = (Label) ftpWidgetUtility.createLabel(composite, Messages.LOCAL_PATH);
	setPropertyHelpText(localLbl, "Used to provide local path");
	text1 = (Text) ftpWidgetUtility.createText(composite, "", SWT.BORDER);
	Button localPathBrwsBtn = new Button(composite, SWT.NONE);
	localPathBrwsBtn.setText("...");
	selectionListener(localPathBrwsBtn, text1);
	
	Label bucket = (Label) ftpWidgetUtility.createLabel(composite, Messages.S3_BUCKET);
	setPropertyHelpText(bucket, "Used to provide Bucket Value");
	text2 = (Text) ftpWidgetUtility.createText(composite, "", SWT.BORDER);
	new Button(composite, SWT.NONE).setVisible(false);
	
	Label filepathLbl = (Label) ftpWidgetUtility.createLabel(composite, Messages.S3_FILE_PATH);
	setPropertyHelpText(filepathLbl, "Used to provide File Path");
	text3 = (Text) ftpWidgetUtility.createText(composite, "", SWT.BORDER);
	new Button(composite, SWT.NONE).setVisible(false);
	
	Label regionLbl = (Label) ftpWidgetUtility.createLabel(composite, Messages.AWS_REGION);
	setPropertyHelpText(regionLbl, "Used to provide AWS Region");
	text4 = (Text) ftpWidgetUtility.createText(composite, "", SWT.BORDER);
	new Button(composite, SWT.NONE).setVisible(false);
	
	overWriteLabel = (Label) ftpWidgetUtility.createLabel(composite, Messages.WRITE_MODE);
	setPropertyHelpText(overWriteLabel, "Used to select OverWrite value");
	overwriteCombo = (Combo) ftpWidgetUtility.CreateCombo(composite, new String[]{Messages.OVERWRITE_IF_EXISTS, Messages.FAIL_IF_EXISTS});
	overWriteLabel.setEnabled(true);
	overwriteCombo.setEnabled(true);
	
	text1ControlDecoration = WidgetUtility.addDecorator(text1, Messages.EMPTYFIELDMESSAGE);
	text2ControlDecoration = WidgetUtility.addDecorator(text2, Messages.EMPTYFIELDMESSAGE);
	text4ControlDecoration = WidgetUtility.addDecorator(text4, Messages.EMPTYFIELDMESSAGE);
	
	FTPWidgetUtility widgetUtility = new FTPWidgetUtility();
	widgetUtility.validateEmptyWidgetText(text1, propertyDialogButtonBar, cursor, text1ControlDecoration);
	widgetUtility.validateEmptyWidgetText(text2, propertyDialogButtonBar, cursor, text2ControlDecoration);
	widgetUtility.validateEmptyWidgetText(text4, propertyDialogButtonBar, cursor, text4ControlDecoration);
	
	if(authenticationModeCombo.getSelectionIndex() != 1 || StringUtils
			.equalsIgnoreCase(authenticationModeCombo.getText(), Constants.PUT_FILE_S3)){
		text3ControlDecoration = WidgetUtility.addDecorator(text3, Messages.EMPTYFIELDMESSAGE);
		widgetUtility.validateEmptyWidgetText(text3, propertyDialogButtonBar, cursor, text3ControlDecoration);
	}
	
	text3.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent event) {
			if(authenticationModeCombo.getSelectionIndex() == 1){
				text3ControlDecoration.hide();
				text3.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 255, 255));
			}
		}
	});
	
	
	return composite;
}