List of usage examples for org.eclipse.jface.fieldassist TextControlCreator TextControlCreator
TextControlCreator
From source file:com.ibm.research.tagging.core.ui.controls.ExpressionFilteredTable.java
License:Open Source License
protected Text createFilterTextControl(Composite parent, int style, Object layoutData) { // @tag expressionfilteredtable content-assist filtertable : originally wanted to make this generic, and have the proposal provider a field, but this method gets called by the super constructor, so passing the provider as a constructor parameter would result in "null" providers being passed here (the additional parameter gets processed AFTER super constructor) ContentAssistField contentAssistField = new ContentAssistField(parent, style, new TextControlCreator(), new TextContentAdapter(), new ExpressionProposalProvider(), null, null); contentAssistField.getContentAssistCommandAdapter().setPopupSize(new Point(200, 60)); contentAssistField.getLayoutControl().setLayoutData(layoutData); return (Text) contentAssistField.getControl(); }
From source file:com.ibm.research.tagging.core.ui.fieldassist.TagAssistField.java
License:Open Source License
public TagAssistField(Composite parent, int style, Object layoutData) { tagAssistField = new ContentAssistField(parent, style, new TextControlCreator(), new TextContentAdapter(), new TagContentProposalProvider(), null, null); Control layoutControl = tagAssistField.getLayoutControl(); layoutControl.setLayoutData(layoutData); }
From source file:com.nokia.tools.s60.views.SearchViewPage.java
License:Open Source License
public void createCompositeArea(Composite parent) { Composite dialogArea = parent; GridLayout gridLayout = new GridLayout(1, false); gridLayout.marginHeight = 0;//from w ww. java 2 s. c om gridLayout.marginWidth = 0; dialogArea.setLayout(gridLayout); fTypeMethodsSplitter = new SashForm(dialogArea, SWT.VERTICAL); fTypeMethodsSplitter.setLayoutData(new GridData(GridData.FILL_BOTH)); fTypeMethodsSplitter.setLayout(new GridLayout()); fTypeMethodsSplitter.setVisible(true); fTypeMethodsSplitter.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { SashForm splitter = (SashForm) e.widget; if (splitter.getOrientation() == SWT.HORIZONTAL) { int widthAll = fTypeMethodsSplitter.getSize().x; int patternMargin = ((GridLayout) c1.getLayout()).marginHeight; int spacing = ((GridLayout) c1.getLayout()).horizontalSpacing; if (widthAll > 0) { if (((patternHorizontalLayoutWidth + 4 * patternMargin + 2 * spacing)) <= widthAll) { horizontalSearchInput = (int) ((patternHorizontalLayoutWidth + 4 * patternMargin + 2 * spacing) * 100 / widthAll); } else { horizontalSearchInput = 100; } } else { horizontalSearchInput = 10; } fTypeMethodsSplitter .setWeights(new int[] { horizontalSearchInput, 100 - horizontalSearchInput }); } else if (splitter.getOrientation() == SWT.VERTICAL) { int heightAll = fTypeMethodsSplitter.getSize().y; int verticalSearchInputRatio = 0; if (heightAll > 0) { if (verticalSearchInput <= heightAll) { verticalSearchInputRatio = (verticalSearchInput * 100) / heightAll; } else { verticalSearchInputRatio = 100; } } else { verticalSearchInputRatio = 20; } fTypeMethodsSplitter .setWeights(new int[] { verticalSearchInputRatio, 100 - verticalSearchInputRatio }); } } }); c1 = new Composite(fTypeMethodsSplitter, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginHeight = 3; layout.verticalSpacing = 0; c1.setLayout(layout); c1.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite c2 = new Composite(fTypeMethodsSplitter, SWT.NONE); layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; c2.setLayout(layout); GridData data = new GridData(GridData.FILL_BOTH); data.grabExcessHorizontalSpace = true; data.grabExcessVerticalSpace = true; c2.setLayoutData(data); tableViewer = new TableViewer(c2, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL); items = tableViewer.getTable(); data = new GridData(GridData.FILL_BOTH); data.grabExcessHorizontalSpace = true; data.grabExcessVerticalSpace = true; data.horizontalAlignment = SWT.BEGINNING; data.horizontalAlignment = GridData.FILL; data.verticalAlignment = GridData.FILL; items.setLayoutData(data); // finds all component names in a system initSearchInput(); decoratedPattern = new DecoratedField(c1, SWT.BORDER, new TextControlCreator()); FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault(); FieldDecoration standardDecoration = registry .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); standardDecoration.setDescription("Press Ctrl+Space to see example search inputs and history"); decoratedPattern.addFieldDecoration(standardDecoration, SWT.TOP | SWT.LEFT, true); initSuggestionsAndHistory(); pattern = (Text) decoratedPattern.getControl(); pattern.setToolTipText("* = any string"); pattern.addFocusListener(new FocusAdapter() { // this is to ensure that after opening when user selects pattern // input can view all items public void focusGained(FocusEvent event) { initSearchInput(); tableViewer.setInput(filteredInput); if (tableViewer.getSelection() == null && tableViewer.getElementAt(0) != null) { tableViewer.setSelection(new StructuredSelection(tableViewer.getElementAt(0))); } } }); installContentProposalAdapter(pattern, new TextContentAdapter()); pattern.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { updateInput(); } }); pattern.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent event) { if (event.keyCode == SWT.ARROW_DOWN) { tableViewer.scrollDown(0, 1); tableViewer.getTable().setFocus(); } else if (event.keyCode == SWT.CR || event.keyCode == SWT.KEYPAD_CR) { addToSuggestionsAndHistory(pattern.getText()); updateInput(); } } }); FormData formData = (FormData) pattern.getLayoutData(); formData.width = patternVerticalLayoutWidth; searchButton = new Button(c1, SWT.PUSH); searchButton.setText("&Go to Element"); searchButton.setLayoutData(new GridData()); searchButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { initSearchInput(); IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection(); ElementTableItem selectedElement = (ElementTableItem) selection.getFirstElement(); if (null != selectedElement) selectAndFocusElement(selectedElement); } }); int heightAll = fTypeMethodsSplitter.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; int heightSearchButton = searchButton.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; int buttonMargin = ((GridLayout) c1.getLayout()).marginHeight; int spacing = ((GridLayout) c1.getLayout()).verticalSpacing; verticalSearchInput = (int) (heightSearchButton + 2 * buttonMargin + spacing); int verticalSearchInputRatio = (verticalSearchInput * 100) / heightAll; fTypeMethodsSplitter.setWeights(new int[] { verticalSearchInputRatio, 100 - verticalSearchInputRatio }); tableViewer.setSorter(new SearchTableSorter(SearchTableSorter.COLUMN_0)); items.setLinesVisible(true); items.setHeaderVisible(true); // 1st column TableColumn column = new TableColumn(items, SWT.CENTER, 0); column.setText("Name"); column.setWidth(200); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateSorter(SearchTableSorter.COLUMN_0, 0); } }); // 2nd column column = new TableColumn(items, SWT.LEFT, 1); column.setText("ID"); column.setWidth(180); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateSorter(SearchTableSorter.COLUMN_1, 1); } }); // 3rd column column = new TableColumn(items, SWT.LEFT, 2); column.setText("Info"); column.setWidth(100); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateSorter(SearchTableSorter.COLUMN_2, 2); } }); // 3rd column column = new TableColumn(items, SWT.LEFT, 3); column.setText("Resource path"); column.setWidth(200); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateSorter(SearchTableSorter.COLUMN_3, 3); } }); // 4th column column = new TableColumn(items, SWT.LEFT, 4); column.setText("Special editing"); column.setWidth(100); column.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateSorter(SearchTableSorter.COLUMN_4, 4); } }); items.setSortColumn(items.getColumn(0)); items.setSortDirection(SWT.UP); // 5th column /* * column = new TableColumn(items, SWT.LEFT, ); * column.setText("Skinned"); column.setWidth(60); * column.addSelectionListener(new SelectionAdapter() { public void * widgetSelected(SelectionEvent e) { tableViewer.setSorter(new * SearchTableSorter( SearchTableSorter.SKINNED)); } }); */ tableViewer.setLabelProvider(new SearchDataLabelProvider()); tableViewer.setContentProvider(new ArrayContentProvider() { @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { super.inputChanged(viewer, oldInput, newInput); } @Override public Object[] getElements(Object inputElement) { if (inputElement instanceof IDGroupContainer) { IDGroupContainer gc = (IDGroupContainer) inputElement; ArrayList<ElementTableItem> allAllowedItems = gc.getAllAllowedItems(); return allAllowedItems.toArray(); } return super.getElements(inputElement); } @Override public void dispose() { super.dispose(); } }); tableViewer.setInput(container); tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection(); if (previousSelection == null || selection.getFirstElement() != previousSelection.getFirstElement()) { previousSelection = selection; } // TableViewer viewer = (TableViewer)source; } }); if (tableViewer.getElementAt(0) != null) { tableViewer.setSelection(new StructuredSelection(tableViewer.getElementAt(0))); } tableViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); ElementTableItem selectedElement = (ElementTableItem) selection.getFirstElement(); if (null != selectedElement) selectAndFocusElement(selectedElement); } }); }
From source file:net.sourceforge.tagsea.core.ui.waypoints.TagEditDialog.java
License:Open Source License
/** * Creates a text area that can have content assist on it. * @param textComposite/*from w w w . j a va2 s .c o m*/ * @param border * @return */ private Text createTagText(Composite parent, int style) { ContentAssistField field = new ContentAssistField(parent, style, new TextControlCreator(), new TextContentAdapter(), new TagProposalProvider(parent), null, null); return (Text) field.getControl(); }
From source file:net.sourceforge.tagsea.resources.ui.TagEditorComposite.java
License:Open Source License
protected Text createFilterTextControl(Composite parent, int style, Object layoutData) { // @tag expressionfilteredtable content-assist filtertable tour.TourTest2.1194628865421.0 : originally wanted to make this generic, and have the proposal provider a field, but this method gets called by the super constructor, so passing the provider as a constructor parameter would result in "null" providers being passed here (the additional parameter gets processed AFTER super constructor) ContentAssistField contentAssistField = new ContentAssistField(parent, style, new TextControlCreator(), new TextContentAdapter(), new TagProposalProvider(parent), null, null); contentAssistField.getContentAssistCommandAdapter().setPopupSize(new Point(200, 60)); contentAssistField.getLayoutControl().setLayoutData(layoutData); return (Text) contentAssistField.getControl(); }
From source file:net.sourceforge.tagsea.resources.ui.TextComposite.java
License:Open Source License
protected Text createFilterTextControl(Composite parent, int style, Object layoutData) { // @tag expressionfilteredtable content-assist filtertable : originally wanted to make this generic, and have the proposal provider a field, but this method gets called by the super constructor, so passing the provider as a constructor parameter would result in "null" providers being passed here (the additional parameter gets processed AFTER super constructor) ContentAssistField contentAssistField = new ContentAssistField(parent, style, new TextControlCreator(), new TextContentAdapter(), new TagProposalProvider(parent), null, null); contentAssistField.getContentAssistCommandAdapter().setPopupSize(new Point(200, 60)); contentAssistField.getLayoutControl().setLayoutData(layoutData); return (Text) contentAssistField.getControl(); }
From source file:org.springframework.ide.eclipse.webflow.ui.graph.dialogs.ActionPropertiesDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite parentComposite = (Composite) super.createDialogArea(parent); Composite composite = new Composite(parentComposite, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 1;//from www . j ava 2 s . com composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); TabFolder folder = new TabFolder(composite, SWT.NULL); folder.setLayoutData(new GridData(GridData.FILL_BOTH)); TabItem item1 = new TabItem(folder, SWT.NULL); item1.setText("General"); item1.setImage(getImage()); TabItem item2 = new TabItem(folder, SWT.NULL); Group groupActionType = new Group(folder, SWT.NULL); GridLayout layoutAttMap = new GridLayout(); layoutAttMap.marginWidth = 3; layoutAttMap.marginHeight = 3; groupActionType.setLayout(layoutAttMap); if (WebflowModelXmlUtils.isVersion1Flow(action)) { groupActionType.setText(" Action "); } else { groupActionType.setText(" Render "); } GridData grid = new GridData(); groupActionType.setLayoutData(grid); Composite nameGroup = new Composite(groupActionType, SWT.NULL); nameGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout1 = new GridLayout(); layout1.numColumns = 3; layout1.marginWidth = 5; nameGroup.setLayout(layout1); nameLabel = new Label(nameGroup, SWT.NONE); if (WebflowModelXmlUtils.isVersion1Flow(action)) { nameLabel.setText("Name"); } else { nameLabel.setText("Fragments"); } nameText = new Text(nameGroup, SWT.SINGLE | SWT.BORDER); if (this.action != null && this.action.getName() != null) { this.nameText.setText(this.action.getName()); } nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); nameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); new Label(nameGroup, SWT.NONE); if (WebflowModelXmlUtils.isVersion1Flow(action)) { // Label field. beanLabel = new Label(nameGroup, SWT.NONE); beanLabel.setText("Bean"); GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gridData.widthHint = LABEL_WIDTH; beanLabel.setLayoutData(gridData); // Create a decorated field with a required field decoration. DecoratedField beanField = new DecoratedField(nameGroup, SWT.SINGLE | SWT.BORDER, new TextControlCreator()); FieldDecoration requiredFieldIndicator = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); beanField.addFieldDecoration(requiredFieldIndicator, SWT.TOP | SWT.LEFT, true); beanText = (Text) beanField.getControl(); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); beanField.getLayoutControl().setLayoutData(data); if (this.action != null && this.action.getBean() != null) { beanText.setText(this.action.getBean()); } beanText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (validator != null) { validator.validateInput(); } } }); DialogUtils.attachContentAssist(beanText, WebflowUtils.getBeansFromEditorInput().toArray()); browseBeanButton = new Button(nameGroup, SWT.PUSH); browseBeanButton.setText("..."); browseBeanButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); browseBeanButton.addSelectionListener(buttonListener); methodLabel = new Label(nameGroup, SWT.NONE); methodLabel.setText("Method"); // Create a decorated field with a required field decoration. DecoratedField methodField = new DecoratedField(nameGroup, SWT.SINGLE | SWT.BORDER, new TextControlCreator()); FieldDecoration requiredFieldIndicator1 = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); methodField.addFieldDecoration(requiredFieldIndicator1, SWT.TOP | SWT.LEFT, true); methodText = (Text) methodField.getControl(); data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); methodField.getLayoutControl().setLayoutData(data); if (this.action != null && this.action.getMethod() != null) { this.methodText.setText(this.action.getMethod()); } methodText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); DialogUtils.attachContentAssist(methodText, WebflowUtils.getActionMethods(this.actionClone.getNode()).toArray()); browseMethodButton = new Button(nameGroup, SWT.PUSH); browseMethodButton.setText("..."); browseMethodButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); browseMethodButton.addSelectionListener(buttonListener); } // add the indent after getting the decorated field GridData data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth(); nameText.setLayoutData(data); item1.setControl(groupActionType); properties = new PropertiesComposite(this, item2, getShell(), (IAttributeEnabled) this.actionClone); item2.setControl(properties.createDialogArea(folder)); applyDialogFont(parentComposite); return parentComposite; }
From source file:org.springframework.ide.eclipse.webflow.ui.graph.dialogs.BeanActionPropertiesDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite parentComposite = (Composite) super.createDialogArea(parent); Composite composite = new Composite(parentComposite, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 1;/*w w w .jav a 2s.c om*/ composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); TabFolder folder = new TabFolder(composite, SWT.NULL); folder.setLayoutData(new GridData(GridData.FILL_BOTH)); TabItem item1 = new TabItem(folder, SWT.NULL); item1.setText("General"); item1.setImage(getImage()); TabItem item2 = new TabItem(folder, SWT.NULL); Group groupActionType = new Group(folder, SWT.NULL); GridLayout layoutAttMap = new GridLayout(); layoutAttMap.marginWidth = 3; layoutAttMap.marginHeight = 3; groupActionType.setLayout(layoutAttMap); groupActionType.setText(" Action "); GridData grid = new GridData(); groupActionType.setLayoutData(grid); Composite nameGroup = new Composite(groupActionType, SWT.NULL); nameGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout1 = new GridLayout(); layout1.numColumns = 3; layout1.marginWidth = 5; nameGroup.setLayout(layout1); nameLabel = new Label(nameGroup, SWT.NONE); nameLabel.setText("Name"); nameText = new Text(nameGroup, SWT.SINGLE | SWT.BORDER); if (this.action != null && this.action.getName() != null) { this.nameText.setText(this.action.getName()); } nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); nameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); new Label(nameGroup, SWT.NONE); // Label field. beanLabel = new Label(nameGroup, SWT.NONE); beanLabel.setText("Bean"); GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gridData.widthHint = LABEL_WIDTH; beanLabel.setLayoutData(gridData); // Create a decorated field with a required field decoration. DecoratedField beanField = new DecoratedField(nameGroup, SWT.SINGLE | SWT.BORDER, new TextControlCreator()); FieldDecoration requiredFieldIndicator = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); beanField.addFieldDecoration(requiredFieldIndicator, SWT.TOP | SWT.LEFT, true); beanText = (Text) beanField.getControl(); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); beanField.getLayoutControl().setLayoutData(data); if (this.action != null && this.action.getBean() != null) { beanText.setText(this.action.getBean()); } beanText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (validator != null) { validator.validateInput(); } } }); DialogUtils.attachContentAssist(beanText, WebflowUtils.getBeansFromEditorInput().toArray()); browseBeanButton = new Button(nameGroup, SWT.PUSH); browseBeanButton.setText("..."); browseBeanButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); browseBeanButton.addSelectionListener(buttonListener); methodLabel = new Label(nameGroup, SWT.NONE); methodLabel.setText("Method"); // Create a decorated field with a required field decoration. DecoratedField methodField = new DecoratedField(nameGroup, SWT.SINGLE | SWT.BORDER, new TextControlCreator()); FieldDecoration requiredFieldIndicator1 = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); methodField.addFieldDecoration(requiredFieldIndicator1, SWT.TOP | SWT.LEFT, true); methodText = (Text) methodField.getControl(); data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); methodField.getLayoutControl().setLayoutData(data); if (this.action != null && this.action.getMethod() != null) { this.methodText.setText(this.action.getMethod()); } methodText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); DialogUtils.attachContentAssist(methodText, WebflowUtils.getActionMethods(this.actionClone.getNode()).toArray()); browseMethodButton = new Button(nameGroup, SWT.PUSH); browseMethodButton.setText("..."); browseMethodButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); browseMethodButton.addSelectionListener(buttonListener); // add the indent after getting the decorated field data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth(); nameText.setLayoutData(data); Group groupPropertyType = new Group(groupActionType, SWT.NULL); GridLayout layoutPropMap = new GridLayout(); layoutPropMap.marginWidth = 3; layoutPropMap.marginHeight = 3; groupPropertyType.setLayout(layoutPropMap); groupPropertyType.setText(" Method Arguments "); groupPropertyType.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite tableAndButtons = new Composite(groupPropertyType, SWT.NONE); tableAndButtons.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout2 = new GridLayout(); layout2.marginHeight = 0; layout2.marginWidth = 0; layout2.numColumns = 2; tableAndButtons.setLayout(layout2); Table configsTable = new Table(tableAndButtons, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); data = new GridData(GridData.FILL_BOTH); // data.widthHint = 250; data.heightHint = 70; configsTable.setLayoutData(data); TableColumn columnName = new TableColumn(configsTable, SWT.NONE); columnName.setText("Expression"); columnName.setWidth(150); TableColumn columnType = new TableColumn(configsTable, SWT.NONE); columnType.setText("Type"); columnType.setWidth(200); configsTable.setHeaderVisible(true); configsViewer = new TableViewer(configsTable); String[] columnNames = new String[] { "Expression", "Type" }; configsViewer.setColumnProperties(columnNames); configsViewer.setContentProvider(new MethodArgumentContentProvider(this.methodArguments, configsViewer)); configsViewer.setLabelProvider(new ModelTableLabelProvider()); configsViewer.setCellModifier(new TableCellModifier()); configsViewer.setInput(this.action); configsTable.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleTableSelectionChanged(); } }); Composite buttonArea = new Composite(tableAndButtons, SWT.NONE); GridLayout layout4 = new GridLayout(); layout4.marginHeight = 0; layout4.marginWidth = 0; buttonArea.setLayout(layout4); buttonArea.setLayoutData(new GridData(GridData.FILL_VERTICAL)); addButton = new Button(buttonArea, SWT.PUSH); addButton.setText("Add"); GridData data1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL); data1.widthHint = 40; addButton.setLayoutData(data1); addButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { IArgument property = new Argument(); property.createNew(actionClone); MethodArgumentEditorDialog dialog = new MethodArgumentEditorDialog(getParentShell(), property); if (dialog.open() == Dialog.OK) { methodArguments.add(property); configsViewer.refresh(true); } } }); editButton = new Button(buttonArea, SWT.PUSH); editButton.setText("Edit"); data1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL); data1.widthHint = 40; editButton.setLayoutData(data1); editButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = (IStructuredSelection) configsViewer.getSelection(); if (selection.getFirstElement() != null) { if (selection.getFirstElement() instanceof IArgument) { IArgument property = (IArgument) selection.getFirstElement(); MethodArgumentEditorDialog dialog = new MethodArgumentEditorDialog(getParentShell(), property); if (dialog.open() == Dialog.OK) { configsViewer.refresh(true); } } } } }); removeButton = new Button(buttonArea, SWT.PUSH); removeButton.setText("Delete"); GridData data2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL); data1.widthHint = 40; removeButton.setLayoutData(data2); removeButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = (IStructuredSelection) configsViewer.getSelection(); if (selection.getFirstElement() != null) { if (selection.getFirstElement() instanceof IArgument) { IArgument property = (IArgument) selection.getFirstElement(); methodArguments.remove(property); configsViewer.refresh(true); } } } }); removeButton.setEnabled(false); editButton.setEnabled(false); Group groupMethodResult = new Group(groupActionType, SWT.NULL); layoutAttMap = new GridLayout(); layoutAttMap.marginWidth = 3; layoutAttMap.marginHeight = 3; layoutAttMap.numColumns = 3; layoutAttMap.marginWidth = 5; groupMethodResult.setLayout(layoutAttMap); groupMethodResult.setText(" Method Result "); groupMethodResult.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); resultNameLabel = new Label(groupMethodResult, SWT.NONE); resultNameLabel.setText("Name"); resultNameText = new Text(groupMethodResult, SWT.SINGLE | SWT.BORDER); if (this.action != null && this.action.getMethodResult() != null) { this.resultNameText.setText(this.action.getMethodResult().getName()); } resultNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); resultNameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); new Label(groupMethodResult, SWT.NONE); // Label field. scopeLabel = new Label(groupMethodResult, SWT.NONE); scopeLabel.setText("Scope"); gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gridData.widthHint = LABEL_WIDTH; scopeLabel.setLayoutData(gridData); // Add the text box for action classname. scopeText = new Combo(groupMethodResult, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); scopeText.setItems(new String[] { "", "request", "flash", "flow", "conversation", "default" }); if (this.action != null && this.action.getMethodResult() != null && this.action.getMethodResult().getScope() != null) { scopeText.setText(this.action.getMethodResult().getScope()); } scopeText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); scopeText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validator.validateInput(); } }); new Label(groupMethodResult, SWT.NONE); item1.setControl(groupActionType); properties = new PropertiesComposite(this, item2, getShell(), (IAttributeEnabled) this.actionClone); item2.setControl(properties.createDialogArea(folder)); applyDialogFont(parentComposite); return parentComposite; }
From source file:org.springframework.ide.eclipse.webflow.ui.graph.dialogs.ExceptionHandlerPropertiesDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite parentComposite = (Composite) super.createDialogArea(parent); Composite composite = new Composite(parentComposite, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 1;// w w w . j a va 2 s .com composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite nameGroup = new Composite(composite, SWT.NULL); nameGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout1 = new GridLayout(); layout1.numColumns = 3; layout1.marginWidth = 5; nameGroup.setLayout(layout1); // Label field. beanLabel = new Label(nameGroup, SWT.NONE); beanLabel.setText("Bean"); GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gridData.widthHint = LABEL_WIDTH; beanLabel.setLayoutData(gridData); // Create a decorated field with a required field decoration. DecoratedField beanField = new DecoratedField(nameGroup, SWT.SINGLE | SWT.BORDER, new TextControlCreator()); FieldDecoration requiredFieldIndicator = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); beanField.addFieldDecoration(requiredFieldIndicator, SWT.TOP | SWT.LEFT, true); beanText = (Text) beanField.getControl(); GridData data = new GridData(GridData.FILL_HORIZONTAL); beanField.getLayoutControl().setLayoutData(data); if (this.action != null && this.action.getBean() != null) { beanText.setText(this.action.getBean()); } beanText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (validator != null) { validator.validateInput(); } } }); DialogUtils.attachContentAssist(beanText, WebflowUtils.getBeansFromEditorInput().toArray()); browseBeanButton = new Button(nameGroup, SWT.PUSH); browseBeanButton.setText("..."); browseBeanButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); browseBeanButton.addSelectionListener(buttonListener); applyDialogFont(parentComposite); return parentComposite; }
From source file:org.springframework.ide.eclipse.webflow.ui.graph.dialogs.SubFlowStatePropertiesDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite parentComposite = (Composite) super.createDialogArea(parent); Composite composite = new Composite(parentComposite, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 1;/* w w w . j a va2s .co m*/ composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); TabFolder folder = new TabFolder(composite, SWT.NULL); TabItem item1 = new TabItem(folder, SWT.NULL); item1.setText("General"); item1.setImage(getImage()); TabItem item2 = new TabItem(folder, SWT.NULL); TabItem item3 = new TabItem(folder, SWT.NULL); TabItem item4 = new TabItem(folder, SWT.NULL); TabItem item5 = new TabItem(folder, SWT.NULL); TabItem item6 = new TabItem(folder, SWT.NULL); Group groupActionType = new Group(folder, SWT.NULL); GridLayout layoutAttMap = new GridLayout(); layoutAttMap.marginWidth = 3; layoutAttMap.marginHeight = 3; groupActionType.setLayout(layoutAttMap); groupActionType.setText(" Subflow State "); GridData grid = new GridData(); groupActionType.setLayoutData(grid); Composite nameGroup = new Composite(groupActionType, SWT.NULL); nameGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout1 = new GridLayout(); layout1.numColumns = 3; layout1.marginWidth = 5; nameGroup.setLayout(layout1); nameLabel = new Label(nameGroup, SWT.NONE); nameLabel.setText("State id"); nameText = new Text(nameGroup, SWT.SINGLE | SWT.BORDER); if (this.state != null && this.state.getId() != null) { this.nameText.setText(this.state.getId()); } nameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); new Label(nameGroup, SWT.NONE); flowLabel = new Label(nameGroup, SWT.NONE); if (WebflowModelXmlUtils.isVersion1Flow(state)) { flowLabel.setText("Flow"); } else { flowLabel.setText("Subflow"); } // Create a decorated field with a required field decoration. DecoratedField flowField = new DecoratedField(nameGroup, SWT.SINGLE | SWT.BORDER, new TextControlCreator()); FieldDecoration requiredFieldIndicator = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); flowField.addFieldDecoration(requiredFieldIndicator, SWT.TOP | SWT.LEFT, true); flowText = (Text) flowField.getControl(); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); flowField.getLayoutControl().setLayoutData(data); if (this.state != null && this.state.getFlow() != null) { this.flowText.setText(this.state.getFlow()); } flowText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); // add the indent after getting the decorated field data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth(); nameText.setLayoutData(data); DialogUtils.attachContentAssist(flowText, WebflowUtils.getWebflowConfigNames()); browseFlowButton = new Button(nameGroup, SWT.PUSH); browseFlowButton.setText("..."); browseFlowButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); browseFlowButton.addSelectionListener(buttonListener); if (!WebflowModelXmlUtils.isVersion1Flow(state)) { parentLabel = new Label(nameGroup, SWT.NONE); parentLabel.setText("Parent state id"); parentText = new Text(nameGroup, SWT.SINGLE | SWT.BORDER); if (this.state != null && this.state.getParent() != null) { this.parentText.setText(this.state.getParent()); } parentText.setLayoutData(data); parentText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); new Label(nameGroup, SWT.NONE); } item1.setControl(groupActionType); // add attribute mapper item2.setText("Attribute Mapper"); item2.setImage(WebflowUIImages.getImage(WebflowUIImages.IMG_OBJS_ATTRIBUTE_MAPPER)); Composite attributeMapperGroup = new Composite(folder, SWT.NULL); attributeMapperGroup.setLayoutData(new GridData(GridData.FILL_BOTH)); layout1 = new GridLayout(); layout1.numColumns = 1; layout1.marginWidth = 0; layout1.marginHeight = 0; attributeMapperGroup.setLayout(layout1); Group attributeMapperType = new Group(attributeMapperGroup, SWT.NULL); layoutAttMap = new GridLayout(); layoutAttMap.marginWidth = 3; layoutAttMap.marginHeight = 3; attributeMapperType.setText(" Attribute Mapper "); attributeMapperType.setLayoutData(new GridData(GridData.FILL_BOTH)); attributeMapperType.setLayout(layoutAttMap); Composite attributeMapperTypeGroup = new Composite(attributeMapperType, SWT.NULL); attributeMapperTypeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); layout1 = new GridLayout(); layout1.numColumns = 3; layout1.marginWidth = 5; attributeMapperTypeGroup.setLayout(layout1); attributeMapperBeanLabel = new Label(attributeMapperTypeGroup, SWT.NONE); attributeMapperBeanLabel.setText("Bean"); // Create a decorated field with a required field decoration. DecoratedField beanField = new DecoratedField(attributeMapperTypeGroup, SWT.SINGLE | SWT.BORDER, new TextControlCreator()); FieldDecoration requiredFieldIndicator3 = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); beanField.addFieldDecoration(requiredFieldIndicator3, SWT.TOP | SWT.LEFT, true); attributeMapperBeanText = (Text) beanField.getControl(); data = new GridData(GridData.FILL_HORIZONTAL); beanField.getLayoutControl().setLayoutData(data); if (this.state != null && this.state.getAttributeMapper() != null && this.state.getAttributeMapper().getBean() != null) { this.attributeMapperBeanText.setText(this.state.getAttributeMapper().getBean()); } if (this.state != null && this.state.getSubflowAttributeMapper() != null) { this.attributeMapperBeanText.setText(this.state.getSubflowAttributeMapper()); } attributeMapperBeanText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); DialogUtils.attachContentAssist(attributeMapperBeanText, WebflowUtils.getBeansFromEditorInput().toArray()); browseBeanButton = new Button(attributeMapperTypeGroup, SWT.PUSH); browseBeanButton.setText("..."); browseBeanButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); browseBeanButton.addSelectionListener(buttonListener); TabFolder folder2 = new TabFolder(attributeMapperGroup, SWT.NULL); folder2.setLayoutData(new GridData(GridData.FILL_BOTH)); TabItem item21 = new TabItem(folder2, SWT.NULL); TabItem item22 = new TabItem(folder2, SWT.NULL); inputMapperComposite = new InputMapperComposite(this, item21, getShell(), this.inputAttributes, this.inputMapping, this.stateClone.getAttributeMapper().getInputMapper()); item21.setControl(inputMapperComposite.createDialogArea(folder2)); outputMapperComposite = new OutputMapperComposite(this, item22, getShell(), this.outputAttributes, this.outputMapping, this.stateClone.getAttributeMapper().getOutputMapper()); item22.setControl(outputMapperComposite.createDialogArea(folder2)); item2.setControl(attributeMapperGroup); entryActionsComposite = new ActionComposite(this, item3, getShell(), this.entryActions, this.stateClone.getEntryActions(), IActionElement.ACTION_TYPE.ENTRY_ACTION); item3.setControl(entryActionsComposite.createDialogArea(folder)); exitActionsComposite = new ActionComposite(this, item4, getShell(), this.exitActions, this.stateClone.getExitActions(), IActionElement.ACTION_TYPE.EXIT_ACTION); item4.setControl(exitActionsComposite.createDialogArea(folder)); exceptionHandlerComposite = new ExceptionHandlerComposite(this, item5, getShell(), this.exceptionHandler, this.stateClone); item5.setControl(exceptionHandlerComposite.createDialogArea(folder)); properties = new PropertiesComposite(this, item6, getShell(), (IAttributeEnabled) this.stateClone); item6.setControl(properties.createDialogArea(folder)); applyDialogFont(parentComposite); if (this.index >= 0) { folder.setSelection(this.index); } return parentComposite; }