List of usage examples for org.eclipse.jface.viewers ComboViewer ComboViewer
public ComboViewer(Composite parent, int style)
From source file:com.apicloud.navigator.dialogs.RunMobileDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite comp = (Composite) super.createDialogArea(parent); comp.setLayout(new GridLayout(1, false)); Composite composite = new Composite(comp, SWT.NONE); composite.setLayout(new GridLayout(1, false)); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); formToolkit.adapt(composite);// w ww . j ava 2 s . co m formToolkit.paintBordersFor(composite); Composite composite_1 = new Composite(composite, SWT.NONE); composite_1.setLayout(new GridLayout(1, false)); composite_1.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false, 1, 1)); formToolkit.adapt(composite_1); formToolkit.paintBordersFor(composite_1); Composite composite_6 = new Composite(composite_1, SWT.NONE); composite_6.setLayout(new GridLayout(2, false)); composite_6.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1)); composite_6.setBounds(0, 0, 64, 64); formToolkit.adapt(composite_6); formToolkit.paintBordersFor(composite_6); Label lblNewLabel_project = new Label(composite_6, SWT.NONE); lblNewLabel_project.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); formToolkit.adapt(lblNewLabel_project, true, true); lblNewLabel_project.setText(Messages.RunSimulatorDialog_PROJECT_NAME); this.list = new ComboViewer(composite_6, SWT.READ_ONLY); GridData gd_text1 = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_text1.widthHint = 181; this.list.getCombo().setLayoutData(gd_text1); this.list.setLabelProvider(new ProjectLabelProvider()); this.list.setContentProvider(new ArrayContentProvider()); this.list.setInput(projects); this.list.getCombo().select(0); formToolkit.adapt(list.getCombo(), true, true); return parent; }
From source file:com.apicloud.navigator.ui.wizards.TempleteFarmeWizardPage.java
License:Open Source License
/** * Create contents of the wizard./* w w w.ja v a 2 s.c o m*/ * @param parent */ public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); setControl(container); GridLayout gl_container = new GridLayout(3, false); gl_container.marginRight = 20; gl_container.marginHeight = 0; gl_container.marginLeft = 20; container.setLayout(gl_container); Composite composite = new Composite(container, SWT.NONE); composite.setLayout(new GridLayout(2, false)); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); Label lblNewLabel = new Label(composite, SWT.NONE); lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNewLabel.setText("\u6240\u5C5E\u9879\u76EE:"); this.list = new ComboViewer(composite, SWT.NONE | SWT.READ_ONLY); this.list.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); this.list.setLabelProvider(new ProjectLabelProvider()); this.list.setContentProvider(new ArrayContentProvider()); this.list.setInput(projects); this.list.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { StructuredSelection ss = (StructuredSelection) list.getSelection(); IProject p = (IProject) ss.getFirstElement(); project = p; selectProject(p); } }); Label lblNewLabel_1 = new Label(composite, SWT.NONE); lblNewLabel_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNewLabel_1.setText(Messages.PAGENAME); pageName = new Text(composite, SWT.BORDER); pageName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); pageName.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { setPageComplete(validatePage()); } }); Composite composite_4 = new Composite(container, SWT.NONE); GridData gd_composite_4 = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 2); gd_composite_4.widthHint = 20; composite_4.setLayoutData(gd_composite_4); Composite composite_1 = new Composite(container, SWT.NONE); composite_1.setLayout(new GridLayout(1, false)); GridData gd_composite_1 = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 2); gd_composite_1.widthHint = 240; gd_composite_1.heightHint = 480; composite_1.setLayoutData(gd_composite_1); lblNewLabel_3 = new Label(composite_1, SWT.NONE); lblNewLabel_3.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); lblNewLabel_3.setImage(AuthenticActivator.getImage(pages.get(0).getReViewImage())); Composite composite_2 = new Composite(container, SWT.NONE); composite_2.setLayout(new GridLayout(2, false)); composite_2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); Label lblNewLabel_2 = new Label(composite_2, SWT.NONE); lblNewLabel_2.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); lblNewLabel_2.setText(Messages.PAGEFREAWORK); Composite composite_3 = new Composite(composite_2, SWT.NONE); composite_3.setLayout(new GridLayout(1, false)); GridData gd_composite_3 = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); gd_composite_3.heightHint = 350; composite_3.setLayoutData(gd_composite_3); TableViewer UIViewer = createTable(composite_3); UIViewer.setInput(pages); UIViewer.setSelection(new StructuredSelection(pages.get(0))); new Label(container, SWT.NONE); page = pages.get(0); updateDate(); setPageComplete(validatePage()); }
From source file:com.appnativa.studio.wizards.ScreenSupport.java
License:Open Source License
/** * Create the composite.//from ww w .j ava 2 s . com * @param parent * @param style */ public ScreenSupport(Composite parent, int style) { super(parent, style); GridLayout gridLayout = new GridLayout(2, false); gridLayout.verticalSpacing = 2; gridLayout.marginWidth = 2; gridLayout.marginHeight = 2; gridLayout.horizontalSpacing = 2; setLayout(gridLayout); lblScreenSize = new Label(this, SWT.NONE); lblScreenSize.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); lblScreenSize.setText("Screen Size"); Label label = new Label(this, SWT.SEPARATOR | SWT.HORIZONTAL); label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); Label lblWHMax = new Label(this, SWT.NONE); lblWHMax.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblWHMax.setText("Max Landscape Pt Size:"); screenPointSize = new Text(this, SWT.BORDER); GridData gd_screenPointSize = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_screenPointSize.widthHint = 50; screenPointSize.setLayoutData(gd_screenPointSize); Label lblWorkspaceViewer = new Label(this, SWT.NONE); lblWorkspaceViewer.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblWorkspaceViewer.setText("Main Viewer:"); workspaceViewer = new ComboViewer(this, SWT.READ_ONLY); Combo combo = workspaceViewer.getCombo(); combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); workspaceViewer.setContentProvider(new ContentProvider()); workspaceViewer.setLabelProvider(new ViewLabelProvider()); workspaceViewer.setInput(""); //$NON-NLS-1$ selectTabPaneViewer(); lblBars = new Label(this, SWT.NONE); lblBars.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblBars.setText("Bars:"); Composite composite = new Composite(this, SWT.NONE); composite.setLayout(new FillLayout(SWT.HORIZONTAL)); btnActionBar = new Button(composite, SWT.CHECK); btnActionBar.setSelection(true); btnActionBar.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean b = btnActionBar.getSelection(); if (b) { btnMenuBar.setSelection(false); } btnShowTitle.setEnabled(b); } }); btnActionBar.setText("Action bar"); btnToolBar = new Button(composite, SWT.CHECK); btnToolBar.setSize(67, 18); btnToolBar.setText("Tool Bar"); btnStatusBar = new Button(composite, SWT.CHECK); btnStatusBar.setSize(76, 18); btnStatusBar.setText("Status Bar"); new Label(this, SWT.NONE); composite_1 = new Composite(this, SWT.NONE); composite_1.setLayout(new FillLayout(SWT.HORIZONTAL)); btnShowTitle = new Button(composite_1, SWT.CHECK); btnShowTitle.setSelection(true); btnShowTitle.setText("Show Application Title"); lblDesktopIconDensity = new Label(this, SWT.NONE); lblDesktopIconDensity.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblDesktopIconDensity.setText("Desktop Icon Density:"); iconDensity = new Combo(this, SWT.READ_ONLY); iconDensity.setItems(new String[] { "ldpi", "mdpi" }); GridData gd_iconDensity = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_iconDensity.widthHint = 50; iconDensity.setLayoutData(gd_iconDensity); iconDensity.select(0); new Label(this, SWT.NONE); btnMenuBar = new Button(this, SWT.CHECK); btnMenuBar.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (btnMenuBar.getSelection()) { btnActionBar.setSelection(false); } } }); btnMenuBar.setText("Desktop Menu Bar"); }
From source file:com.aptana.ide.syncing.ui.views.FTPManagerComposite.java
License:Open Source License
private Composite createSiteInfo(Composite parent) { Composite main = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(4, false); layout.marginHeight = 0;/*from ww w .j a v a 2s. c o m*/ layout.marginWidth = 0; main.setLayout(layout); Label label = new Label(main, SWT.NONE); label.setText(Messages.FTPManagerComposite_LBL_Sites); fSitesViewer = new ComboViewer(main, SWT.READ_ONLY); fSitesViewer.setContentProvider(ArrayContentProvider.getInstance()); fSitesViewer.setLabelProvider(new SitesLabelProvider()); fSitesViewer.setInput(SyncingPlugin.getSiteConnectionManager().getSiteConnections()); fSitesViewer.getControl().setLayoutData(GridDataFactory.swtDefaults().hint(250, SWT.DEFAULT).create()); fSitesViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { setSelectedSite((ISiteConnection) ((IStructuredSelection) event.getSelection()).getFirstElement()); } }); fEditButton = new Button(main, SWT.PUSH); fEditButton.setText(StringUtil.ellipsify(CoreStrings.EDIT)); fEditButton.setToolTipText(Messages.FTPManagerComposite_TTP_Edit); fEditButton.addSelectionListener(this); fSaveAsButton = new Button(main, SWT.PUSH); fSaveAsButton.setText(StringUtil.ellipsify(Messages.FTPManagerComposite_LBL_SaveAs)); fSaveAsButton.setToolTipText(Messages.FTPManagerComposite_TTP_SaveAs); fSaveAsButton.addSelectionListener(this); return main; }
From source file:com.aptana.jira.ui.internal.SubmitTicketDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite main = new Composite(parent, SWT.NONE); main.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).create()); main.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); Label separator = new Label(main, SWT.HORIZONTAL | SWT.SEPARATOR); separator.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create()); // adds control for login credentials userInfoProvider = new JiraPreferencePageProvider(); userInfoControl = userInfoProvider.createContents(main); userInfoControl.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create()); // issue type Label label = new Label(main, SWT.NONE); label.setText(StringUtil.makeFormLabel(Messages.SubmitTicketDialog_LBL_Type)); label.setLayoutData(GridDataFactory.swtDefaults().create()); typeCombo = new ComboViewer(main, SWT.DROP_DOWN | SWT.READ_ONLY); typeCombo.setContentProvider(ArrayContentProvider.getInstance()); typeCombo.setLabelProvider(new LabelProvider()); typeCombo.setInput(JiraIssueType.values()); typeCombo.getControl().setLayoutData(GridDataFactory.swtDefaults().create()); typeCombo.setSelection(new StructuredSelection(JiraIssueType.BUG)); ISelectionChangedListener listener = new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { validate();/* w ww. j a v a 2 s. c o m*/ } }; typeCombo.addSelectionChangedListener(listener); // FIXME Severity doesn't apply for Story in Studio tracker // severity label = new Label(main, SWT.NONE); label.setText(StringUtil.makeFormLabel(Messages.SubmitTicketDialog_LBL_Severity)); label.setLayoutData(GridDataFactory.swtDefaults().create()); severityCombo = new ComboViewer(main, SWT.DROP_DOWN | SWT.READ_ONLY); severityCombo.setContentProvider(ArrayContentProvider.getInstance()); severityCombo.setLabelProvider(new LabelProvider()); severityCombo.setInput(JiraIssueSeverity.values()); severityCombo.getControl().setLayoutData(GridDataFactory.swtDefaults().create()); severityCombo.setSelection(new StructuredSelection(JiraIssueSeverity.MINOR)); severityCombo.addSelectionChangedListener(listener); // summary label = new Label(main, SWT.NONE); label.setText(StringUtil.makeFormLabel(Messages.SubmitTicketDialog_LBL_Summary)); label.setLayoutData(GridDataFactory.swtDefaults().create()); summaryText = new Text(main, SWT.BORDER | SWT.SINGLE); summaryText.setLayoutData( GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create()); ModifyListener modifyListener = new ModifyListener() { public void modifyText(ModifyEvent e) { validate(); } }; summaryText.addModifyListener(modifyListener); // Steps to Reproduce label = new Label(main, SWT.NONE); label.setText(StringUtil.makeFormLabel(Messages.SubmitTicketDialog_LBL_StepsToReproduce)); label.setLayoutData(GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.BEGINNING).create()); reproduceText = new Text(main, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); reproduceText .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 100).create()); reproduceText.addModifyListener(modifyListener); TraverseListener traverseListener = new TraverseListener() { public void keyTraversed(TraverseEvent e) { e.doit = true; } }; reproduceText.addTraverseListener(traverseListener); // Actual Result label = new Label(main, SWT.NONE); label.setText(StringUtil.makeFormLabel(Messages.SubmitTicketDialog_LBL_ActualResult)); label.setLayoutData(GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.BEGINNING).create()); actualResultText = new Text(main, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); actualResultText .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 50).create()); actualResultText.addModifyListener(modifyListener); actualResultText.addTraverseListener(traverseListener); // Expected Result label = new Label(main, SWT.NONE); label.setText(StringUtil.makeFormLabel(Messages.SubmitTicketDialog_LBL_ExpectedResult)); label.setLayoutData(GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.BEGINNING).create()); expectedResultText = new Text(main, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); expectedResultText .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 50).create()); expectedResultText.addModifyListener(modifyListener); expectedResultText.addTraverseListener(traverseListener); // logs to attach label = new Label(main, SWT.NONE); label.setText(StringUtil.makeFormLabel(Messages.SubmitTicketDialog_LBL_LogsToAttach)); label.setLayoutData(GridDataFactory.swtDefaults().create()); Composite composite = new Composite(main, SWT.NONE); composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create()); composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); studioLogCheckbox = new Button(composite, SWT.CHECK); studioLogCheckbox.setText(Messages.SubmitTicketDialog_LBL_StudioLog); studioLogCheckbox.setSelection(true); diagnosticLogCheckbox = new Button(composite, SWT.CHECK); diagnosticLogCheckbox.setText(Messages.SubmitTicketDialog_LBL_DiagnosticLog); diagnosticLogCheckbox.setSelection(true); // screenshots label = new Label(main, SWT.NONE); label.setText(StringUtil.makeFormLabel(Messages.SubmitTicketDialog_LBL_Screenshots)); label.setLayoutData(GridDataFactory.swtDefaults().create()); composite = new Composite(main, SWT.NONE); composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create()); composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); screenshotText = new Text(composite, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY); screenshotText.setLayoutData( GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create()); screenshotText.addMouseListener(new MouseListener() { public void mouseUp(MouseEvent e) { browse(); } public void mouseDown(MouseEvent e) { } public void mouseDoubleClick(MouseEvent e) { } }); browseButton = new Button(composite, SWT.PUSH); browseButton.setText(StringUtil.ellipsify(CoreStrings.BROWSE)); browseButton.setLayoutData(GridDataFactory.swtDefaults().create()); browseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { browse(); } }); // the list of selected screenshots label = new Label(main, SWT.NONE); label.setLayoutData(GridDataFactory.swtDefaults().create()); screenshotsComposite = new Composite(main, SWT.NONE); screenshotsComposite.setLayout(GridLayoutFactory.fillDefaults().spacing(0, 0).create()); screenshotsComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); // a progress bar for when validating the login progressMonitorPart = new ProgressMonitorPart(main, GridLayoutFactory.fillDefaults().create()); progressMonitorPart .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).exclude(true).span(2, 1).create()); userInfoProvider.setProgressMonitor(progressMonitorPart); userInfoProvider.addValidationListener(new IAccountPageProvider.IValidationListener() { public void preValidationStart() { setUILocked(true); progressMonitorPart.setVisible(true); ((GridData) progressMonitorPart.getLayoutData()).exclude = false; layoutShell(); } public void postValidationEnd() { setUILocked(false); if (!progressMonitorPart.isDisposed()) { progressMonitorPart.setVisible(false); ((GridData) progressMonitorPart.getLayoutData()).exclude = true; layoutShell(); } } }); setTitle(Messages.SubmitTicketDialog_Title); setTitleImage(SWTUtils.getImage(JiraUIPlugin.getDefault(), IMAGE_PATH)); setMessage(Messages.SubmitTicketDialog_DefaultMessage); return main; }
From source file:com.aptana.js.debug.ui.internal.launchConfigurations.LaunchBrowserSettingsTab.java
License:Open Source License
private void createServerSection(Composite parent) { Group group = new Group(parent, SWT.FLAT); group.setText(Messages.LaunchBrowserSettingsTab_Server); group.setFont(parent.getFont());// w w w.j a v a2 s . c om group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); group.setLayout(GridLayoutFactory.swtDefaults().numColumns(3).margins(10, 3).create()); rbInternalServer = new Button(group, SWT.RADIO); rbInternalServer.setText(Messages.LaunchBrowserSettingsTab_UseBuiltInWebServer); rbInternalServer.setLayoutData(GridDataFactory.fillDefaults().span(3, 1).create()); rbManagedServer = new Button(group, SWT.RADIO); rbManagedServer.setText(Messages.LaunchBrowserSettingsTab_Use_Selected_Server); rbManagedServer.setLayoutData(GridDataFactory.fillDefaults().create()); managedServersView = new ComboViewer(group, SWT.DROP_DOWN | SWT.READ_ONLY); managedServersView.getControl().setLayoutData( GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create()); managedServersView.setContentProvider(ArrayContentProvider.getInstance()); managedServersView.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof IServer) { return ((IServer) element).getName(); } return super.getText(element); } }); managedServersView.setInput(WebServerCorePlugin.getDefault().getServerManager().getServers()); Link configureLink = new Link(group, SWT.NONE); configureLink .setText(MessageFormat.format("<a>{0}</a>", Messages.LaunchBrowserSettingsTab_Configure_Label)); //$NON-NLS-1$ configureLink.setLayoutData(GridDataFactory.swtDefaults().create()); configureLink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(UIUtils.getActiveShell(), IWebServerUIConstants.WEBSERVERS_PREFERENCE_PAGE_ID, new String[] { IWebServerUIConstants.WEBSERVERS_PREFERENCE_PAGE_ID }, null, PreferencesUtil.OPTION_FILTER_LOCKED); dlg.open(); ISelection selection = managedServersView.getSelection(); managedServersView.setInput(WebServerCorePlugin.getDefault().getServerManager().getServers()); managedServersView.setSelection(selection); } }); rbCustomServer = new Button(group, SWT.RADIO); rbCustomServer.setText(Messages.LaunchBrowserSettingsTab_UseExternalWebServer); rbCustomServer.setLayoutData(GridDataFactory.fillDefaults().create()); fbaseUrlText = new Text(group, SWT.SINGLE | SWT.BORDER); fbaseUrlText.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, false).create()); fAddProjectName = new Button(group, SWT.CHECK); fAddProjectName.setText(Messages.LaunchBrowserSettingsTab_AppendProjectName); fAddProjectName.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(3, 1).create()); }
From source file:com.aptana.preview.ui.properties.PreviewSettingComposite.java
License:Open Source License
/** * The constructor./*from w w w. j a va 2 s .co m*/ * * @param parent * the parent composite */ public PreviewSettingComposite(Composite parent) { super(parent, SWT.NONE); setLayout(GridLayoutFactory.fillDefaults().spacing(5, 0).numColumns(3).create()); fListeners = new LinkedHashSet<Listener>(); fServersCombo = new ComboViewer(this, SWT.DROP_DOWN | SWT.READ_ONLY); fServersCombo.getControl().setLayoutData( GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create()); fServersCombo.setContentProvider(ArrayContentProvider.getInstance()); fServersCombo.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof IServer) { return ((IServer) element).getName(); } return super.getText(element); } }); fServersCombo.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updateStates(); firePreviewSettingModified(); } }); fEditButton = new Button(this, SWT.PUSH); fEditButton.setText(StringUtil.ellipsify(CoreStrings.EDIT)); fEditButton.setLayoutData( GridDataFactory.swtDefaults().hint(getButtonWidthHint(fEditButton), SWT.DEFAULT).create()); fEditButton.addSelectionListener(this); fNewButton = new Button(this, SWT.PUSH); fNewButton.setText(StringUtil.ellipsify(CoreStrings.NEW)); fNewButton.setLayoutData( GridDataFactory.swtDefaults().hint(getButtonWidthHint(fNewButton), SWT.DEFAULT).create()); fNewButton.addSelectionListener(this); updateServersContentJob(); }
From source file:com.bdaum.juploadr.uploadapi.smugrest.ui.AlbumPolicyDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite area = (Composite) super.createDialogArea(parent); albumGroup = new RadioButtonGroup(area, null, SWT.NONE, Messages.AlbumPolicyDialog_select_by_local_album, Messages.AlbumPolicyDialog_use_default_target_album); albumGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Composite viewerGroup = new Composite(area, SWT.NONE); viewerGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); viewerGroup.setLayout(new GridLayout(2, false)); new Label(viewerGroup, SWT.NONE).setText(Messages.AlbumPolicyDialog_default_album); viewer = new ComboViewer(viewerGroup, SWT.READ_ONLY); viewer.setContentProvider(ArrayContentProvider.getInstance()); viewer.setLabelProvider(new ZColumnLabelProvider() { @Override//w ww . j a v a 2 s.c o m public String getText(Object element) { if (element instanceof PhotoSet) return ((PhotoSet) element).getTitle(); return element.toString(); } }); viewer.setComparator(ZViewerComparator.INSTANCE); viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updateButtons(); } }); viewer.setInput(session.getAccount().getPhotosets()); return area; }
From source file:com.bdaum.zoom.ai.clarifai.internal.preference.PagePart.java
License:Open Source License
@SuppressWarnings("unused") @Override/*from ww w.j a va 2 s . c o m*/ public Control createPageContents(Composite parent, AbstractPreferencePage parentPage) { this.parentPage = (AiPreferencePage) parentPage; Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); composite.setLayout(new GridLayout(1, false)); ((GridLayout) composite.getLayout()).verticalSpacing = 0; new Label(composite, SWT.NONE).setText(Messages.PagePart_manage_clarifai_account); new Label(composite, SWT.NONE); CGroup eGroup = UiUtilities.createGroup(composite, 2, Messages.PagePart_credentials); new Label(eGroup, SWT.NONE).setText(Messages.PagePart_client_id); clientIdField = new Text(eGroup, SWT.SINGLE | SWT.LEAD | SWT.BORDER); clientIdField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); new Label(eGroup, SWT.NONE).setText(Messages.PagePart_secret); clientSecretField = new Text(eGroup, SWT.SINGLE | SWT.LEAD | SWT.BORDER); clientSecretField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); clientIdField.addModifyListener(this); clientSecretField.addModifyListener(this); new Label(eGroup, SWT.NONE).setText(Messages.PagePart_access_token); statusField = new Label(eGroup, SWT.NONE); statusField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); CLink link = new CLink(eGroup, SWT.NONE); link.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); link.setText(Messages.PagePart_visit_account_page); link.addListener(new Listener() { @Override public void handleEvent(Event event) { String vlcDownload = System.getProperty("com.bdaum.zoom.clarifai"); //$NON-NLS-1$ try { PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser() .openURL(new URL(vlcDownload)); } catch (PartInitException e1) { // do nothing } catch (MalformedURLException e1) { // should never happen } } }); CGroup tGroup = CGroup.create(composite, 1, Messages.PagePart_limits); new Label(tGroup, SWT.NONE).setText(Messages.PagePart_model); modelCombo = new ComboViewer(tGroup, SWT.READ_ONLY); modelCombo.getControl().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); modelCombo.setContentProvider(ArrayContentProvider.getInstance()); modelCombo.setLabelProvider(new LabelProvider()); modelCombo.setComparator(ZViewerComparator.INSTANCE); modelCombo.setInput(CoreActivator.getDefault().getThemes().values()); ISelectionChangedListener listener = new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { if (!updating) updateButtons(); } }; modelCombo.addSelectionChangedListener(listener); new Label(tGroup, SWT.NONE).setText(Messages.PagePart_language); languageCombo = new ComboViewer(tGroup, SWT.READ_ONLY); languageCombo.getControl().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); languageCombo.setContentProvider(ArrayContentProvider.getInstance()); languageCombo.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof String) { Locale loc = new Locale((String) element); return loc.getDisplayLanguage(loc); } return super.getText(element); } }); languageCombo.addSelectionChangedListener(listener); languageCombo.setInput(ClarifaiActivator.LANGUAGES); new Label(tGroup, SWT.NONE).setText(Messages.PagePart_max_concepts); conceptField = new NumericControl(tGroup, SWT.BORDER); conceptField.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false)); conceptField.setMaximum(20); conceptField.setMinimum(1); new Label(tGroup, SWT.NONE).setText(Messages.PagePart_min_confidence); confidenceField = new NumericControl(tGroup, SWT.BORDER); confidenceField.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false)); confidenceField.setMaximum(99); confidenceField.setMinimum(0); new Label(tGroup, SWT.NONE).setText(Messages.PagePart_mark_above); aboveField = new NumericControl(tGroup, SWT.BORDER); aboveField.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false)); aboveField.setMaximum(100); aboveField.setMinimum(0); knownButton = WidgetFactory.createCheckButton(tGroup, Messages.PagePart_mark_known, new GridData(SWT.END, SWT.CENTER, false, false, 2, 1), Messages.PagePart_mark_known_tooltip); Composite buttonArea1 = new Composite(tGroup, SWT.NONE); buttonArea1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); buttonArea1.setLayout(new GridLayout(3, false)); adultButton = WidgetFactory.createCheckButton(buttonArea1, Messages.PagePart_check_adult, new GridData(SWT.BEGINNING, SWT.CENTER, false, false), Messages.PagePart_porno); faceButton = WidgetFactory.createCheckButton(buttonArea1, Messages.PagePart_detect_faces, null, Messages.PagePart_detect_faces_tooltip); celebrityButton = WidgetFactory.createCheckButton(buttonArea1, Messages.PagePart_detect_celebrities, null, Messages.PagePart_detect_celebrities_tooltip); Label sep = new Label(tGroup, SWT.SEPARATOR | SWT.HORIZONTAL); sep.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); translateButton = WidgetFactory.createCheckButton(tGroup, Messages.PagePart_translate, new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 2, 1), Messages.PagePart_translate_tooltip); return composite; }
From source file:com.bdaum.zoom.ai.internal.preference.AiPreferencePage.java
License:Open Source License
@SuppressWarnings("unused") @Override//from w w w . j av a 2s .c o m protected void createPageContents(Composite composite) { setHelp(HelpContextIds.PREFERENCE_PAGE); enableButton = WidgetFactory.createCheckButton(composite, Messages.AiPreferencePage_enable, null); enableButton.addListener(new Listener() { @Override public void handleEvent(Event event) { setEnabled(enableButton.getSelection()); updateFields(); } }); // Tab folder createTabFolder(composite, "Services"); //$NON-NLS-1$ createExtensions(tabFolder, "com.bdaum.zoom.ai.aiPrefPage"); //$NON-NLS-1$ String label = getPreferenceStore().getString(PreferenceConstants.ACTIVEPROVIDER); boolean tabinit = false; if (label != null) { int i = 0; for (CTabItem item : tabFolder.getItems()) { if (label.equals(item.getText().trim())) { tabFolder.setSelection(i); tabinit = true; break; } ++i; } } new Label(composite, SWT.NONE); // Translator CGroup eGroup = UiUtilities.createGroup(composite, 3, Messages.AiPreferencePage_0); new Label(eGroup, SWT.NONE).setText(Messages.AiPreferencePage_key1_or_key2); keyField = new Text(eGroup, SWT.SINGLE | SWT.LEAD | SWT.BORDER); keyField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); keyField.addModifyListener(this); new Label(eGroup, SWT.NONE).setText(Messages.AiPreferencePage_status); statusField = new Label(eGroup, SWT.WRAP); statusField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); new Label(eGroup, SWT.NONE).setText(Messages.AiPreferencePage_translate_to); languageViewer = new ComboViewer(eGroup, SWT.READ_ONLY); GridData data = new GridData(SWT.BEGINNING, SWT.CENTER, false, false); data.widthHint = 120; languageViewer.getCombo().setLayoutData(data); languageViewer.setContentProvider(ArrayContentProvider.getInstance()); languageViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof Locale) return ((Locale) element).getDisplayLanguage(); return super.getText(element); } }); languageViewer.getCombo().setVisibleItemCount(20); CLink link = new CLink(eGroup, SWT.NONE); link.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false)); link.setText(Messages.AiPreferencePage_visit_account); link.addListener(new Listener() { @Override public void handleEvent(Event event) { String url = System.getProperty("com.bdaum.zoom.msTranslation"); //$NON-NLS-1$ try { PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL(url)); } catch (PartInitException e1) { // do nothing } catch (MalformedURLException e1) { // should never happen } } }); if (!tabinit) initTabFolder(0); fillValues(); setEnabled(enableButton.getSelection()); updateButtons(); }