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

The following are Jave code examples for showing how to use setEditable() 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: neoscada   File: FilterAdvancedComposite.java   Source Code and License Vote up 6 votes
private Text createAttributeText ( final String attribute )
{
    final Text t = new Text ( this, SWT.BORDER );
    final Fields field = Fields.byField ( attribute );
    if ( field == null )
    {
        t.setEditable ( true );
        t.setMessage ( Messages.custom_field );
    }
    else
    {
        t.setEditable ( false );
        t.setText ( field.getName () );
    }
    t.addKeyListener ( new KeyAdapter () {
        @Override
        public void keyReleased ( final KeyEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        };
    } );
    final RowData rowData = new RowData ();
    rowData.width = 132;
    t.setLayoutData ( rowData );
    return t;
}
 
Example 2
Project: Hydrograph   File: CustomizeNewClassWizardPage.java   Source Code and License Vote up 6 votes
@Override
protected void createContainerControls(Composite parent, int nColumns) {

	super.createContainerControls(parent, nColumns);
	Text text = (Text) parent.getChildren()[1];
	text.setEditable(false);
	IEditorInput editorInput = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
			.getActiveEditor().getEditorInput();
	if (editorInput instanceof IFileEditorInput) {
		IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput;
		IProject project = fileEditorInput.getFile().getProject();
		if (project != null) {
			IFolder srcFolder = project.getFolder("src/main/java");
			if (srcFolder != null && srcFolder.exists()) {
				text.setText(project.getName() + "/" + srcFolder.getProjectRelativePath().toString());
			}
		}
		Button button = (Button) parent.getChildren()[2];
		button.setEnabled(false);
	}
}
 
Example 3
Project: gemoc-studio-modeldebugging   File: LaunchConfigurationMainTab.java   Source Code and License Vote up 5 votes
/***
 * Create the Field where user enters the language used to execute
 * 
 * @param parent container composite
 * @param font used font
 * @return the created composite containing the fields
 */
public Composite createLanguageLayout(Composite parent, Font font) {
	// Language
	createTextLabelLayout(parent, "Melange languages");
	_languageCombo = new Combo(parent, SWT.NONE);
	_languageCombo.setLayoutData(createStandardLayout());

	List<String> languagesNames = MelangeHelper.getAllLanguages();
	String[] empty = {};
	_languageCombo.setItems(languagesNames.toArray(empty));
	_languageCombo.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			//String selection = _languageCombo.getText();
			//List<String> modelTypeNames = MelangeHelper.getModelTypes(selection);
			updateLaunchConfigurationDialog();
		}
	});
	createTextLabelLayout(parent, "");

	createTextLabelLayout(parent, "Melange resource adapter query");
	_melangeQueryText = new Text(parent, SWT.SINGLE | SWT.BORDER);
	_melangeQueryText.setLayoutData(createStandardLayout());
	_melangeQueryText.setFont(font);
	_melangeQueryText.setEditable(false);
	createTextLabelLayout(parent, "");
	
	return parent;
}
 
Example 4
Project: convertigo-eclipse   File: SummaryPage.java   Source Code and License Vote up 5 votes
public void createControl(Composite parent) {
	container = new Composite(parent, SWT.NONE);
	container.setLayout(new GridLayout(1, false));
	
	summaryText = new Text(container, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
	summaryText.setEditable(false);
	summaryText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	setControl(container);
	setPageComplete(false);
}
 
Example 5
Project: convertigo-eclipse   File: CicsConnectorComposite.java   Source Code and License Vote up 5 votes
protected void initialize() {
	GridData gridData = new org.eclipse.swt.layout.GridData();
	gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
	gridData.grabExcessHorizontalSpace = true;
	gridData.grabExcessVerticalSpace = true;
	gridData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
	cicsData = new Text(this, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
	cicsData.setEditable(false);
	cicsData.setBackground(new Color(null,253,253,244));
	cicsData.setFont(new Font(null,"Courier New",10,1));
	cicsData.setLayoutData(gridData);
	cicsData.setText("");
	this.setLayout(new GridLayout());
	setSize(new Point(300, 200));
}
 
Example 6
Project: gw4e.project   File: GraphModelPropertyPage.java   Source Code and License Vote up 5 votes
/**
 * Create the Text that will hold the Requirement coming from the graphml file
 * @param panel
 * @param file
 */
protected void createrequirementSection(Composite panel, IFile file) {
	Label label = createLabel(panel, MessageUtil.getString("Requirements")); //$NON-NLS-1$
	Text t = new Text(panel, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
	t.setData(GW4E_FILE_REQUIREMENT_TEXT_ID,GW4E_FILE_REQUIREMENT_TEXT_ID );
	Set<String> requirements = null;
	String reqMessage = "";
	try {
		requirements = GraphWalkerFacade.getRequirement(file);
		String newline = System.getProperty("line.separator");
		if (requirements == null || requirements.size() == 0) {
			reqMessage = MessageUtil.getString("NoRequirements");
		} else {
			StringBuffer sb = new StringBuffer();

			for (String req : requirements) {
				sb.append(req).append(newline);
			}
			t.setText(sb.toString());
			reqMessage = requirements.size() + " " + MessageUtil.getString("requirementsfound");
		}
	} catch (Exception e) {
		ResourceManager.logException(e);
		t.setText(e.getMessage());
	}
	t.setEditable(false);
	GridDataFactory.fillDefaults().grab(true, true).hint(150, 150).applyTo(t);

	createLabel(panel, MessageUtil.getString("requirementMessage")); //$NON-NLS-1$
	label = createLabel(panel, reqMessage);
	fillExcessHorizontalSpace(label);
}
 
Example 7
Project: gw4e.project   File: GraphModelPropertyPage.java   Source Code and License Vote up 5 votes
/**
 * Create the Text that will hold the Methods coming from the graphml file
 * 
 * @param panel
 * @param file
 */
protected void createMethodSection(Composite panel, IFile file) {
	Label label = createLabel(panel, MessageUtil.getString("Methods")); //$NON-NLS-1$
	Text t = new Text(panel, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
	t.setData(GraphModelPropertyPage.GW4E_FILE_METHODS_TEXT_ID, GW4E_FILE_METHODS_TEXT_ID);
	Set<String> methods = null;
	String reqMessage = "";
	try {
		methods = GraphWalkerFacade.getMethods(file);
		String newline = System.getProperty("line.separator");
		if (methods == null || methods.size() == 0) {
			reqMessage = MessageUtil.getString("NoMethods");
		} else {
			StringBuffer sb = new StringBuffer();

			for (String meth : methods) {
				sb.append(meth).append(newline);
			}
			t.setText(sb.toString());
			reqMessage = methods.size() + " " + MessageUtil.getString("methodsfound");
		}
	} catch (Exception e) {
		ResourceManager.logException(e);
		t.setText(e.getMessage());
	}
	t.setEditable(false);
	GridDataFactory.fillDefaults().grab(true, true).hint(150, 150).applyTo(t);

	createLabel(panel, MessageUtil.getString("methodMessage")); //$NON-NLS-1$
	label = createLabel(panel, reqMessage);
	fillExcessHorizontalSpace(label);
}
 
Example 8
Project: Hydrograph   File: TextGridRowBuilder.java   Source Code and License Vote up 5 votes
public Composite addHeader(){
	Composite composite = new Composite(container, SWT.NONE);
	GridLayout gl_composite = new GridLayout(textGridRow.getNumberOfColumn() + 1, false);
	gl_composite.horizontalSpacing = 7;
	gl_composite.marginWidth = 1;
	gl_composite.marginHeight = 0;
	gl_composite.verticalSpacing = 1;
	composite.setLayout(gl_composite);
		
	Button rowSelection = new Button(composite, SWT.CHECK);
	
	Map<Integer, TextGridColumnLayout> columns = textGridRow.getTextGridColumns();
	for(int columnNumber:columns.keySet()){
		Text text = new Text(composite, SWT.BORDER);
		if(!columns.get(columnNumber).grabHorizantalAccessSpace()){
			GridData gd_text = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
			gd_text.widthHint = columns.get(columnNumber).getColumnWidth();
			text.setLayoutData(gd_text);
			
			text.setEditable(false);
			text.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
			text.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_SELECTION));
		}else{
			text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
			text.setBounds(0, 0, 76, 21);
			text.setFocus();
			
			text.setEditable(false);
			text.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
			text.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_SELECTION));				
		}
		

		if(rowData!=null)
			text.setText(rowData.get(columnNumber));
	}
	
	return composite;
}
 
Example 9
Project: Hydrograph   File: TextGridRowBuilder.java   Source Code and License Vote up 5 votes
public Composite addRaw(){
	Composite composite = new Composite(container, SWT.NONE);
	GridLayout gl_composite = new GridLayout(textGridRow.getNumberOfColumn() + 1, false);
	gl_composite.horizontalSpacing = 7;
	gl_composite.marginWidth = 1;
	gl_composite.marginHeight = 0;
	gl_composite.verticalSpacing = 1;
	composite.setLayout(gl_composite);
		
	Button rowSelection = new Button(composite, SWT.CHECK);
	rowSelection.setEnabled(enabled);
	
	Map<Integer, TextGridColumnLayout> columns = textGridRow.getTextGridColumns();
	for(int columnNumber:columns.keySet()){
		Text text = new Text(composite, SWT.BORDER);
		if(!columns.get(columnNumber).grabHorizantalAccessSpace()){
			GridData gd_text = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
			gd_text.widthHint = columns.get(columnNumber).getColumnWidth();
			text.setLayoutData(gd_text);
			
			text.setEditable(columns.get(columnNumber).isEditable());
			text.setEnabled(columns.get(columnNumber).isEnabled());
		}else{
			text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
			text.setBounds(0, 0, 76, 21);
			text.setFocus();
			
			text.setEditable(columns.get(columnNumber).isEditable());
			text.setEnabled(columns.get(columnNumber).isEnabled());
		}
		
		if(rowData!=null)
			text.setText(rowData.get(columnNumber));
	}
	
	return composite;
}
 
Example 10
Project: Hydrograph   File: ELTSWTWidgets.java   Source Code and License Vote up 5 votes
public Text textBoxWidget(Composite parent, int style, int[] bounds,
		String text, boolean value) {
	Text textWidget = new Text(parent, style);
	textWidget.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
	textWidget.setText(text);
	textWidget.setEditable(value);

	return textWidget;
}
 
Example 11
Project: Hydrograph   File: ELTLookupConfigGrid.java   Source Code and License Vote up 5 votes
public Text textBoxWidget(Composite parent, int[] bounds, String textValue, boolean value) {
	Text text = new Text(parent, SWT.BORDER | SWT.READ_ONLY | SWT.LEFT);
	text.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
	text.setText(textValue);
	text.setEditable(value);

	return text;
}
 
Example 12
Project: Hydrograph   File: OperationComposite.java   Source Code and License Vote up 5 votes
private void createExpressionEditingTextBox(Composite composite_1) {
	Composite composite = new Composite(composite_1, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd_composite.heightHint = 29;
	composite.setLayoutData(gd_composite);

	logicTextBox = new Text(composite, SWT.BORDER);
	logicTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	logicTextBox.setEditable(false);
	logicTextBox.setText(operationDataStructure.getQualifiedOperationClassName());

	Button openEditorButton = new Button(composite, SWT.NONE);
	openEditorButton.setText("...");
	openEditorButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			ELTOperationClassDialog eltOperationClassDialog = new ELTOperationClassDialog(
					Display.getCurrent().getActiveShell(), dialog.getPropertyDialogButtonBar(),
					createDSForClassWindow(), dialog.getWidgetConfig(), dialog.getComponent().getComponentName());
			eltOperationClassDialog.open();
			updateOperationDS(eltOperationClassDialog);
			if (eltOperationClassDialog.isYesPressed()) {
				dialog.pressOK();
			} else if (eltOperationClassDialog.isNoPressed()) {
				dialog.pressCancel();
			}
			dialog.refreshErrorLogs();
		}

	});

}
 
Example 13
Project: Hydrograph   File: ExpressionComposite.java   Source Code and License Vote up 5 votes
private void createExpressionEditingTextBox(Composite composite_1) {
	Composite composite = new Composite(composite_1, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd_composite.heightHint = 29;
	composite.setLayoutData(gd_composite);

	logicTextBox = new Text(composite, SWT.BORDER);
	logicTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	logicTextBox.setEditable(false);
	logicTextBox.setText(expressionDataStructure.getExpressionEditorData().getExpression());

	Button openEditorButton = new Button(composite, SWT.NONE);
	openEditorButton.setText("...");
	openEditorButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			ExpressionEditorData expressionEditorData = expressionDataStructure.getExpressionEditorData();
			expressionEditorData.getSelectedInputFieldsForExpression().clear();
			expressionEditorData.getSelectedInputFieldsForExpression().putAll(FieldDataTypeMap.INSTANCE
					.createFieldDataTypeMap(expressionDataStructure.getInputFields(), dialog.getSchemaFields()));
			LaunchExpressionEditor launchExpressionEditor = new LaunchExpressionEditor();
			String oldExpression = expressionEditorData.getExpression();
			launchExpressionEditor.launchExpressionEditor(expressionEditorData, dialog.getSchemaFields(),
					dialog.getComponent().getComponentLabel().getLabelContents());
			if (!StringUtils.equals(expressionEditorData.getExpression(), oldExpression)) {
				dialog.getPropertyDialogButtonBar().enableApplyButton(true);
			}
			logicTextBox.setText(expressionEditorData.getExpression());
			dialog.refreshErrorLogs();
		}
	});

}
 
Example 14
Project: Hydrograph   File: DebugDataViewer.java   Source Code and License Vote up 5 votes
private void createPageNumberDisplay(Composite composite_3) {
	Text pageNumberDisplayTextBox = new Text(composite_3, SWT.BORDER | SWT.CENTER);
	pageNumberDisplayTextBox.setEnabled(false);
	pageNumberDisplayTextBox.setEditable(false);
	GridData gd_text = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd_text.widthHint = 178;
	pageNumberDisplayTextBox.setLayoutData(gd_text);

	windowControls.put(ControlConstants.PAGE_NUMBER_DISPLAY, pageNumberDisplayTextBox);
}
 
Example 15
Project: Hydrograph   File: DatasetInformationDialog.java   Source Code and License Vote up 5 votes
/**
 * Set the values of the dataset information window for the respective  labels
 * @param composite_2
 */
public void setLabelValue(Composite composite_2, String value) {
	Text textValue= new Text(composite_2, SWT.NONE |SWT.READ_ONLY);
	textValue.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
	textValue.setEditable(false);
	textValue.setText(value);
}
 
Example 16
Project: RefDiff   File: ProgressBarDialog.java   Source Code and License Vote up 5 votes
private Control createDialogArea(Composite shell) {
       GridLayout layout = new GridLayout();
	layout.numColumns = 1;
	shell.setLayout(layout);

	lblStep = new Label(shell, SWT.NONE);
	lblStep.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	lblStep.setText("Step 1 / 999");

	lblMessage = new Label(shell, SWT.NONE);
	lblMessage.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	lblMessage.setText("Idle");

	pbProg = new ProgressBar(shell, SWT.SMOOTH | SWT.INDETERMINATE);
	pbProg.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	pbProg.setMaximum(1000);
	pbProg.setSelection(0);
	pbProg.setSelection(256);

	final Label lblSeparator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
	lblSeparator.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	txtLog = new Text(shell, SWT.MULTI
	          | SWT.BORDER
	          | SWT.H_SCROLL
	          | SWT.V_SCROLL);
	txtLog.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
	txtLog.setEditable(false);
	txtLog.setBackground(new Color(shell.getDisplay(), 10,10,10));
	txtLog.setForeground(new Color(shell.getDisplay(), 200,200,200));

	shell.layout();

	return shell;
}
 
Example 17
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 18
Project: Hydrograph   File: XMLTextContainer.java   Source Code and License Vote up 4 votes
/**
 * Launches the component property editor window for Unknown components. It is used to display XML content of Unknown
 * components on property window.
 * 
 * @return XML content of component. 
 */

public String launchXMLTextContainerWindow() {
	try{
		String xmlText = this.xmlText;
		Shell shell = new Shell(Display.getDefault().getActiveShell(), SWT.WRAP | SWT.MAX | SWT.APPLICATION_MODAL);

		shell.setLayout(new GridLayout(1, false));
		shell.setText("XML Content");
		shell.setSize(439, 432);
		text = new Text(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
		text.setEditable(false);
		text.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 250, 250, 250));
		if (this.xmlText != null) {
			xmlText = xmlText.substring(xmlText.indexOf('\n') + 1);
			xmlText = xmlText.substring(xmlText.indexOf('\n') + 1, xmlText.lastIndexOf('\n') - 13);

			text.setText(xmlText);
		} else
			text.setText(Messages.EMPTY_XML_CONTENT);
		GridData gd_text = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
		gd_text.widthHint = 360;
		gd_text.heightHint = 360;
		text.setLayoutData(gd_text);

		Monitor primary = shell.getDisplay().getPrimaryMonitor();
		Rectangle bounds = primary.getBounds();
		Rectangle rect = shell.getBounds();

		int x = bounds.x + (bounds.width - rect.width) / 2;
		int y = bounds.y + (bounds.height - rect.height) / 2;

		shell.setLocation(x, y);
		shell.open();
		shell.layout();
		while (!shell.isDisposed()) {
			if (!shell.getDisplay().readAndDispatch()) {
				shell.getDisplay().sleep();
			}
		}
	}catch(Exception e)
	{
		LOGGER.error("Error occurred while creating XML text container widget", e);
	}
	return getXmlText();
}
 
Example 19
Project: scanning   File: ModelCellEditor.java   Source Code and License Vote up 3 votes
/**
    * Creates the controls used to show the value of this cell area.
    * <p>
    * The default implementation of this framework method creates
    * a label widget, using the same font and background color as the parent control.
    * </p>
    * <p>
    * Subclasses may reimplement.  If you reimplement this method, you
    * should also reimplement <code>updateContents</code>.
    * </p>
    *
    * @param cell the control for this cell area
    * @return the underlying control
    */
   protected Control createTextContents(Composite cell) {
Text txt = new Text(cell, SWT.LEFT);
txt.setFont(cell.getFont());
txt.setBackground(cell.getBackground());
txt.setEditable(false);
GridData gData = new GridData(SWT.FILL, SWT.FILL, true, true);
gData.widthHint = 100;
txt.setLayoutData(gData);
defaultLabel = txt;
       return txt;
   }