/** * Create contents of the editor part. * @param parent */ @Override @PostConstruct public void createPartControl(Composite parent) { this.sashForm = new SashForm(parent, SWT.NONE); this.treeViewer = new TreeViewer(this.sashForm, SWT.BORDER); this.tree = this.treeViewer.getTree(); this.tabFolder = new CTabFolder(this.sashForm, SWT.BORDER); this.tabFolder.setTabPosition(SWT.BOTTOM); this.tabFolder.setSelectionBackground(Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT)); this.tabItem = new CTabItem(this.tabFolder, SWT.NONE); this.tabItem.setText("New Item"); this.tabItem_1 = new CTabItem(this.tabFolder, SWT.NONE); this.tabItem_1.setText("New Item"); this.sashForm.setWeights(new int[] { 3, 10 }); }
private void createTabFolder ( final Composite parent ) { this.tabFolder = new CTabFolder ( parent, SWT.TOP ); this.tabFolder.setLayoutData ( new GridData ( GridData.FILL, GridData.FILL, true, true ) ); for ( final GeneratorPageInformation page : this.pages ) { final CTabItem tabItem = new CTabItem ( this.tabFolder, SWT.NONE ); final Composite tabComposite = new Composite ( this.tabFolder, SWT.NONE ); tabComposite.setLayout ( new FillLayout () ); page.getGeneratorPage ().createPage ( tabComposite ); tabItem.setText ( page.getLabel () ); tabItem.setControl ( tabComposite ); page.getGeneratorPage ().setTarget ( this ); } this.tabFolder.setSelection ( 0 ); }
@Override protected void show () { super.show (); final int tabIndex = findIndex ( this.index ); if ( tabIndex < 0 ) { this.item = new CTabItem ( this.folder, SWT.NONE ); this.item.setData ( "order", this.index ); } else { this.item = new CTabItem ( this.folder, SWT.NONE, tabIndex ); this.item.setData ( "order", this.index ); } this.item.setControl ( this.container ); useItem ( this.item ); }
private void addCustomWidgetsToGroupWidget( LinkedHashMap<String, ArrayList<Property>> subgroupTree, String subgroupName, AbstractELTContainerWidget subGroupContainer) { boolean isError=false; for(final Property property: subgroupTree.get(subgroupName)){ AbstractWidget eltWidget = addCustomWidgetInGroupWidget( subGroupContainer, property); eltWidgetList.add(eltWidget); if(!eltWidget.isWidgetValid()) { isError=true; } } if (isError) { for (CTabItem item : tabFolder.getItems()) { if (StringUtils.equalsIgnoreCase(StringUtils.trim(item.getText()), subgroupTree .get(subgroupName).get(0).getPropertyGroup())) { item.setImage(ImagePathConstant.COMPONENT_ERROR_ICON.getImageFromRegistry()); } } } }
@Override protected Control createContents(Composite parent) { Control control = super.createContents(parent); boolean selected = false; if (folder.getItemCount() > 0) { if (lastSelectedTabId != null) { CTabItem[] items = folder.getItems(); for (int i = 0; i < items.length; i++) if (items[i].getData(ID).equals("30.PluginPage")) { folder.setSelection(i); tabSelected(items[i]); selected = true; break; } } if (!selected) tabSelected(folder.getItem(0)); } // need to reapply the dialog font now that we've created new // tab items Dialog.applyDialogFont(folder); return control; }
public void setSwtItem(CTabItem swtItem) { this.swtItem = swtItem; if (swtItem == null) { setDisposed(true); return; } setDisposed(false); swtItem.addDisposeListener(this); String title = getTitle(); if (title != null) { swtItem.setText(escapeAccelerators(title)); } updateLeftImage(); swtItem.setShowClose(isCloseable()); if (buildonSWTItemSet) { build(); } if (showonSWTItemSet) { show(); } }
/** * Adds a new note to the notepad. */ public void addNewNote() { String noteText = ""; if (preferences.getBoolean(PreferenceConstants.PREF_PASTE_CLIPBOARD_IN_NEW_NOTES, PreferenceConstants.PREF_PASTE_CLIPBOARD_IN_NEW_NOTES_DEFAULT)) { noteText = (String) clipboard.getContents(TextTransfer.getInstance(), DND.CLIPBOARD); } String noteTitle = preferences.get(PreferenceConstants.PREF_NAME_PREFIX, PreferenceConstants.PREF_NAME_PREFIX_DEFAULT) + " " + (tabFolder.getItemCount() + 1); // Add a new note tab with a number appended to its name (Note 1, Note 2, Note 3, etc.). addNewNoteTab(noteTitle, noteText, null, true, null); CTabItem previousSelectedTab = tabFolder.getSelection(); // Remove lock for currently selected tab. if (previousSelectedTab != null && previousSelectedTab.getText().startsWith(LOCK_PREFIX)) { previousSelectedTab.setText(previousSelectedTab.getText().substring(LOCK_PREFIX.length())); } tabFolder.setSelection(tabFolder.getItemCount() - 1); }
/** * Saves plugin state for next Eclipse session or when reopening the view. */ private void savePluginState() { if (!tabFolder.isDisposed()) { IDialogSettings section = Notepad4e.getDefault().getDialogSettings().getSection(ID); section.put(STORE_COUNT_KEY, tabFolder.getItemCount()); for (int tabIndex = 0; tabIndex < tabFolder.getItemCount(); ++tabIndex) { CTabItem tab = tabFolder.getItem(tabIndex); if (!tab.isDisposed()) { Note note = getNote(tabIndex); section.put(STORE_TEXT_PREFIX_KEY + tabIndex, note.getText()); section.put(STORE_STYLE_PREFIX_KEY + tabIndex, note.serialiseStyle()); if (tab.getText().startsWith(LOCK_PREFIX)) { // Do not save lock symbol. section.put(STORE_TITLE_PREFIX_KEY + tabIndex, tab.getText().substring(LOCK_PREFIX.length())); } else { section.put(STORE_TITLE_PREFIX_KEY + tabIndex, tab.getText()); } section.put(STORE_EDITABLE_PREFIX_KEY + tabIndex, note.getEditable()); section.put(STORE_BULLETS_PREFIX_KEY + tabIndex, note.serialiseBullets()); } } Notepad4e.save(); } }
/** * Adds a new note to the view. * * @param title * @param text * @param style * @param editable * @param noteBullets */ private void addNewNoteTab(String title, String text, String style, boolean editable, String bullets) { CTabItem tab = new CTabItem(tabFolder, SWT.NONE); tab.setText(title); // Add listener to clean up corresponding note when disposing the tab. tab.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent event) { CTabItem itemToDispose = (CTabItem) event.getSource(); ((Note) itemToDispose.getControl()).dispose(); } }); Note note = new Note(tabFolder, text, editable); // Style can be null if new note. if (style != null && !style.isEmpty()) { note.deserialiseStyle(style); } // Bullets can be null if new note or upgrading from old plugin version. if (bullets != null && !bullets.isEmpty()) { note.deserialiseBullets(bullets); } tab.setControl(note); }
public void updateTabItems() { if(!this.isDisposed()) { this.ignoreEvents = true; this.disposeOrphanItems(); TGDocumentListManager documentManager = TGDocumentListManager.getInstance(this.context); TGDocument currentDocument = documentManager.findCurrentDocument(); List<TGDocument> documents = documentManager.getDocuments(); for(int i = 0 ; i < documents.size() ; i ++) { TGDocument document = documents.get(i); CTabItem cTabItem = this.findTabItem(i); cTabItem.setText(this.createTabItemLabel(document)); cTabItem.setData(document); if( currentDocument != null && currentDocument.equals(document) ) { this.tabFolder.setSelection(i); } } this.currentUnsaved = currentDocument.isUnsaved(); this.ignoreEvents = false; } }
/** * Creates the Complete General Tab * @param parent The Parent Folder * @param meta The Meta Include for this Project * @param props The PropsUI from the Kettle Project * @param fieldNames The FieldNames from the Previous Step */ public LayoutGeneral(final CTabFolder parent, ARXPluginMeta meta, final PropsUI props, String[] fieldNames) { this.meta = meta; this.props = props; this.fieldNames = fieldNames; composites = new LayoutCompositeInterface[2]; CTabItem tabGeneral = new CTabItem(parent, SWT.NONE); tabGeneral.setText(Resources.getMessage("General.2")); ScrolledComposite scroller = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL); this.build(scroller); tabGeneral.setControl(scroller); { } }
/** * Shows the settings for the attribute weights. */ private void showSettingsAttributeWeights() { if (this.cTabAttributeWeights != null && !this.attributeWeight.quasiIdentifierChanged()) return; if (this.cTabAttributeWeights != null) this.hideSettingsAttributeWeights(); this.cTabAttributeWeights = new CTabItem(wTabFolder, SWT.NONE); this.cTabAttributeWeights.setText(Resources.getMessage("CriterionDefinitionView.63")); Composite cTabAttributeWeightsComp = new Composite(this.wTabFolder, SWT.NONE); props.setLook(cTabAttributeWeightsComp); cTabAttributeWeightsComp.setLayout(new FillLayout()); cTabAttributeWeightsComp.setEnabled(true); this.attributeWeight = new ViewAttributeWeights(cTabAttributeWeightsComp, meta, fieldNames); this.composites[2] = this.attributeWeight; cTabAttributeWeightsComp.layout(); cTabAttributeWeights.setControl(cTabAttributeWeightsComp); }
void updateSelectedOnTabFolder(CTabFolder tf) { if (tf == null) return; for (CTabItem i : tf.getItems()) { if (i == tf.getSelection()) { // Font f = Fonts.createFont(i.getFont().getFo, height, style); i.setFont(Fonts.addStyleBit(i.getFont(), SWT.BOLD)); i.setFont(Fonts.removeStyleBit(i.getFont(), SWT.NORMAL)); } else { i.setFont(Fonts.removeStyleBit(i.getFont(), SWT.BOLD)); i.setFont(Fonts.addStyleBit(i.getFont(), SWT.NORMAL)); } } }
private void createKwTab(TrpKeyWord k) { CTabItem item = new CTabItem(folder, SWT.NONE); item.setText("\"" + k.getKeyWord() + "\" (" + k.getHits().size() + " hits)"); Composite c = new Composite(folder, SWT.NONE); c.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); c.setLayout(new GridLayout(1, false)); KwsHitTableWidget hitTableWidget = new KwsHitTableWidget(c, SWT.BORDER, icons); hitTableWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); hitTableWidget.getTableViewer().setInput(k.getHits()); tvList.add(hitTableWidget.getTableViewer()); addHoverListeners(hitTableWidget.getTableViewer().getTable()); item.setControl(c); addDoubleClickListener(hitTableWidget.getTableViewer()); }
@Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); container.setLayout(new FillLayout()); CTabFolder folder = new CTabFolder(parent, SWT.BORDER); for (SimulationTimeSeries serie : result.getCollectedData()) { CTabItem item = new CTabItem(folder, SWT.CLOSE); item.setText(serie.getName()); Composite composite = new Composite(folder, SWT.NONE); composite.setLayout(new FillLayout()); TableViewer resultViewer = new TableViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); resultViewer.setContentProvider(ArrayContentProvider.getInstance()); resultViewer.setInput(new LinkedList<>()); item.setControl(composite); } return container; }
protected void loadCompareViewers() { List<CompareViewerFactory> compareViewerFactories = loadViewerFactories(); compareViewers = new Vector<CompareViewer>(compareViewerFactories.size()); for (CompareViewerFactory cvf : compareViewerFactories) { CTabItem tabItem = new CTabItem(tabFolder, SWT.None); tabItem.setText(cvf.getCompareViewerName()); tabItem.setImage(cvf.getCompareViewerIcon()); Composite c = new Composite(tabFolder, SWT.NONE); tabItem.setControl(c); CompareViewer viewer = cvf.createViewer(c, SWT.NONE); if (viewer != null) { compareViewers.add(viewer); } } }
@Inject @Optional void eventReceivedViewRefresh(@EventTopic("view_refresh/*") BTSObject selectionObject) { if ((selectionObject instanceof BTSCorpusObject) && selectionObject.equals(selectedCorpusObject)) { final List<TreeNodeWrapper> nodes = new Vector<TreeNodeWrapper>(1); nodes.add(selectedTreeNode); sync.asyncExec(new Runnable() { public void run() { final CTabItem ti = tabFolder.getSelection(); TreeViewer tv = (TreeViewer) ti.getData("tv"); if (BTSConstants.ORPHANS_NODE_LABEL.equals(selectedTreeNode.getLabel())) { loadOrphans(tv.getControl(), tv, selectedTreeNode); } else { loadChildren(nodes, true, tv.getControl()); } } }); } }
private CTabItem createTableTab() { CTabItem tab = new CTabItem(tabs, SWT.NONE); tab.setText("Table"); tab.setImage(ch.ivyteam.swt.icons.IconFactory.get(this).getTable(Size.SIZE_16)); Group grpDecisions = new Group(tabs, SWT.NONE); grpDecisions.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); grpDecisions.setText("Decisions"); grpDecisions.setLayout(new GridLayout(1, false)); tab.setControl(grpDecisions); columnEdit = new ColumnEditActionsComposite(grpDecisions, SWT.NONE); columnEdit.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); addDataChooser(); table = new DecisionTableComposite(grpDecisions, SWT.NONE); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); return tab; }
private CTabItem createDMNtab() { CTabItem dmnTab = new CTabItem(tabs, SWT.NONE); dmnTab.setText("DMN"); // assign a XML or DMN icon TextViewer dmnViewer = new TextViewer(tabs, SWT.V_SCROLL); dmnViewer.setDocument(new Document()); dmnTab.setControl(dmnViewer.getTextWidget()); dmnTab.addListener(SWT.SELECTED, evt -> { dmnViewer.getDocument().set(toDMN(table.model)); }); tabs.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { tabs.getSelection().notifyListeners(SWT.SELECTED, new Event()); } }); return dmnTab; }
public void createLogDetail() { tabFolderLogDetail = new CTabFolder(sashFormLog, SWT.CLOSE | SWT.BORDER); tabFolderLogDetail.setTabHeight(0); tabFolderLogDetail.marginHeight = 0; tabFolderLogDetail.marginWidth = 0; tabFolderLogDetail.setMaximizeVisible(false); tabFolderLogDetail.setMinimizeVisible(false); //tabFolderLogDetail.setSelectionBackground(new Color(display, new RGB(153, 186, 243))); tabFolderLogDetail.setSimple(false); tabFolderLogDetail.setUnselectedCloseVisible(true); CTabItem tabItemLogList = new CTabItem(tabFolderLogDetail, SWT.NONE | SWT.MULTI | SWT.V_SCROLL); tabFolderLogDetail.setSelection(tabItemLogList); //styledTextLog = new List(tabFolderLogDetail, SWT.BORDER); styledTextLog = new StyledText(tabFolderLogDetail, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY); styledTextLog.addLineStyleListener(new LogLineStyleListener(shell)); tabItemLogList.setControl(styledTextLog); //sTextLog.setFont(new Font(display,"Courier New",10,SWT.NONE)); }
private static void saveScript() { CTabItem currTabItem = getCurrentTab(); if (currTabItem != null) { String fileName = currTabItem.getText(); if (fileName.contains("*")) { fileName = fileName.substring(1, fileName.length()); String path = (String) getCurrentTab().getData(fileName); StyledText text = (StyledText) getCurrentTab().getControl(); String strContent = removeTabKey(text.getText()); try { FileUtility.writeFile(path, strContent, false); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } getCurrentTab().setText(fileName); } } }
public void cleanupClosedData() { Set<DatFile> openFiles = new HashSet<DatFile>(Project.getUnsavedFiles()); for (OpenGLRenderer renderer : renders) { Composite3D c3d = renderer.getC3D(); openFiles.add(c3d.getLockableDatFileReference()); } for (EditorTextWindow w : Project.getOpenTextWindows()) { for (CTabItem t : w.getTabFolder().getItems()) { openFiles.add(((CompositeTab) t).getState().getFileNameObj()); } } Set<DatFile> deadFiles = new HashSet<DatFile>(Project.getParsedFiles()); deadFiles.removeAll(openFiles); if (!deadFiles.isEmpty()) { GData.CACHE_viewByProjection.clear(); GData.parsedLines.clear(); GData.CACHE_parsedFilesSource.clear(); } for (DatFile datFile : deadFiles) { datFile.disposeData(); } if (!deadFiles.isEmpty()) { // TODO Debug only System.gc(); } }
public void closeTabWithDatFile(DatFile df) { if (View.DUMMY_DATFILE.equals(df) || df == null) { return; } for (CTabItem ti : tabFolder_OpenDatFiles[0].getItems()) { if (df.equals(ti.getData())) { ti.dispose(); Project.removeOpenedFile(df); if (!closeDatfile(df)) { Project.addOpenedFile(df); updateTabs(); } Editor3DWindow.getWindow().getShell().forceFocus(); regainFocus(); break; } } }
private void createByUser(CTabFolder tabFolder) { CTabItem bptab = new CTabItem(tabFolder, SWT.NONE); bptab.setText(Messages.PermissionPage_5); scUser = new ScrolledComposite(tabFolder, SWT.H_SCROLL | SWT.V_SCROLL); scUser.setLayoutData(new GridData(GridData.FILL_BOTH)); cmpUser = new Composite(scUser, SWT.NONE); cmpUser.setLayout(new GridLayout(2, true)); scUser.setContent(cmpUser); // Set the minimum size scUser.setMinSize(cmpUser.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, cmpUser.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); // Expand both horizontally and vertically scUser.setExpandHorizontal(true); scUser.setExpandVertical(true); bptab.setControl(scUser); }
private void createByRole(CTabFolder tabFolder) { CTabItem bptab = new CTabItem(tabFolder, SWT.NONE); bptab.setText(Messages.PermissionPage_6); scRole = new ScrolledComposite(tabFolder, SWT.H_SCROLL | SWT.V_SCROLL); scRole.setLayoutData(new GridData(GridData.FILL_BOTH)); cmpRole = new Composite(scRole, SWT.NONE); cmpRole.setLayout(new GridLayout(2, true)); scRole.setContent(cmpRole); // Set the minimum size scRole.setMinSize(cmpRole.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, cmpRole.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); // Expand both horizontally and vertically scRole.setExpandHorizontal(true); scRole.setExpandVertical(true); bptab.setControl(scRole); }
protected void createClasspathTab(CTabFolder tabFolder) { CTabItem tbtmNewItem_1 = new CTabItem(tabFolder, SWT.NONE); tbtmNewItem_1.setText(Messages.JDBCDataAdapterComposite_classpath); Composite composite = new Composite(tabFolder, SWT.NONE); composite.setLayout(new GridLayout()); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); tbtmNewItem_1.setControl(composite); cpath = new ClasspathComponent(composite) { @Override protected void handleClasspathChanged() { pchangesuport.firePropertyChange("dirty", false, true); } }; cpath.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); }
private void createFilterExpression(FormToolkit toolkit, CTabFolder tabFolder) { CTabItem bptab = new CTabItem(tabFolder, SWT.NONE); bptab.setText(Messages.DatasetDialog_filterexpression); Composite sectionClient = toolkit.createComposite(tabFolder); FillLayout fLayout = new FillLayout(); fLayout.marginHeight = 5; fLayout.marginWidth = 5; sectionClient.setLayout(fLayout); filterExpression = new WTextExpression(sectionClient, SWT.NONE); filterExpression.setBackground(sectionClient.getBackground()); filterExpression.setExpressionContext(new ExpressionContext(newdataset, mdataset.getJasperConfiguration())); filterExpression.setExpression((JRDesignExpression) newdataset.getFilterExpression()); filterExpression.addModifyListener(new ExpressionModifiedListener() { @Override public void expressionModified(ExpressionModifiedEvent event) { newdataset.setFilterExpression(event.modifiedExpression); } }); bptab.setControl(sectionClient); }
public DataMappingFactory(CTabFolder tabFolder, IFieldSetter fsetter, DataQueryAdapters dqa) { IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor( "com.jaspersoft.studio", "mappingTool"); //$NON-NLS-1$ //$NON-NLS-2$ for (IConfigurationElement e : config) { try { IMappingTool qd = (IMappingTool) e.createExecutableExtension("MappingToolClass"); //$NON-NLS-1$ qd.setParentContainer(dqa); CTabItem bptab = new CTabItem(tabFolder, SWT.NONE); bptab.setText(qd.getName()); addDesigner(qd); bptab.setControl(qd.createControl(tabFolder)); qd.setFields(fsetter); } catch (CoreException ex) { System.out.println(ex.getMessage()); } } }
private FontFaceFragment createFileField(CTabFolder tabFolder, String name, final String type) { CTabItem bptab = new CTabItem(tabFolder, SWT.NONE); bptab.setText(name); SimpleFontFace fontFace = new SimpleFontFace(JasperReportsConfiguration.getDefaultJRConfig()); if (type.equals(NORMAL)) { fontFace = Misc.nvl((SimpleFontFace) fontFamily.getNormalFace(), fontFace); fontFamily.setNormalFace(fontFace); } else if (type.equals(BOLD)) { fontFace = Misc.nvl((SimpleFontFace) fontFamily.getBoldFace(), fontFace); fontFamily.setBoldFace(fontFace); } else if (type.equals(ITALIC)) { fontFace = Misc.nvl((SimpleFontFace) fontFamily.getItalicFace(), fontFace); fontFamily.setItalicFace(fontFace); } else if (type.equals(BOLDITALIC)) { fontFace = Misc.nvl((SimpleFontFace) fontFamily.getBoldItalicFace(), fontFace); fontFamily.setBoldItalicFace(fontFace); } FontFaceFragment fontFaceDialog = new FontFaceFragment(fontFace); Composite cmp = fontFaceDialog.createDialogArea(tabFolder); bptab.setControl(cmp); return fontFaceDialog; }
private void createTabMetadata(CTabFolder tabFolder) { CTabItem ptab = new CTabItem(tabFolder, SWT.NONE); ptab.setText(Messages.PDFExporterPreferencePage_38); Composite sc = new Composite(tabFolder, SWT.NONE); ptab.setControl(sc); addField(new StringFieldEditor(PdfExporterConfiguration.PROPERTY_METADATA_TITLE, Messages.PDFExporterPreferencePage_39, sc)); addField(new StringFieldEditor(PdfExporterConfiguration.PROPERTY_METADATA_AUTHOR, Messages.PDFExporterPreferencePage_40, sc)); addField(new StringFieldEditor(PdfExporterConfiguration.PROPERTY_METADATA_SUBJECT, Messages.PDFExporterPreferencePage_41, sc)); addField(new StringFieldEditor(PdfExporterConfiguration.PROPERTY_METADATA_KEYWORDS, Messages.PDFExporterPreferencePage_42, sc)); addField(new StringFieldEditor(PdfExporterConfiguration.PROPERTY_METADATA_CREATOR, Messages.PDFExporterPreferencePage_43, sc)); sc.setLayout(new GridLayout(3, false)); }
private void createTabPageHB(CTabFolder tabFolder) { CTabItem ptab = new CTabItem(tabFolder, SWT.NONE); ptab.setText(Messages.HTMLExporterPreferencePage_28); Composite sc = new Composite(tabFolder, SWT.NONE); sc.setLayout(new GridLayout()); TextFieldEditor se = new TextFieldEditor(HtmlExporterConfiguration.PROPERTY_HTML_HEADER, Messages.HTMLExporterPreferencePage_29, sc); se.getTextControl(sc).setLayoutData(new GridData(GridData.FILL_BOTH)); addField(se); TextFieldEditor scf = new TextFieldEditor(HtmlExporterConfiguration.PROPERTY_HTML_FOOTER, Messages.HTMLExporterPreferencePage_30, sc); scf.getTextControl(sc).setLayoutData(new GridData(GridData.FILL_BOTH)); addField(scf); ptab.setControl(sc); }
private void createJExcelAPI(CTabFolder tabFolder) { CTabItem ptab = new CTabItem(tabFolder, SWT.NONE); ptab.setText(Messages.ExcelExporterPreferencePage_60); ScrolledComposite scompo = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL); scompo.setExpandHorizontal(true); scompo.setExpandVertical(true); Composite sc = new Composite(scompo, SWT.NONE); sc.setLayout(new GridLayout(3, false)); BooleanFieldEditor bf = new BooleanFieldEditor(XlsExporterConfiguration.PROPERTY_CREATE_CUSTOM_PALETTE, Messages.ExcelExporterPreferencePage_61, sc); addField(bf); HelpSystem.setHelp(bf.getDescriptionControl(sc), StudioPreferencePage.REFERENCE_PREFIX + bf.getPreferenceName()); addField(new BooleanFieldEditor(JxlExporterConfiguration.PROPERTY_USE_TEMP_FILE, Messages.ExcelExporterPreferencePage_62, sc)); addField(new BooleanFieldEditor(JxlReportConfiguration.PROPERTY_COMPLEX_FORMAT, Messages.ExcelExporterPreferencePage_63, sc)); scompo.setMinSize(sc.getSize()); scompo.setContent(sc); ptab.setControl(scompo); }
private void createJExcelAPI(CTabFolder tabFolder) { CTabItem ptab = new CTabItem(tabFolder, SWT.NONE); ptab.setText(Messages.ExcelExporterPreferencePage_60); ScrolledComposite scompo = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL); scompo.setExpandHorizontal(true); scompo.setExpandVertical(true); Composite sc = new Composite(scompo, SWT.NONE); sc.setLayout(new GridLayout(3, false)); BooleanFieldEditor bf = new BooleanFieldEditor(XlsExporterConfiguration.PROPERTY_CREATE_CUSTOM_PALETTE, Messages.ExcelExporterPreferencePage_61, sc); addField(bf); HelpSystem.setHelp(bf.getDescriptionControl(sc), StudioPreferencePage.REFERENCE_PREFIX + bf.getPreferenceName()); addField(new BooleanFieldEditor(NSF_EXPORT_XLS_USE_TMP_FILE, Messages.ExcelExporterPreferencePage_62, sc)); addField(new BooleanFieldEditor(NSF_EXPORT_XLS_CELL_COMPLEX_FORMAT, Messages.ExcelExporterPreferencePage_63, sc)); scompo.setMinSize(sc.getSize()); scompo.setContent(sc); ptab.setControl(scompo); }
private void createBParam(FormToolkit toolkit, CTabFolder tabFolder) { CTabItem bptab = new CTabItem(tabFolder, SWT.NONE); bptab.setText(Messages.ParametersDialog_built_in_parameters); ScrolledComposite scompo = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL); scompo.setExpandHorizontal(true); scompo.setExpandVertical(true); Composite sectionClient = toolkit.createComposite(scompo); sectionClient.setLayout(new GridLayout(2, false)); for (JRParameter p : prompts) if (!p.isForPrompting() || p.isSystemDefined()) createInput(toolkit, sectionClient, (JRDesignParameter) p); sectionClient.pack(); scompo.setMinSize(sectionClient.getSize()); scompo.setContent(sectionClient); bptab.setControl(scompo); }
private void createUserParam(FormToolkit toolkit, CTabFolder tabFolder) { if (canShowParameters()) { CTabItem ptab = new CTabItem(tabFolder, SWT.NONE); ptab.setText(Messages.ParametersDialog_user_parameters); ScrolledComposite scompo = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL); scompo.setExpandHorizontal(true); scompo.setExpandVertical(true); Composite sectionClient = toolkit.createComposite(scompo); sectionClient.setLayout(new GridLayout(2, false)); for (JRParameter p : prompts) if (p.isForPrompting() && !p.isSystemDefined()) createInput(toolkit, sectionClient, (JRDesignParameter) p); sectionClient.pack(); scompo.setMinSize(sectionClient.getSize()); scompo.setContent(sectionClient); ptab.setControl(scompo); } }
@Override public void mouseUp(final MouseEvent e) { // System.out.println("MOUSE up IN TAB FOLDER"); final CTabFolder folder = (CTabFolder) e.widget; final int x = e.x; final int y = e.y; for (final CTabItem item : folder.getItems()) { final Rectangle r = item.getBounds(); if (r.contains(x, y) && !item.equals(folder.getSelection())) { System.out.println("Detected problem in editors tab selection (see #2108). Fixed."); folder.setSelection(item); folder.update(); return; } } }
private void buildContents() { tabFolder = new CTabFolder(shell, SWT.TOP | SWT.NO_TRIM); tabFolder.setBorderVisible(true); tabFolder.setBackgroundMode(SWT.INHERIT_DEFAULT); tabFolder.setMRUVisible(true); tabFolder.setSimple(false); // rounded tabs tabFolder.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1)); final Map<String, Map<String, List<Pref>>> prefs = GamaPreferences.organizePrefs(); for (final String tabName : prefs.keySet()) { final CTabItem item = new CTabItem(tabFolder, SWT.NONE); item.setFont(GamaFonts.getNavigHeaderFont()); item.setText(tabName); item.setImage(prefs_images.get(tabName)); item.setShowClose(false); buildContentsFor(item, prefs.get(tabName)); } buildButtons(); shell.layout(); }
private void buildContentsFor(final CTabItem tab, final Map<String, List<Pref>> entries) { final ParameterExpandBar viewer = new ParameterExpandBar(tab.getParent(), SWT.V_SCROLL); contents.add(viewer); final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); viewer.setLayoutData(data); // ? viewer.computeSize(tab.getBounds().x, SWT.DEFAULT); // viewer.setSpacing(5); tab.setControl(viewer); for (final String groupName : entries.keySet()) { final ParameterExpandItem item = new ParameterExpandItem(viewer, entries.get(groupName), SWT.NONE, null); item.setText(groupName); item.setColor(new GamaColor(230, 230, 230, 255)); final Composite compo = new Composite(viewer, SWT.NONE); compo.setBackground(viewer.getBackground()); buildGroupContents(compo, entries.get(groupName), NB_DIVISIONS); item.setControl(compo); item.setHeight(compo.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); item.setExpanded(true); } }
@Test public void ctabFolderTest() { InteractiveTest.testCoat("Test coat mux layout behavior inside a CTabFolder.", cmp -> { Layouts.setGrid(cmp); CTabFolder folder = new CTabFolder(cmp, SWT.BORDER | SWT.CLOSE); Layouts.setGridData(folder).grabAll(); ToolBarManager manager = new ToolBarManager(); manager.add(Actions.create("Add", () -> { CTabItem item = new CTabItem(folder, SWT.NONE); item.setText("New control"); Composite parent = new Composite(folder, SWT.NONE); randomColorMux(parent); item.setControl(parent); item.addListener(SWT.Dispose, e -> item.getControl().dispose()); folder.setSelection(item); })); Layouts.setGridData(manager.createControl(cmp)).grabHorizontal(); }); }
@Override public Position toScreen(final Position localPosition, final IComponentCommon component) { final Control control; if (component.getUiReference() instanceof Control) { control = (Control) component.getUiReference(); } else if (component.getUiReference() instanceof CTabItem) { control = ((CTabItem) component.getUiReference()).getControl(); } else { throw new IllegalArgumentException("UiReference of component must be instance of '" + Control.class.getName() + "' or '" + CTabItem.class.getName() + "'"); } return PositionConvert.convert(control.toDisplay(PositionConvert.convert(localPosition))); }