@SuppressWarnings({"unchecked", "rawtypes"}) @Override public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) { super.createControls(parent, aTabbedPropertySheetPage); Composite composite = getWidgetFactory().createFlatFormComposite(parent); TableColumnLayout tableColumnLayout = new TableColumnLayout(); composite.setLayout(tableColumnLayout); FormData data; table = getWidgetFactory().createTable(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); table.setHeaderVisible(true); table.setLinesVisible(true); columns = new ArrayList(); String[] titles = UserGroupPropertySource.getPropertiesDisplayValuesTable(); int[] weights = {30, 30, 30}; for (int i = 0; i < titles.length; i++) { TableColumn column = new TableColumn(table, SWT.NONE); column.setText(titles[i]); tableColumnLayout.setColumnData(column, new ColumnWeightData(weights[i])); columns.add(column); } data = new FormData(); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); data.top = new FormAttachment(0, 0); data.bottom = new FormAttachment(100, 0); table.setLayoutData(data); }
@Override public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); TabbedPropertySheetWidgetFactory factory = getWidgetFactory(); Composite composite = factory.createComposite(parent); }
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) { super.createControls(parent, aTabbedPropertySheetPage); Composite composite = getWidgetFactory().createFlatFormComposite(parent); CLabel nameLabel = getWidgetFactory().createCLabel(composite, label); FormData data = new FormData(); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); data.top = new FormAttachment(0, 0); nameLabel.setLayoutData(data); }
@Override public void createControls( Composite parent, final TabbedPropertySheetPage atabbedPropertySheetPage) { super.createControls(parent, atabbedPropertySheetPage); parentPage = atabbedPropertySheetPage; container = getWidgetFactory().createFlatFormComposite(parent); controlListener = new ControlAdapter() { public void controlResized(ControlEvent e) { atabbedPropertySheetPage.resizeScrolledComposite(); } }; }
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) { super.createControls(parent, aTabbedPropertySheetPage); Composite composite = getWidgetFactory().createFlatFormComposite(parent); nameText = getWidgetFactory().createText(composite, ""); FormData data = new FormData(); data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH); data.right = new FormAttachment(100, 0); data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE); nameText.setLayoutData(data); nameText.addModifyListener(this); CLabel labelLabel = getWidgetFactory().createCLabel(composite, "Name:"); data = new FormData(); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(nameText, -ITabbedPropertyConstants.HSPACE); data.top = new FormAttachment(nameText, 0, SWT.CENTER); labelLabel.setLayoutData(data); }
/** * {@inheritDoc} * * @see * org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls(org.eclipse.swt.widgets.Composite, * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage) */ @Override public void createControls( final Composite parent, final TabbedPropertySheetPage aTabbedPropertySheetPage) { super.createControls(parent, aTabbedPropertySheetPage); final Composite composite = getWidgetFactory().createFlatFormComposite(parent); composite.setLayout(new GridLayout(3, false)); final Composite choiceComposite = createChoiceComposite(composite); choiceTable = getWidgetFactory().createTable(choiceComposite, SWT.MULTI | SWT.BORDER); choiceTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); availableElementsTableViewer = new TableViewer(choiceTable); final Composite controlButtons = getWidgetFactory().createComposite(composite, SWT.NONE); controlButtons.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); final GridLayout controlsButtonGridLayout = new GridLayout(); controlButtons.setLayout(controlsButtonGridLayout); new Label(controlButtons, SWT.NONE); addButton = getWidgetFactory().createButton(controlButtons, "Add >", SWT.PUSH); addButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); removeButton = getWidgetFactory().createButton(controlButtons, "< Remove", SWT.PUSH); removeButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); final Label spaceLabel = new Label(controlButtons, SWT.NONE); final GridData spaceLabelGridData = new GridData(); spaceLabelGridData.verticalSpan = 2; spaceLabel.setLayoutData(spaceLabelGridData); final Composite featureComposite = createFeatureComposite(composite); featureTable = getWidgetFactory().createTable(featureComposite, SWT.MULTI | SWT.BORDER); featureTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); selectedElementsTableViewer = new TableViewer(featureTable); }
/** * This operation draws the (initial) controls in the properties view based on the input. In this * case, there are initially no widgets to prepare. */ @Override public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) { super.createControls(parent, aTabbedPropertySheetPage); // Get the default background color. Color backgroundColor = parent.getBackground(); // Create a section for the data composites. section = getWidgetFactory() .createSection(parent, ExpandableComposite.SHORT_TITLE_BAR | Section.DESCRIPTION); section.setText("Node properties"); section.setDescription("All properties available for " + "this node can be modified here."); section.setBackground(backgroundColor); // Create the Composite that contains all DataComponentComposites. final Composite client = new Composite(section, SWT.NONE); GridLayout clientLayout = new GridLayout(2, false); // Set the margins and spacing based on the tabbed property constants. clientLayout.marginLeft = ITabbedPropertyConstants.HMARGIN; clientLayout.marginRight = ITabbedPropertyConstants.HMARGIN; clientLayout.marginTop = ITabbedPropertyConstants.VMARGIN; clientLayout.marginBottom = ITabbedPropertyConstants.VMARGIN; clientLayout.horizontalSpacing = ITabbedPropertyConstants.HSPACE; clientLayout.verticalSpacing = ITabbedPropertyConstants.VSPACE; client.setLayout(clientLayout); // Make the background of the section client white unless ICE is in // debug mode. if (System.getProperty("DebugICE") == null) { client.setBackground(backgroundColor); } else { client.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); } // Set the client area for the section. section.setClient(client); // Get the property viewer's ScrolledComposite and its first Composite // (its "client" Composite). scrollCompositeClient = section.getParent().getParent().getParent().getParent(); scrollComposite = (ScrolledComposite) scrollCompositeClient.getParent(); // Add a listener to resize the Section's properties and update the // ScrollComposite's minimum bounds correctly based on the displayed // properties. scrollComposite.addControlListener( new ControlAdapter() { @Override public void controlResized(ControlEvent e) { resizePropertyView(); } }); // Create the type Combo Composite. typeComposite = createTypeComposite(client); GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); gridData.horizontalSpan = 2; typeComposite.setLayoutData(gridData); // Refresh the contents of the type Combo and its containing Composite. refreshTypeWidgets(); // Create the table of properties. tableViewer = createTableViewer(client); // Set the table's layout data so it occupies all spare space in the // property section client. tableViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // Create the add/delete buttons. Composite buttonComposite = createButtons(client); // The button Composite shouldn't grab any space. Align it along the // center and top of the space to the right of the table. buttonComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false)); return; }
/** * @see * org.eclipse.ui.views.properties.tabbed.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage) */ public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); Composite composite = getWidgetFactory().createFlatFormComposite(parent); FormData data; Shell shell = new Shell(); GC gc = new GC(shell); gc.setFont(shell.getFont()); Point point = gc.textExtent(""); // $NON-NLS-1$ int buttonHeight = point.y + 5; gc.dispose(); shell.dispose(); CLabel fontLabel = getWidgetFactory().createCLabel(composite, "Font:"); // $NON-NLS-1$ fontText = getWidgetFactory().createText(composite, ""); // $NON-NLS-1$ fontText.setEditable(false); Button fontButton = getWidgetFactory().createButton(composite, "Change...", SWT.PUSH); // $NON-NLS-1$ fontButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { FontDialog ftDialog = new FontDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); FontData fontdata = buttonElement.getControl().getFont().getFontData()[0]; String value = fontdata.toString(); if ((value != null) && (value.length() > 0)) { ftDialog.setFontList(new FontData[] {new FontData(value)}); } FontData fData = ftDialog.open(); if (fData != null) { value = fData.toString(); ButtonElementProperties properties = (ButtonElementProperties) Adapters.adapt(buttonElement, IPropertySource.class); properties.setPropertyValue(ButtonElementProperties.PROPERTY_FONT, value); fontText.setText(StringConverter.asString(fData)); } } }); data = new FormData(); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(fontText, -ITabbedPropertyConstants.HSPACE); data.top = new FormAttachment(0, 0); fontLabel.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH); data.right = new FormAttachment(fontButton, -ITabbedPropertyConstants.HSPACE); data.top = new FormAttachment(0, 0); fontText.setLayoutData(data); data = new FormData(); data.right = new FormAttachment(100, 0); data.top = new FormAttachment(0, 0); data.height = buttonHeight; fontButton.setLayoutData(data); }
@Override public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) { super.createControls(parent, aTabbedPropertySheetPage); Composite composite = getWidgetFactory().createComposite(parent); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 3; composite.setLayout(gridLayout); GridData labelData = new GridData(); labelData.widthHint = STANDARD_LABEL_WIDTH + 30; GridData languageSelectData = new GridData(); languageSelectData.widthHint = 400; GridData buttonData = new GridData(); buttonData.widthHint = 150; selectLabel = getWidgetFactory().createLabel(composite, "Set language: "); selectLabel.setLayoutData(labelData); languageCombo = getWidgetFactory().createCCombo(composite, SWT.READ_ONLY | SWT.BORDER); languageCombo.setLayoutData(languageSelectData); languageCombo.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int index = languageCombo.getSelectionIndex(); Language lang = test.getAllLanguages().getLanguages().get(index); ChangeCurrentLanguageCommand command = new ChangeCurrentLanguageCommand(); command.setAllLanguages(test.getAllLanguages()); command.setCurrentLanguage(lang); command.setTest(test); executeCommand(command); refresh(); } }); updateLanguageCombo(); openI18nFileButton = getWidgetFactory().createButton(composite, "Open file", SWT.PUSH); openI18nFileButton.setLayoutData(buttonData); openI18nFileButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent se) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IResource resource = root.findMember( new Path(test.getAllLanguages().getCurrentLanguage().getFileName())); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { IDE.openEditor(page, ResourceUtil.getFile(resource), true); } catch (PartInitException e) { ErrorHandler.logAndShowErrorDialogAndRethrow( "Error opening internationalisation file", e); } } }); addLanguageButton = getWidgetFactory().createButton(composite, "Add language...", SWT.PUSH); addLanguageButton.addSelectionListener(addListener); addLanguageButton.setLayoutData(buttonData); refreshButton = getWidgetFactory().createButton(composite, "Refresh languages", SWT.PUSH); refreshButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { UpdateLangagesCommand command = new UpdateLangagesCommand(); command.addTest(test); // if (MessageDialog.openConfirm(new Shell(), "Confirm refreshing languages", // "\"Undo\" is not supported for this operation. Do you want to continue?")) executeCommand(command); refresh(); } }); refreshButton.setLayoutData(buttonData); removeButton = getWidgetFactory().createButton(composite, "Remove language", SWT.PUSH); removeButton.setLayoutData(buttonData); removeButton.addSelectionListener(removeListener); GridData statusData = new GridData(); statusData.horizontalSpan = 3; noI18nValuesLabel = getWidgetFactory() .createLabel( composite, "Status: No text values in internationalisation file. Add content, save file and press \"Refresh languages\""); noI18nValuesLabel.setLayoutData(statusData); noI18nValuesLabel.setVisible(false); noObserversLabel = getWidgetFactory() .createLabel( composite, "Status: No page elements has internationalisation enabled. " + "To enable, check \"Use internationalisation\" on page element identifiers."); noObserversLabel.setLayoutData(statusData); noObserversLabel.setVisible(false); }