private void createFilePreviewOptionsGroup(Composite parent) { Group theGroup = WidgetFactory.createGroup( parent, getString("filePreviewOptionsGroup"), SWT.NONE, 1, 5); // $NON-NLS-1$ theGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label numberLinesInFileLabel = new Label(theGroup, SWT.NONE); numberLinesInFileLabel.setText(getString("numberOfLinesLabel")); // $NON-NLS-1$ numberLinesInFileText = WidgetFactory.createTextField(theGroup, SWT.NONE); numberLinesInFileText.setEditable(false); numberLinesInFileText.setBackground( Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW)); GridData gd = new GridData(); gd.minimumWidth = 50; Label spacer = new Label(theGroup, SWT.NONE); spacer.setText(" "); // $NON-NLS-1$ Label prefixLabel = new Label(theGroup, SWT.NONE); prefixLabel.setText(getString("numberOfPreviewLines")); // $NON-NLS-1$ prefixLabel.setLayoutData(new GridData()); // new GridData(GridData.FILL_HORIZONTAL)); this.numberPreviewLinesText = WidgetFactory.createTextField(theGroup, SWT.NONE); gd = new GridData(); gd.minimumWidth = 50; this.numberPreviewLinesText.setLayoutData(gd); this.numberPreviewLinesText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent event) { if (!synchronizing) { if (!numberPreviewLinesText.getText().isEmpty()) { try { int nLines = Integer.parseInt(numberPreviewLinesText.getText()); if (nLines == 0) { setErrorMessage(getString("numberOfLinesCannotBeNullOrZero")); // $NON-NLS-1$ return; } if (nLines != dataFileInfo.getNumberOfCachedFileLines()) { dataFileInfo.setNumberOfCachedFileLines(nLines); handleInfoChanged(true); } setErrorMessage(null); } catch (NumberFormatException ex) { setErrorMessage( getString( "numberOfLinesMustBeInteger", numberPreviewLinesText.getText())); // $NON-NLS-1$ return; } } else { setErrorMessage(getString("numberOfLinesCannotBeNullOrZero")); // $NON-NLS-1$ return; } } } }); }
private void createControlsPanel(Composite theParent) { ScrolledComposite scroller = new ScrolledComposite(theParent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); GridLayout scrolledLayout = new GridLayout(); scrolledLayout.marginLeft = 5; scrolledLayout.marginRight = 5; scroller.setLayout(scrolledLayout); scroller.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); scroller.setExpandHorizontal(true); scroller.setExpandVertical(true); scroller.setMinWidth(900); scroller.setMinHeight(270); Group controlsGroup = WidgetFactory.createGroup(scroller, EDIT_TXT); GridLayout controlsLayout = new GridLayout(); controlsLayout.marginLeft = 0; controlsLayout.marginRight = 0; controlsGroup.setLayout(controlsLayout); controlsGroup.setLayoutData(new GridData(GridData.FILL_BOTH)); createResolveAttributePanel(controlsGroup); createResolveSqlPanel(controlsGroup); scroller.setContent(controlsGroup); }
private void createFileContentsGroup(Composite parent) { Group theGroup = WidgetFactory.createGroup( parent, getString("fileContentsGroup"), SWT.NONE, 1, 4); // $NON-NLS-1$ GridData groupGD = new GridData(GridData.FILL_BOTH); groupGD.heightHint = GROUP_HEIGHT_190; groupGD.widthHint = 400; theGroup.setLayoutData(groupGD); this.fileContentsViewer = new ListViewer(theGroup, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); GridData data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 4; this.fileContentsViewer.getControl().setFont(JFaceResources.getTextFont()); this.fileContentsViewer.getControl().setLayoutData(data); if (this.dataFileInfo != null) { for (String row : this.dataFileInfo.getCachedFirstLines()) { if (row != null) { this.fileContentsViewer.add(row); } } } // Add a Context Menu final MenuManager columnMenuManager = new MenuManager(); this.fileContentsViewer.getControl().setMenu(columnMenuManager.createContextMenu(parent)); }
@Override protected void createCustomContents(Composite parent) { GridData gd; Group group = WidgetFactory.createSimpleGroup( parent, UTIL.getString("Common.Properties.Label")); // $NON-NLS-1$; scrolled = new Composite(group, SWT.NONE); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; scrolled.setLayout(gridLayout); urlLabel = new Label(scrolled, SWT.NONE); urlLabel.setText(UTIL.getString("Common.URL.Label")); // $NON-NLS-1$ urlLabel.setToolTipText(UTIL.getString("Common.URL.ToolTip")); // $NON-NLS-1$ gd = new GridData(); gd.verticalAlignment = GridData.BEGINNING; urlLabel.setLayoutData(gd); urlText = new Text(scrolled, SWT.SINGLE | SWT.BORDER); urlText.setToolTipText(UTIL.getString("Common.URL.ToolTip")); // $NON-NLS-1$ gd = new GridData(); gd.horizontalAlignment = GridData.FILL; gd.verticalAlignment = GridData.BEGINNING; gd.grabExcessHorizontalSpace = true; gd.horizontalSpan = 1; urlText.setLayoutData(gd); initControls(); addlisteners(); }
/** Create the tableViewer Panel */ private void createTableViewerPanel(Composite theParent) { Composite tablePanel = new Composite(theParent, SWT.NONE); // Set the layout GridLayout gridLayout = new GridLayout(); tablePanel.setLayout(gridLayout); GridData gridData = new GridData(GridData.FILL_BOTH); tablePanel.setLayoutData(gridData); // Table Header Label WidgetFactory.createLabel( tablePanel, GridData.HORIZONTAL_ALIGN_BEGINNING, BINDINGS_TABLE_TITLE_TEXT); // Create the table createTable(tablePanel); // Create and setup the TableViewer tableViewer = new TableViewer(table); tableViewer.setUseHashlookup(true); tableViewer.setColumnProperties(columnNames); tableViewer.setContentProvider(new BindingContentProvider()); tableViewer.setLabelProvider(new BindingLabelProvider(true)); // The input for the table viewer is the instance of BindingList tableViewer.setInput(bindingList); updateRowColors(); }
/** * {@inheritDoc} * * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createDialogArea(Composite parent) { Composite composite = new Composite(parent, SWT.NULL); GridData compositeGridData = new GridData(GridData.FILL_HORIZONTAL); composite.setLayoutData(compositeGridData); GridLayout layout = new GridLayout(); layout.numColumns = 1; composite.setLayout(layout); // ----------------------------------------------- // Message Label // ----------------------------------------------- Label messageLabel = new Label(composite, SWT.NULL); messageLabel.setText(Messages.availableMedsDialogMsg); // ----------------------------------------------- // Table // ----------------------------------------------- Group tableGroup = WidgetFactory.createGroup(composite, Messages.availableMedsDialogTableLabel); tableGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); this.tableViewer = createTableViewer(tableGroup); return composite; }
/** * {@inheritDoc} * * @see * org.teiid.designer.ui.preferences.IGeneralPreferencePageContributor#createPreferenceEditor(org.eclipse.swt.widgets.Composite) */ @Override public void createPreferenceEditor(Composite theParent) { Composite pnl = new Composite(theParent, SWT.NONE); pnl.setLayout(new GridLayout()); pnl.setLayoutData(new GridData()); this.chkEnabled = WidgetFactory.createCheckBox(pnl, getName()); this.chkEnabled.setLayoutData(new GridData()); this.chkEnabled.setToolTipText(getToolTip()); // initialize state refresh(); }
@Override protected Control createDialogArea(Composite parent) { Composite pnlOuter = (Composite) super.createDialogArea(parent); Composite composite = new Composite(pnlOuter, SWT.NONE); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 1; composite.setLayout(gridLayout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); setTitle(UTIL.getString(PREFIX + "header")); // $NON-NLS-1$ Composite paramGroup = WidgetFactory.createGroup( composite, UTIL.getString(PREFIX + "inputParameters"), 0, 1, 3); // $NON-NLS-1$ paramGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); this.pnlParams = new PreviewParameterPanel(paramGroup, this.parameters); this.pnlParams.addChangeListener(this); return composite; }
@Override public void createControl(Composite parent) { creatingControl = true; // Create page final Composite mainPanel = new Composite(parent, SWT.NONE); mainPanel.setLayout(new GridLayout(1, false)); mainPanel.setLayoutData( new GridData()); // GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL)); mainPanel.setSize(mainPanel.computeSize(SWT.DEFAULT, SWT.DEFAULT)); setControl(mainPanel); // Create Bottom Composite Composite upperPanel = WidgetFactory.createPanel(mainPanel, SWT.NONE, GridData.FILL_HORIZONTAL, 2, 2); upperPanel.setLayout(new GridLayout(2, false)); setMessage(INITIAL_MESSAGE); Label selectedFileLabel = new Label(upperPanel, SWT.NONE); selectedFileLabel.setText(getString("selectedFile")); // $NON-NLS-1$ selectedFileText = new Text(upperPanel, SWT.BORDER); // , SWT.BORDER | SWT.SINGLE); selectedFileText.setBackground( Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW)); selectedFileText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE)); selectedFileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); selectedFileText.setEditable(false); createFilePreviewOptionsGroup(mainPanel); createColumnOptionsRadioGroup(mainPanel); createFileContentsGroup(mainPanel); creatingControl = false; setPageComplete(false); }
/** * Create the controls for creating a new relationships Model. * * @param parent the parent composite * @return the created composite */ private Composite createModelCreationComposite(Composite parent) { // Set up Composite Composite nameComposite = new Composite(parent, SWT.NONE); GridLayout nameCompositeLayout = new GridLayout(); nameComposite.setLayout(nameCompositeLayout); nameCompositeLayout.numColumns = 3; nameCompositeLayout.marginWidth = 0; GridData nameCompositeGridData = new GridData(GridData.FILL_HORIZONTAL); nameCompositeGridData.horizontalIndent = 20; nameComposite.setLayoutData(nameCompositeGridData); // Enter Model name label - col 1 Model Name Label lbModelName = new Label(nameComposite, SWT.NONE); lbModelName.setText(MODEL_NAME_LABEL); lbModelName.getAlignment(); // Model name entry field - col 2 txtModelName = WidgetFactory.createTextField(nameComposite, GridData.HORIZONTAL_ALIGN_FILL); GridData modelNameTextGridData = new GridData(); modelNameTextGridData.widthHint = MODEL_NAME_TEXT_WIDTH; txtModelName.setLayoutData(modelNameTextGridData); // listener for typing changes txtModelName.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent event) { handleSetModelName(); } }); // This initializes the status label handleSetModelName(); setCreateControlsEnabled(false); return nameComposite; }
/** * @param parent * @return composite the page * @since 4.0 */ @SuppressWarnings({"unused", "unchecked"}) Composite createPageControl(final Composite parent) { // Create page final Composite mainPanel = new Composite(parent, SWT.NONE); mainPanel.setLayout(new GridLayout(COLUMN_COUNT, false)); // Add widgets to page WidgetFactory.createLabel(mainPanel, FOLDER_LABEL); final String name = (this.folder == null ? null : this.folder.getFullPath().makeRelative().toString()); this.folderText = WidgetFactory.createTextField(mainPanel, GridData.FILL_HORIZONTAL, 1, name, SWT.READ_ONLY); this.folderText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent event) { folderModified(); } }); btnBrowse = WidgetFactory.createButton(mainPanel, BROWSE_BUTTON); btnBrowse.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent event) { browseButtonSelected(); } }); WidgetFactory.createLabel(mainPanel, NAME_LABEL); this.nameText = WidgetFactory.createTextField(mainPanel, GridData.HORIZONTAL_ALIGN_FILL, COLUMN_COUNT - 1); this.nameText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent event) { nameModified(); } }); // set focus to browse button if no folder selected. otherwise set focus to text field if (folder == null) { btnBrowse.setFocus(); } else { nameText.setFocus(); } DESCRIPTION_GROUP: { final Group descGroup = WidgetFactory.createGroup( mainPanel, getString("description"), GridData.FILL_HORIZONTAL, 3); // $NON-NLS-1$ descriptionTextEditor = new StyledTextEditor( descGroup, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.WRAP | SWT.BORDER); final GridData descGridData = new GridData(GridData.FILL_BOTH); descGridData.horizontalSpan = 1; descGridData.heightHint = 50; descGridData.minimumHeight = 30; descGridData.grabExcessVerticalSpace = true; descriptionTextEditor.setLayoutData(descGridData); descriptionTextEditor.setText(""); // $NON-NLS-1$ } MODELS_GROUP: { Group group = WidgetFactory.createGroup( mainPanel, getString("selectedModelsGroupTitle"), GridData.FILL_BOTH, COLUMN_COUNT, COLUMN_COUNT); //$NON-NLS-1$ group.setLayout(new GridLayout(2, false)); GridData gd = new GridData(GridData.FILL_BOTH); gd.heightHint = 200; gd.horizontalSpan = 3; group.setLayoutData(gd); Composite leftToolbarPanel = new Composite(group, SWT.NONE); leftToolbarPanel.setLayout(new GridLayout()); GridData ltpGD = new GridData(GridData.FILL_VERTICAL); ltpGD.heightHint = 120; leftToolbarPanel.setLayoutData(ltpGD); addModelsButton = new Button(leftToolbarPanel, SWT.PUSH); addModelsButton.setText(getString("add")); // $NON-NLS-1$ addModelsButton.setToolTipText(getString("addModelsTooltip")); // $NON-NLS-1$ addModelsButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); addModelsButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleAddModelsSelected(); if (!modelsViewer.getSelection().isEmpty()) { removeModelsButton.setEnabled(true); } } }); removeModelsButton = new Button(leftToolbarPanel, SWT.PUSH); removeModelsButton.setText(getString("remove")); // $NON-NLS-1$ removeModelsButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); removeModelsButton.setEnabled(false); removeModelsButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Collection<IResource> models = new ArrayList<IResource>(); IStructuredSelection selection = (IStructuredSelection) modelsViewer.getSelection(); for (Object obj : selection.toArray()) { if (obj instanceof IResource) { models.add((IResource) obj); } } removeModels(models); removeModelsButton.setEnabled(false); } }); this.modelsViewer = new TableViewer(group); GridData gdv = new GridData(GridData.FILL_BOTH); // gdv.horizontalSpan = COLUMN_COUNT; modelsViewer.getControl().setLayoutData(gdv); modelsViewer.setContentProvider(new ListContentProvider()); modelsViewer.setLabelProvider(new ModelExplorerLabelProvider()); // Add Models from properties if available if (this.designerProperties != null && !this.designerProperties.isEmpty()) { IFile sourceMdl = DesignerPropertiesUtil.getSourceModel(this.designerProperties); IFile viewMdl = DesignerPropertiesUtil.getViewModel(this.designerProperties); if (sourceMdl != null) this.modelsForVdb.add(sourceMdl); if (viewMdl != null) this.modelsForVdb.add(viewMdl); } else { this.modelsForVdb.addAll(SelectionUtilities.getSelectedIResourceObjects(initialSelection)); } modelsViewer.setInput(this.modelsForVdb); modelsViewer.addSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { removeModelsButton.setEnabled(!event.getSelection().isEmpty()); } }); } updateForProperties(); return mainPanel; }
private void createColumnOptionsRadioGroup(Composite parent) { Group theGroup = WidgetFactory.createGroup( parent, getString("columnsFormatGroup"), SWT.NONE, 1, 2); // $NON-NLS-1$ theGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // delimitedColumnsRB, fixedWidthColumnsRB; this.delimitedColumnsRB = WidgetFactory.createRadioButton(theGroup, getString("characterDelimited")); // $NON-NLS-1$ this.delimitedColumnsRB.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent event) { if (!synchronizing && !creatingControl) { if (event.getSource() == delimitedColumnsRB) { if (delimitedColumnsRB.getSelection() != dataFileInfo.doUseDelimitedColumns()) { dataFileInfo.setUseDelimitedColumns(delimitedColumnsRB.getSelection()); dataFileInfo.setFixedWidthColumns(!delimitedColumnsRB.getSelection()); if (dataFileInfo.getColumnInfoList().size() > 0) { boolean result = MessageDialog.openQuestion( getShell(), getString("formatChangedTitle"), // $NON-NLS-1$ getString("formateChangedMessage")); // $NON-NLS-1$ if (result) { dataFileInfo.clearColumns(); } } handleInfoChanged(false); } } } } }); this.fixedWidthColumnsRB = WidgetFactory.createRadioButton(theGroup, getString("fixedWidth")); // $NON-NLS-1$ this.fixedWidthColumnsRB.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent event) { if (!synchronizing && !creatingControl) { if (event.getSource() == fixedWidthColumnsRB) { if (fixedWidthColumnsRB.getSelection() != dataFileInfo.isFixedWidthColumns()) { dataFileInfo.setFixedWidthColumns(fixedWidthColumnsRB.getSelection()); dataFileInfo.setUseDelimitedColumns(!fixedWidthColumnsRB.getSelection()); if (dataFileInfo.getColumnInfoList().size() > 0) { boolean result = MessageDialog.openQuestion( getShell(), getString("formatChangedTitle"), // $NON-NLS-1$ getString("formateChangedMessage")); // $NON-NLS-1$ if (result) { dataFileInfo.clearColumns(); } } handleInfoChanged(false); } } } } }); this.delimitedColumnsRB.setSelection(true); }
/* * create the panel * @param parent the parent composite */ private void createPanel(Composite parent) { Composite panel = WidgetFactory.createGroup( parent, UTIL.getString("ExtraPropertiesPanel_groupTitle"), SWT.FILL, 2, 1); //$NON-NLS-1$ // GridDataFactory.swtDefaults().grab(true, true).applyTo(panel); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false); gd.horizontalSpan = 2; panel.setLayoutData(gd); propertiesViewer = new TableViewer(panel, (SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.BORDER)); ColumnViewerToolTipSupport.enableFor(propertiesViewer); propertiesViewer.setContentProvider( new IStructuredContentProvider() { /** * {@inheritDoc} * * @see org.eclipse.jface.viewers.IContentProvider#dispose() */ @Override public void dispose() { // nothing to do } /** * {@inheritDoc} * * @see * org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) */ @Override public Object[] getElements(Object inputElement) { Properties props = extraProperties; if (props.isEmpty()) { return new Object[0]; } List<SimpleProperty> properties = new ArrayList<SimpleProperty>(); for (Object key : props.keySet()) { String keyStr = (String) key; properties.add(new SimpleProperty(keyStr, (String) props.get(keyStr))); } return properties.toArray(new SimpleProperty[0]); } /** * {@inheritDoc} * * @see * org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, * java.lang.Object, java.lang.Object) */ @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // nothing to do } }); // sort the table rows by display name propertiesViewer.setComparator( new ViewerComparator() { /** * {@inheritDoc} * * @see * org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer, * java.lang.Object, java.lang.Object) */ @Override public int compare(Viewer viewer, Object e1, Object e2) { SimpleProperty prop1 = (SimpleProperty) e1; SimpleProperty prop2 = (SimpleProperty) e2; return super.compare(viewer, prop1.getName(), prop2.getName()); } }); Table table = propertiesViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); table.setLayout(new TableLayout()); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); ((GridData) table.getLayoutData()).horizontalSpan = 2; ((GridData) table.getLayoutData()).heightHint = table.getItemHeight() * 6; // create columns TableViewerColumn column = new TableViewerColumn(propertiesViewer, SWT.LEFT); column .getColumn() .setText( UTIL.getString("ExtraPropertiesPanel_name") + " "); //$NON-NLS-1$ //$NON-NLS-2$ column.setLabelProvider(new PropertyLabelProvider(0)); // column.setEditingSupport(new PropertyNameEditingSupport(propertiesViewer, 0)); column.getColumn().pack(); column = new TableViewerColumn(propertiesViewer, SWT.LEFT); column.getColumn().setText(UTIL.getString("ExtraPropertiesPanel_value")); // $NON-NLS-1$ column.setLabelProvider(new PropertyLabelProvider(1)); column.setEditingSupport(new PropertyNameEditingSupport(propertiesViewer, 1)); column.getColumn().pack(); propertiesViewer.addSelectionChangedListener( new ISelectionChangedListener() { /** * {@inheritDoc} * * @see * org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) */ @Override public void selectionChanged(SelectionChangedEvent event) { handlePropertySelected(); } }); // // add toolbar below the table // Composite toolbarPanel = WidgetFactory.createPanel(panel, SWT.NONE, GridData.VERTICAL_ALIGN_BEGINNING, 1, 2); this.addPropertyButton = WidgetFactory.createButton(toolbarPanel, GridData.FILL); this.addPropertyButton.setImage( DatatoolsUiPlugin.getDefault().getImage(Images.ADD_PROPERTY_ICON)); this.addPropertyButton.setToolTipText( UTIL.getString("HeaderPropertiesPanel_addNewPropertyButton_tooltip")); // $NON-NLS-1$ this.addPropertyButton.addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { handleAddProperty(); } @Override public void widgetDefaultSelected(SelectionEvent e) {} }); this.removePropertyButton = WidgetFactory.createButton(toolbarPanel, GridData.FILL); this.removePropertyButton.setImage( DatatoolsUiPlugin.getDefault().getImage(Images.REMOVE_PROPERTY_ICON)); this.removePropertyButton.setToolTipText( UTIL.getString("HeaderPropertiesPanel_removePropertyButton_tooltip")); // $NON-NLS-1$ this.removePropertyButton.addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { handleRemoveProperty(); } @Override public void widgetDefaultSelected(SelectionEvent e) {} }); this.removePropertyButton.setEnabled(false); propertiesViewer.setInput(this); }
@Override protected void createCustomContents(Composite parent) { GridData gd; Group group = WidgetFactory.createSimpleGroup( parent, UTIL.getString("Common.Properties.Label")); // $NON-NLS-1$; scrolled = new Composite(group, SWT.NONE); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; scrolled.setLayout(gridLayout); urlLabel = new Label(scrolled, SWT.NONE); urlLabel.setText(UTIL.getString("Common.URL.Label")); // $NON-NLS-1$ urlLabel.setToolTipText(UTIL.getString("Common.URL.ToolTip")); // $NON-NLS-1$ gd = new GridData(); gd.verticalAlignment = GridData.CENTER; urlLabel.setLayoutData(gd); urlText = new Text(scrolled, SWT.SINGLE | SWT.BORDER); urlText.setToolTipText(UTIL.getString("Common.URL.ToolTip")); // $NON-NLS-1$ gd = new GridData(); gd.horizontalAlignment = GridData.FILL; gd.verticalAlignment = GridData.BEGINNING; gd.grabExcessHorizontalSpace = true; gd.horizontalSpan = 1; urlText.setLayoutData(gd); securityLabel = new Label(scrolled, SWT.NONE); securityLabel.setText(UTIL.getString("Common.Security.Type.Label")); // $NON-NLS-1$ securityLabel.setToolTipText(UTIL.getString("Common.Security.Type.ToolTip")); // $NON-NLS-1$ gd = new GridData(); gd.verticalAlignment = GridData.CENTER; securityLabel.setLayoutData(gd); securityText = new Text(scrolled, SWT.SINGLE | SWT.BORDER); securityText.setToolTipText(UTIL.getString("Common.Security.Type.ToolTip")); // $NON-NLS-1$ gd = new GridData(); gd.horizontalAlignment = GridData.FILL; gd.verticalAlignment = GridData.BEGINNING; gd.grabExcessHorizontalSpace = true; gd.horizontalSpan = 1; securityText.setLayoutData(gd); usernameLabel = new Label(scrolled, SWT.NONE); usernameLabel.setText(UTIL.getString("Common.Username.Label")); // $NON-NLS-1$ usernameLabel.setToolTipText(UTIL.getString("Common.Username.ToolTip")); // $NON-NLS-1$ gd = new GridData(); gd.verticalAlignment = GridData.CENTER; usernameLabel.setLayoutData(gd); usernameText = new Text(scrolled, SWT.SINGLE | SWT.BORDER); usernameText.setToolTipText(UTIL.getString("Common.Username.ToolTip")); // $NON-NLS-1$ gd = new GridData(); gd.horizontalAlignment = GridData.FILL; gd.verticalAlignment = GridData.BEGINNING; gd.grabExcessHorizontalSpace = true; gd.horizontalSpan = 1; usernameText.setLayoutData(gd); passwordLabel = new Label(scrolled, SWT.NONE); passwordLabel.setText(UTIL.getString("Common.Password.Label")); // $NON-NLS-1$ passwordLabel.setToolTipText(UTIL.getString("Common.Password.ToolTip")); // $NON-NLS-1$ gd = new GridData(); gd.verticalAlignment = GridData.CENTER; passwordLabel.setLayoutData(gd); passwordText = new Text(scrolled, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD); passwordText.setToolTipText(UTIL.getString("Common.Password.ToolTip")); // $NON-NLS-1$ gd = new GridData(); gd.horizontalAlignment = GridData.FILL; gd.verticalAlignment = GridData.BEGINNING; gd.grabExcessHorizontalSpace = true; gd.horizontalSpan = 1; passwordText.setLayoutData(gd); urlPreviewLabel = new Label(scrolled, SWT.NONE); urlPreviewLabel.setText( UTIL.getString("WSProfileDetailsWizardPage.urlPreviewLabel")); // $NON-NLS-1$ gd = new GridData(); urlPreviewLabel.setLayoutData(gd); urlPreviewText = new Text(scrolled, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.READ_ONLY | SWT.V_SCROLL); gd = new GridData(GridData.FILL_HORIZONTAL); gd.grabExcessHorizontalSpace = true; gd.heightHint = 40; gd.horizontalSpan = 3; urlPreviewText.setLayoutData(gd); urlPreviewText.setBackground( Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW)); initControls(); TabFolder tabFolder = new TabFolder(scrolled, SWT.TOP | SWT.BORDER); tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); Composite parameterPanel = WidgetFactory.createPanel(tabFolder); this.parametersTab = new TabItem(tabFolder, SWT.FILL); this.parametersTab.setControl(parameterPanel); this.parametersTab.setText(UTIL.getString("ParametersPanel_groupTitle")); // $NON-NLS-1$ this.parameterPanel = new ParameterPanel(this, parameterPanel, parameterMap, 6); this.urlPreviewText.setText(updateUrlPreview().toString()); Composite headerPropertiesPanel = WidgetFactory.createPanel(tabFolder); this.headerPropertiesTab = new TabItem(tabFolder, SWT.FILL); this.headerPropertiesTab.setControl(headerPropertiesPanel); this.headerPropertiesTab.setText( UTIL.getString("HeaderPropertiesPanel_groupTitle")); // $NON-NLS-1$ new HeaderPropertiesPanel(headerPropertiesPanel, this.extraProperties, 6); addlisteners(); }
@SuppressWarnings("unused") private void init(Composite parent) { this.connectionInfoHelper = new ConnectionInfoHelper(); SOURCE_MODEL_INFO: { Group group = WidgetFactory.createGroup( parent, Messages.SourceModelDefinition, GridData.FILL_HORIZONTAL, 1); group.setLayout(new GridLayout(3, false)); Label locationLabel = new Label(group, SWT.NULL); locationLabel.setText(Messages.Location); this.sourceModelContainerText = new Text(group, SWT.BORDER | SWT.SINGLE); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); this.sourceModelContainerText.setLayoutData(gridData); WidgetUtil.colorizeWidget(this.sourceModelContainerText, WidgetUtil.TEXT_COLOR_BLUE, true); this.sourceModelContainerText.setEditable(false); Button browseButton = new Button(group, SWT.PUSH); gridData = new GridData(); browseButton.setLayoutData(gridData); browseButton.setText(Messages.BrowseElipsis); browseButton.setToolTipText( NLS.bind(Messages.BrowseToSelectModelsLocation, Messages.Source_lower)); browseButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleSourceModelLocationBrowse(); } }); Label fileLabel = new Label(group, SWT.NULL); fileLabel.setText(Messages.Name); fileLabel.setToolTipText(Messages.SourceNameTooltip); this.sourceModelFileText = new Text(group, SWT.BORDER | SWT.SINGLE); gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.widthHint = 200; this.sourceModelFileText.setLayoutData(gridData); this.sourceModelFileText.setToolTipText(Messages.SourceNameTooltip); WidgetUtil.colorizeWidget(this.sourceModelFileText, WidgetUtil.TEXT_COLOR_BLUE, false); this.sourceModelFileText.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { // Check view file name for existing if "location" is already // set handleSourceModelTextChanged(); } }); browseButton = new Button(group, SWT.PUSH); gridData = new GridData(); browseButton.setLayoutData(gridData); browseButton.setText(Messages.BrowseElipsis); browseButton.setToolTipText(NLS.bind(Messages.BrowseToSelect_0_Model, Messages.Source_lower)); browseButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleSourceModelBrowse(); } }); SOURCE_HELP: { Group helpGroup = WidgetFactory.createGroup(group, Messages.Status, SWT.NONE | SWT.BORDER_DASH, 3); helpGroup.setLayout(new GridLayout(1, false)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 3; helpGroup.setLayoutData(gd); sourceModelHelpText = new Text(helpGroup, SWT.WRAP | SWT.READ_ONLY); WidgetUtil.colorizeWidget(this.sourceModelHelpText, WidgetUtil.TEXT_COLOR_BLUE, true); gd = new GridData(GridData.FILL_BOTH); gd.heightHint = 40; gd.widthHint = 600; sourceModelHelpText.setLayoutData(gd); } } VIEW_MODEL_INFO: { Group group = WidgetFactory.createGroup( parent, Messages.ViewModelDefinition, GridData.FILL_HORIZONTAL, 1); group.setLayout(new GridLayout(3, false)); Label locationLabel = new Label(group, SWT.NULL); locationLabel.setText(Messages.Location); this.viewModelContainerText = new Text(group, SWT.BORDER | SWT.SINGLE); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); this.viewModelContainerText.setLayoutData(gridData); WidgetUtil.colorizeWidget(this.viewModelContainerText, WidgetUtil.TEXT_COLOR_BLUE, true); this.viewModelContainerText.setEditable(false); Button browseButton = new Button(group, SWT.PUSH); gridData = new GridData(); // buttonGridData.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END; browseButton.setLayoutData(gridData); browseButton.setText(Messages.BrowseElipsis); browseButton.setToolTipText( NLS.bind(Messages.BrowseToSelectModelsLocation, Messages.Source_lower)); browseButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleViewModelLocationBrowse(); } }); Label fileLabel = new Label(group, SWT.NULL); fileLabel.setText(Messages.Name); fileLabel.setToolTipText(Messages.ViewNameTooltip); this.viewModelFileText = new Text(group, SWT.BORDER | SWT.SINGLE); gridData = new GridData(GridData.FILL_HORIZONTAL); this.viewModelFileText.setLayoutData(gridData); this.viewModelFileText.setToolTipText(Messages.ViewNameTooltip); WidgetUtil.colorizeWidget(this.viewModelFileText, WidgetUtil.TEXT_COLOR_BLUE, false); this.viewModelFileText.setForeground(WidgetUtil.getDarkBlueColor()); this.viewModelFileText.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { // Check view file name for existing if "location" is already // set handleViewModelTextChanged(); } }); browseButton = new Button(group, SWT.PUSH); gridData = new GridData(); browseButton.setLayoutData(gridData); browseButton.setText(Messages.BrowseElipsis); browseButton.setToolTipText(NLS.bind(Messages.BrowseToSelect_0_Model, Messages.View_lower)); browseButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleViewModelBrowse(); } }); VIEW_HELP: { Group helpGroup = WidgetFactory.createGroup(group, Messages.Status, SWT.NONE | SWT.BORDER_DASH, 3); helpGroup.setLayout(new GridLayout(1, false)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 3; helpGroup.setLayoutData(gd); viewModelHelpText = new Text(helpGroup, SWT.WRAP | SWT.READ_ONLY); WidgetUtil.colorizeWidget(this.viewModelHelpText, WidgetUtil.TEXT_COLOR_BLUE, true); gd = new GridData(GridData.FILL_BOTH); gd.heightHint = 40; gd.widthHint = 600; viewModelHelpText.setLayoutData(gd); } } }
/* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createDialogArea(Composite theParent) { originalLanguageObjLabel = WidgetFactory.createLabel(theParent, CoreStringUtil.Constants.EMPTY_STRING); Composite pnlContents = (Composite) super.createDialogArea(theParent); // // main panel contents // CTabFolder tabFolder = WidgetFactory.createTabFolder(pnlContents); // // tabFolder contents - 2 tabs (Tree, SQL Text), each with a splitter // CTabItem treeTab = WidgetFactory.createTab(tabFolder, Util.getString(PREFIX + "treeTab")); // $NON-NLS-1$ treeTab.setToolTipText(Util.getString(PREFIX + "treeTab.tip")); // $NON-NLS-1$ SashForm treeTabSash = new SashForm(tabFolder, SWT.VERTICAL); treeTabSash.setLayoutData(new GridData(GridData.FILL_BOTH)); treeTab.setControl(treeTabSash); CTabItem sqlTab = WidgetFactory.createTab(tabFolder, Util.getString(PREFIX + "sqlTab")); // $NON-NLS-1$ sqlTab.setToolTipText(Util.getString(PREFIX + "sqlTab.tip")); // $NON-NLS-1$ SashForm sqlTabSash = new SashForm(tabFolder, SWT.VERTICAL); sqlTabSash.setLayoutData(new GridData(GridData.FILL_BOTH)); sqlTab.setControl(sqlTabSash); // // treeTab contents // ViewForm formTree = new ViewForm(treeTabSash, SWT.BORDER); Composite pnlTree = new Composite(formTree, SWT.NO_TRIM); formTree.setContent(pnlTree); GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; pnlTree.setLayout(layout); pnlTree.setLayoutData(new GridData(GridData.FILL_BOTH)); ViewForm formEditor = new ViewForm(treeTabSash, SWT.BORDER); pnlEditor = new Composite(formEditor, SWT.NO_TRIM); formEditor.setContent(pnlEditor); pnlEditor.setLayoutData(new GridData(GridData.FILL_BOTH)); lblTitle = new Label(formEditor, SWT.CENTER); lblTitle.setBackground(BuilderUtils.COLOR_HIGHLIGHT); formEditor.setTopLeft(lblTitle); treeTabSash.setWeights(new int[] {30, 70}); // // sqlTab contents // ViewForm formCurrentSql = new ViewForm(sqlTabSash, SWT.BORDER); ViewForm formOriginalSql = new ViewForm(sqlTabSash, SWT.BORDER); // // formCurrentSql contents // Composite pnlCurrentSql = new Composite(formCurrentSql, SWT.NONE); formCurrentSql.setContent(pnlCurrentSql); pnlCurrentSql.setLayout(new GridLayout()); pnlCurrentSql.setLayoutData(new GridData(GridData.FILL_BOTH)); currentSql = new SqlDisplayPanel(pnlCurrentSql); currentSql.setLayoutData(new GridData(GridData.FILL_BOTH)); CLabel lblCurrent = new CLabel(formCurrentSql, SWT.NONE); lblCurrent.setBackground(BuilderUtils.COLOR_HIGHLIGHT); lblCurrent.setText(Util.getString(PREFIX + "lblCurrent")); // $NON-NLS-1$ lblCurrent.setToolTipText(Util.getString(PREFIX + "lblCurrent.tip")); // $NON-NLS-1$ formCurrentSql.setTopLeft(lblCurrent); // // formOriginalSql contents // Composite pnlOriginalSql = new Composite(formOriginalSql, SWT.NONE); formOriginalSql.setContent(pnlOriginalSql); pnlOriginalSql.setLayout(new GridLayout()); pnlOriginalSql.setLayoutData(new GridData(GridData.FILL_BOTH)); originalSql = new SqlDisplayPanel(pnlOriginalSql); originalSql.setLayoutData(new GridData(GridData.FILL_BOTH)); CLabel lblOriginal = new CLabel(formOriginalSql, SWT.NONE); lblOriginal.setBackground(BuilderUtils.COLOR_HIGHLIGHT); lblOriginal.setText(Util.getString(PREFIX + "lblOriginal")); // $NON-NLS-1$ lblOriginal.setToolTipText(Util.getString(PREFIX + "lblOriginal.tip")); // $NON-NLS-1$ formOriginalSql.setTopLeft(lblOriginal); // // pnlTree contents - 2 columns (tree viewer, button panel) // layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 0; layout.marginWidth = 0; pnlTree.setLayout(layout); treeViewer = new LanguageObjectBuilderTreeViewer(pnlTree); treeViewer.addSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent theEvent) { handleTreeSelection(); } }); MenuManager menuMgr = new MenuManager(); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener( new IMenuListener() { @Override public void menuAboutToShow(IMenuManager theMenuMgr) { fillContextMenu(theMenuMgr); } }); treeViewer.getTree().setMenu(menuMgr.createContextMenu(treeViewer.getTree())); Composite pnlButtons = new Composite(pnlTree, SWT.NONE); pnlButtons.setLayout(new GridLayout()); createTreeButtons(pnlButtons); // // pnlEditor contents // layout = new GridLayout(); layout.numColumns = 2; pnlEditor.setLayout(layout); pnlEditorDetail = new Composite(pnlEditor, SWT.NONE); pnlEditorDetail.setLayoutData(new GridData(GridData.FILL_BOTH)); pnlEditorDetail.setLayout(new GridLayout()); return pnlContents; }
/** Create the Panel for resolving sql symbols */ private void createResolveSqlPanel(Composite parent) { Group newGroup = WidgetFactory.createGroup(parent, RESOLVE_SQL_GROUP_NAME); GridLayout gridLayout = new GridLayout(); newGroup.setLayout(gridLayout); gridLayout.numColumns = 3; gridLayout.marginHeight = 0; gridLayout.marginWidth = 0; gridLayout.marginLeft = 5; gridLayout.marginBottom = 5; GridData gridData = new GridData(GridData.FILL_HORIZONTAL); newGroup.setLayoutData(gridData); newGroup.setText(SQL_SYMBOL_TXT); // SQL Symbol Label // -------------------------------------- sqlSymbolLabel = WidgetFactory.createLabel(newGroup, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // $NON-NLS-1$ GridData gdSSL = new GridData( GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_FILL, false, false, 3, 1); sqlSymbolLabel.setLayoutData(gdSSL); sqlSymbolLabel.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLUE)); // Symbol RuntimeType Label // -------------------------------------- Label rtTypeLabel = WidgetFactory.createLabel(newGroup, RUNTIME_TYPE_TXT); GridData gdRT = new GridData( GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_FILL, false, false, 2, 1); rtTypeLabel.setLayoutData(gdRT); // WidgetFactory.createLabel(newGroup, ""); Binding binding = bindingList.get(0); Object symbol = binding.getCurrentSymbol(); String text = getLabelText(symbol); symbolRuntimeTypeLabel = WidgetFactory.createLabel( newGroup, text, GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.GRAB_HORIZONTAL); // Available Conversion Title Label // -------------------------------------- Label cvLabel = WidgetFactory.createLabel( newGroup, GridData.HORIZONTAL_ALIGN_BEGINNING, CONVERTED_SYMBOL_TXT); GridData gdCV = new GridData( GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_FILL, false, false, 2, 1); cvLabel.setLayoutData(gdCV); // Available Sql Conversion Text // -------------------------------------- String convertedSymbol = binding.getSqlConversionText(); int lossOfPrecIndex = convertedSymbol.indexOf('\n'); String warningText = CoreStringUtil.Constants.EMPTY_STRING; if (lossOfPrecIndex > -1) { warningText = convertedSymbol.substring(lossOfPrecIndex + 1, convertedSymbol.length()); convertedSymbol = convertedSymbol.substring(0, lossOfPrecIndex); } symbolConversionLabel = WidgetFactory.createLabel(newGroup, convertedSymbol, GridData.FILL_BOTH); symbolWarningLabel = WidgetFactory.createLabel(newGroup, warningText, GridData.FILL_BOTH); GridData gdWarning = new GridData( GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_FILL, false, false, 3, 1); symbolWarningLabel.setLayoutData(gdWarning); // Conversion Buttons Panel // -------------------------------------- // Create the changeSelectedSql Button this.convertSelectedSqlButton = WidgetFactory.createButton( newGroup, CONVERT_SELECTED_SQL_BUTTON, GridData.HORIZONTAL_ALIGN_BEGINNING); this.convertSelectedSqlButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent event) { convertSelectedSqlPressed(); } }); // Create the changeAllSql Button this.convertAllSqlButton = WidgetFactory.createButton( newGroup, CONVERT_ALL_SQL_BUTTON, GridData.HORIZONTAL_ALIGN_BEGINNING); this.convertAllSqlButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent event) { convertAllSqlPressed(); } }); sqlGroup = newGroup; }
/** This is a callback that will allow us to create the viewer and initialize it. */ @Override public void createPartControl(Composite parent) { FormToolkit toolkit = new FormToolkit(parent.getDisplay()); Composite frame = toolkit.createComposite(parent, SWT.BORDER); GridLayoutFactory.fillDefaults().numColumns(2).applyTo(frame); Composite comboDescFrame = toolkit.createComposite(frame, SWT.NONE); GridDataFactory.fillDefaults().applyTo(comboDescFrame); GridLayoutFactory.fillDefaults() .margins(5, 20) .spacing(SWT.DEFAULT, 25) .applyTo(comboDescFrame); Composite comboFrame = toolkit.createComposite(comboDescFrame, SWT.NONE); GridDataFactory.fillDefaults().applyTo(comboFrame); GridLayoutFactory.fillDefaults().applyTo(comboFrame); Composite labelFrame = toolkit.createComposite(comboFrame, SWT.NONE); GridDataFactory.fillDefaults().applyTo(labelFrame); GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(labelFrame); Label jbLabel = WidgetFactory.createLabel( labelFrame, UTIL.getString("TeiidServerOverviewSection.jbLabel")); // $NON-NLS-1$ jbLabel.setForeground(labelFrame.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE)); GridDataFactory.swtDefaults().grab(false, false).applyTo(jbLabel); newServerOrOpenServerViewHyperlink = toolkit.createHyperlink(labelFrame, EDIT_SERVER_LABEL, SWT.NONE); GridDataFactory.swtDefaults().applyTo(newServerOrOpenServerViewHyperlink); newServerOrOpenServerViewHyperlink.addHyperlinkListener( new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { if (serverMap.isEmpty()) { // There are no servers so open the server wizard NewServerAction action = new NewServerAction(getViewSite().getShell(), getServerManager()); action.run(); } else { // open the servers view IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); try { window .getActivePage() .showView("org.eclipse.wst.server.ui.ServersView"); // $NON-NLS-1$ } catch (PartInitException ex) { UTIL.log(ex); } } } }); jbossServerCombo = new Combo(comboFrame, SWT.READ_ONLY | SWT.DROP_DOWN); toolkit.adapt(jbossServerCombo); GridDataFactory.swtDefaults().minSize(250, 30).grab(true, false).applyTo(jbossServerCombo); jbossServerCombo.addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { handleServerComboSelection(); } @Override public void widgetDefaultSelected(SelectionEvent e) { handleServerComboSelection(); } }); Text descriptionText = toolkit.createText( comboDescFrame, UTIL.getString("TeiidServerOverviewSection.description"), // $NON-NLS-1$ SWT.MULTI | SWT.WRAP); descriptionText.setForeground(comboDescFrame.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE)); GridDataFactory.fillDefaults() .grab(false, true) .hint(100, SWT.DEFAULT) .applyTo(descriptionText); super.createPartControl(frame); viewer = getCommonViewer(); GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getControl()); viewer.setSorter(new NameSorter()); DqpPlugin.getInstance().getServersProvider().addServerLifecycleListener(serversListener); // Populate the jboss server combo box which // should also populate the viewer as well populateJBossServerCombo(); viewer.expandToLevel(3); }
@SuppressWarnings("unused") @Override protected Control createDialogArea(Composite parent) { creatingContents = true; if (isEdit) { setTitle(EDIT_TITLE); } else { setTitle(CREATE_TITLE); } Composite dialogComposite = (Composite) super.createDialogArea(parent); Composite composite = WidgetFactory.createPanel(dialogComposite); // ------------------------------ // Set layout for the Composite // ------------------------------ GridLayout gridLayout = new GridLayout(); composite.setLayout(gridLayout); gridLayout.numColumns = 2; GridData gridData = new GridData(GridData.FILL_BOTH); gridData.grabExcessHorizontalSpace = true; gridData.widthHint = 500; composite.setLayoutData(gridData); Label label = new Label(composite, SWT.NONE | SWT.RIGHT); label.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.NAME)); label.setLayoutData(new GridData()); final Text indexNameText = new Text(composite, SWT.BORDER | SWT.SINGLE); indexNameText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE)); indexNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); indexNameText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent event) { String value = indexNameText.getText(); if (value == null) { value = EMPTY_STRING; } editedIndex.setName(value); validate(); } }); label = new Label(composite, SWT.NONE | SWT.RIGHT); label.setText(Messages.nameInSourceLabel); label.setLayoutData(new GridData()); final Text indexNISText = new Text(composite, SWT.BORDER | SWT.SINGLE); indexNISText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE)); indexNISText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); indexNISText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent event) { String value = indexNISText.getText(); if (value == null) { value = EMPTY_STRING; } editedIndex.setNameInSource(value); validate(); } }); // Group to present properties widgets PROPERTIES_GROUP: { this.autoUpdateCB = new Button(composite, SWT.CHECK | SWT.RIGHT); this.autoUpdateCB.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); this.autoUpdateCB.setText(Messages.autoUpdateLabel); this.autoUpdateCB.addSelectionListener( new SelectionAdapter() { /** * {@inheritDoc} * * @see * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { editedIndex.setAutoUpdate(autoUpdateCB.getSelection()); validate(); } }); new Label(composite, SWT.NONE); this.nullableCB = new Button(composite, SWT.CHECK | SWT.RIGHT); this.nullableCB.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); this.nullableCB.setText(Messages.nullableLabel); this.nullableCB.addSelectionListener( new SelectionAdapter() { /** * {@inheritDoc} * * @see * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { editedIndex.setNullable(nullableCB.getSelection()); validate(); } }); new Label(composite, SWT.NONE); this.uniqueCB = new Button(composite, SWT.CHECK | SWT.RIGHT); this.uniqueCB.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); this.uniqueCB.setText(Messages.uniqueLabel); this.uniqueCB.addSelectionListener( new SelectionAdapter() { /** * {@inheritDoc} * * @see * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { editedIndex.setUnique(uniqueCB.getSelection()); validate(); } }); new Label(composite, SWT.NONE); label = new Label(composite, SWT.NONE | SWT.RIGHT); label.setText(Messages.filterConditionLabel); label.setLayoutData(new GridData()); filterConditionText = new Text(composite, SWT.BORDER | SWT.SINGLE); filterConditionText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE)); filterConditionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); filterConditionText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent event) { String value = filterConditionText.getText(); if (value == null) { value = EMPTY_STRING; } editedIndex.setFilterCondition(value); validate(); } }); } Group theColumnsGroup = WidgetFactory.createGroup( dialogComposite, Messages.selectColumnReferencesForIndex, SWT.NONE, 1, 1); theColumnsGroup.setLayout(new GridLayout(1, false)); GridData gd = new GridData(GridData.FILL_BOTH); gd.heightHint = 120; gd.widthHint = 500; theColumnsGroup.setLayoutData(gd); Table tableWidget = new Table( theColumnsGroup, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.CHECK); tableWidget.setHeaderVisible(false); tableWidget.setLinesVisible(true); tableWidget.setLayout(new TableLayout()); tableWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); theColumnDataViewer = new TableViewer(tableWidget); gd = new GridData(GridData.FILL_BOTH); gd.heightHint = 160; gd.horizontalSpan = 2; theColumnDataViewer.getControl().setLayoutData(gd); theColumnDataViewer.setContentProvider( new ITreeContentProvider() { @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // TODO Auto-generated method stub } @Override public void dispose() { // TODO Auto-generated method stub } @Override public boolean hasChildren(Object element) { return !theTable.getColumns().isEmpty(); } @Override public Object getParent(Object element) { return null; } @Override public Object[] getElements(Object inputElement) { if (inputElement instanceof RelationalTable) { return theTable.getColumns().toArray(new Object[0]); } return new Object[0]; } @Override public Object[] getChildren(Object parentElement) { // TODO Auto-generated method stub return new Object[0]; } }); this.theColumnDataViewer .getTable() .addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { editedIndex.getColumns().clear(); for (TableItem item : theColumnDataViewer.getTable().getItems()) { if (item.getChecked()) { editedIndex.addColumn((RelationalColumn) item.getData()); } } validate(); } @Override public void widgetDefaultSelected(SelectionEvent e) {} }); theColumnDataViewer.setLabelProvider(new ColumnDataLabelProvider(0)); theColumnDataViewer.setInput(this.theTable); for (RelationalColumn col : this.editedIndex.getColumns()) { for (TableItem item : theColumnDataViewer.getTable().getItems()) { if (item.getData() == col) { item.setChecked(true); } } } DESCRIPTION_GROUP: { final Group descGroup = WidgetFactory.createGroup( dialogComposite, UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.DESCRIPTION), GridData.FILL_BOTH, 3); descriptionTextEditor = new StyledTextEditor( descGroup, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.WRAP | SWT.BORDER); final GridData descGridData = new GridData(GridData.FILL_BOTH); descGridData.horizontalSpan = 1; descGridData.heightHint = 120; // descGridData.minimumHeight = 30; descGridData.grabExcessVerticalSpace = true; descriptionTextEditor.setLayoutData(descGridData); descriptionTextEditor.setText(""); // $NON-NLS-1$ descriptionTextEditor .getTextWidget() .addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { editedIndex.setDescription(descriptionTextEditor.getText()); } }); } setMessage(Messages.newIndexMessage); if (editedIndex.getName() != null) { indexNameText.setText(editedIndex.getName()); } if (editedIndex.getNameInSource() != null) { indexNISText.setText(editedIndex.getNameInSource()); } this.autoUpdateCB.setSelection(editedIndex.isAutoUpdate()); this.nullableCB.setSelection(editedIndex.isNullable()); this.uniqueCB.setSelection(editedIndex.isUnique()); if (editedIndex.getFilterCondition() != null) { filterConditionText.setText(editedIndex.getFilterCondition()); } if (editedIndex.getDescription() != null) { descriptionTextEditor.setText(editedIndex.getDescription()); } creatingContents = false; return composite; }
private void createResolveAttributePanel(Composite parent) { if (this.targetLocked) { attrGroup = WidgetFactory.createGroup(parent, RESOLVE_ATTR_GROUP_LOCKED_NAME); } else { attrGroup = WidgetFactory.createGroup(parent, RESOLVE_ATTR_GROUP_NAME); } GridLayout gridLayout = new GridLayout(); attrGroup.setLayout(gridLayout); gridLayout.numColumns = 4; gridLayout.marginHeight = 0; gridLayout.marginWidth = 0; gridLayout.marginLeft = 5; gridLayout.marginBottom = 5; GridData gridData = new GridData(GridData.FILL_HORIZONTAL); attrGroup.setLayoutData(gridData); Binding binding = bindingList.get(0); Object attr = binding.getAttribute(); // Attribute Datatype Label EObject datatype = null; attr = binding.getAttribute(); if (TransformationHelper.isSqlColumn(attr)) { datatype = TransformationHelper.getSqlColumnDatatype((EObject) attr); } String datatypeText = getDatatypeText(datatype); Image datatypeImage = getDatatypeImage(datatype); attrGroup.setText(VIRTUAL_TARGET_ATTRIBUTE_TXT); // -------------------------------------- // SQL Symbol Label // -------------------------------------- attributeLabel = WidgetFactory.createLabel(attrGroup, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // $NON-NLS-1$ GridData attrGD = new GridData( GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_FILL, false, false, 4, 1); attributeLabel.setLayoutData(attrGD); attributeLabel.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLUE)); Label rtTypeLabel = WidgetFactory.createLabel(attrGroup, RUNTIME_TYPE_TXT); GridData gdRT = new GridData( GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 2, 1); rtTypeLabel.setLayoutData(gdRT); WidgetFactory.createLabel(attrGroup, CoreStringUtil.Constants.EMPTY_STRING); // -------------------------------------- // Attribute RuntimeType Label // -------------------------------------- attrRuntimeTypeLabel = WidgetFactory.createLabel( attrGroup, datatypeText, datatypeImage, GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.GRAB_HORIZONTAL); // -------------------------------------- // Attribute Type Chooser Panel // -------------------------------------- // Create the changeSelectedAttribute Button this.convertSelectedAttrButton = WidgetFactory.createButton( attrGroup, CONVERT_SELECTED_ATTR_BUTTON, GridData.HORIZONTAL_ALIGN_BEGINNING); this.convertSelectedAttrButton.setEnabled(false); this.convertSelectedAttrButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent event) { convertSelectedAttrPressed(); } }); // Create the changeAllAttributes Button this.convertAllAttrsButton = WidgetFactory.createButton( attrGroup, CONVERT_ALL_ATTR_BUTTON, GridData.HORIZONTAL_ALIGN_BEGINNING); this.convertAllAttrsButton.setEnabled(false); this.convertAllAttrsButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent event) { convertAllAttrsPressed(); } }); // Create the showDatatypeDialog Button this.showDatatypeDialogButton = WidgetFactory.createButton( attrGroup, "Change", GridData.HORIZONTAL_ALIGN_END); // $NON-NLS-1$ this.showDatatypeDialogButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent event) { showDatatypeDialogPressed(); } }); attrDatatypeLabel = WidgetFactory.createLabel( attrGroup, "xxxxxxxxxxxxxxxxxxxxxxx", datatypeImage, //$NON-NLS-1$ GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.GRAB_HORIZONTAL); if (this.targetLocked) { this.showDatatypeDialogButton.setEnabled(false); } else { this.showDatatypeDialogButton.setEnabled(true); } }
/** Create the tableViewer Panel */ @SuppressWarnings("unused") private void createTableViewerPanel(Composite theParent) { Composite tablePanel = new Composite(theParent, SWT.NONE); // Set the layout GridLayout gridLayout = new GridLayout(); tablePanel.setLayout(gridLayout); GridData gridData = new GridData(GridData.FILL_BOTH); tablePanel.setLayoutData(gridData); // Add header panel HEADER_PANEL: { Composite headerPanel = WidgetFactory.createPanel(tablePanel); // ------------------------------ // Set layout for the Composite // ------------------------------ headerPanel.setLayout(new GridLayout()); ((GridLayout) headerPanel.getLayout()).numColumns = 3; headerPanel.setLayoutData(new GridData(GridData.FILL_BOTH)); ((GridData) headerPanel.getLayoutData()).minimumHeight = 80; // ((GridData)headerPanel.getLayoutData()).grabExcessHorizontalSpace = true; // Add general info/instructions text box { helpText = new Text(headerPanel, SWT.WRAP | SWT.READ_ONLY); helpText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW)); helpText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE)); helpText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); ((GridData) helpText.getLayoutData()).horizontalSpan = 3; ((GridData) helpText.getLayoutData()).heightHint = 40; ((GridData) helpText.getLayoutData()).widthHint = 360; helpText.setText(Messages.datatypeReconciler_helpText); } // Add button bar containing: // [CHANGE ALL COLUMN DATATYPES] - or - [CONVERT ALL SQL SYMBOLS] this.convertAllSqlSymbolsButton = WidgetFactory.createButton( headerPanel, Messages.datatypeReconciler_convertAllSqlSymbolsLabel); this.convertAllSqlSymbolsButton.setToolTipText( Messages.datatypeReconciler_convertAllSqlSymbolsTooltip); this.convertAllSqlSymbolsButton.setImage( UiPlugin.getDefault().getImage(PluginConstants.Images.ARROW_LEFT_ICON)); this.convertAllSqlSymbolsButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent event) { changeAllColumnDatatypesButtonPressed(); } }); WidgetFactory.createLabel(headerPanel, " - or - "); // $NON-NLS-1$ this.changeAllColumnDatatypesButton = WidgetFactory.createButton( headerPanel, Messages.datatypeReconciler_convertAllColumnDatatypesLabel); this.changeAllColumnDatatypesButton.setToolTipText( Messages.datatypeReconciler_convertAllColumnDatatypesTooltip); this.changeAllColumnDatatypesButton.setImage( UiPlugin.getDefault().getImage(PluginConstants.Images.ARROW_RIGHT_ICON)); this.changeAllColumnDatatypesButton.setEnabled(false); this.changeAllColumnDatatypesButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent event) { changeAllColumnDatatypesPressed(); } }); } BINDING_TABLE: { table = new Table(tablePanel, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); table.setHeaderVisible(true); table.setLinesVisible(true); table.setLayout(new TableLayout()); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.heightHint = 200; table.setLayoutData(gd); this.bindingTableViewer = new TableViewer(table); this.bindingTableViewer.getControl().setLayoutData(gd); this.bindingContentProvider = new BindingContentProvider(); // create columns // | status icon | Source SQL Symbol | <-- | Matched Datatype | -> | Target Column // COLUMN 0 : STATUS ICON Button TableViewerColumn column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT); column.setLabelProvider(new TheBindingColumnLabelProvider(0)); column.getColumn().setText(getSpaces(8)); column.getColumn().pack(); // COLUMN 1 : SOURCE SQL SYMBOL column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT); column.getColumn().setText(Messages.datatypeReconciler_sourceSqlSymbolLabel + getSpaces(100)); column.setLabelProvider(new TheBindingColumnLabelProvider(1)); column.getColumn().pack(); // COLUMN 2 : LEFT ARROW Button column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT); column.getColumn().setText(getSpaces(8)); column.setLabelProvider(new TheBindingColumnLabelProvider(2)); column.setEditingSupport(new ConvertSymbolEditingSupport(this.bindingTableViewer)); column.getColumn().pack(); column.getColumn().setToolTipText(Messages.datatypeReconciler_convertSourceDatatypeTooltip); // COLUMN 3 : Matched datatype column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT); column.getColumn().setText(Messages.datatypeReconciler_matchedTypeLabel + getSpaces(60)); column.setLabelProvider(new TheBindingColumnLabelProvider(3)); column.setEditingSupport(new ChangeProposedDatatypeEditingSupport(this.bindingTableViewer)); column.getColumn().pack(); column.getColumn().setToolTipText(Messages.datatypeReconciler_matchedDatatypeTooltip); // COLUMN 4 : RIGHT ARROW Button column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT); column.getColumn().setText(getSpaces(8)); column.setLabelProvider(new TheBindingColumnLabelProvider(4)); column.setEditingSupport(new ChangeDatatypeEditingSupport(this.bindingTableViewer)); column.getColumn().pack(); column.getColumn().setToolTipText(Messages.datatypeReconciler_changeTargetDatatypeTooltip); // COLUMN 5 : Target Column Definition column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT); column.getColumn().setText(Messages.datatypeReconciler_targetColumnLabel + getSpaces(25)); column.setLabelProvider(new TheBindingColumnLabelProvider(5)); column.getColumn().pack(); bindingTableViewer.setUseHashlookup(true); bindingTableViewer.setContentProvider(this.bindingContentProvider); bindingTableViewer.setInput(this.bindingListInput); updateRowColors(); } // Panel to display selection details SELECTION_STATUS_PANEL: { Composite selectionPanel = WidgetFactory.createGroup( tablePanel, Messages.datatypeReconciler_selectionPanelInfoLabel); // ------------------------------ // Set layout for the Composite // ------------------------------ selectionPanel.setLayout(new GridLayout()); ((GridLayout) selectionPanel.getLayout()).numColumns = 2; selectionPanel.setLayoutData(new GridData(GridData.FILL_BOTH)); ((GridData) selectionPanel.getLayoutData()).minimumHeight = 80; // Label selectedSymbolLabel = new Label(selectionPanel, SWT.NONE); // selectedSymbolLabel.setText("Selected Symbol: "); symbolConversionLabel = new Label(selectionPanel, SWT.NONE); symbolConversionLabel.setText(PluginConstants.EMPTY_STRING); symbolConversionLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); symbolConversionLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE)); Label messageLabel = new Label(selectionPanel, SWT.NONE); // messageLabel.setText("Status: "); symbolWarningLabel = new Label(selectionPanel, SWT.NONE); symbolWarningLabel.setText(PluginConstants.EMPTY_STRING); symbolWarningLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); symbolWarningLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE)); } }