List of usage examples for org.eclipse.jface.viewers StructuredSelection StructuredSelection
public StructuredSelection(List elements)
List
. From source file:com.apicloud.navigator.dialogs.CreateFeatureDialog.java
License:Open Source License
@Override protected void buttonPressed(int buttonId) { setErrorMessage(null);//from ww w .j a va 2s .c o m if (buttonId == IDialogConstants.OK_ID) { if ("".equals(this.featureNameText.getText())) { //$NON-NLS-1$ setErrorMessage(Messages.CreateFeatureDialog_FEATURE_NMAE_NOT_NULL); return; } for (Feature feature : config.getFeatures()) { if (feature.getName().equals(this.featureNameText.getText())) { setErrorMessage(Messages.CreateFeatureDialog_FEATURE_NAME_DUP); return; } } feature = new Feature(); feature.setName(this.featureNameText.getText()); config.addFeature(feature); TreeNode node = new TreeNode(feature); treeViewer.setInput(config.createTreeNode()); treeViewer.collapseAll(); StructuredSelection selection = new StructuredSelection(node); treeViewer.setSelection(selection, true); treeViewer.refresh(); editor.setDirty(true); editor.change(); } super.buttonPressed(buttonId); }
From source file:com.apicloud.navigator.dialogs.CreateParamDialog.java
License:Open Source License
@Override protected void buttonPressed(int buttonId) { setErrorMessage(null);/*w w w . j a v a2s.c o m*/ if (buttonId == IDialogConstants.OK_ID) { if ("".equals(this.paramNameText.getText())) { //$NON-NLS-1$ setErrorMessage("param\u540D\u4E0D\u80FD\u4E3A\u7A7A"); //$NON-NLS-1$ return; } if ("".equals(this.paramValueText.getText())) { //$NON-NLS-1$ setErrorMessage("param\u503C\u4E0D\u80FD\u4E3A\u7A7A"); //$NON-NLS-1$ return; } StructuredSelection ss = (StructuredSelection) list.getSelection(); Feature feature = (Feature) ss.getFirstElement(); for (Param param : feature.getParams()) { if (param.getName().equals(this.paramNameText.getText())) { setErrorMessage(Messages.PARAMNAMEREPEAT); //$NON-NLS-1$ return; } } Param p = new Param(); p.setName(this.paramNameText.getText()); p.setValue(this.paramValueText.getText()); feature.addParams(p); TreeNode node = new TreeNode(p); node.setParent(new TreeNode(feature)); treeViewer.setInput(config.createTreeNode()); treeViewer.collapseAll(); StructuredSelection selection = new StructuredSelection(node); treeViewer.setSelection(selection, true); treeViewer.refresh(); editor.setDirty(true); editor.change(); } super.buttonPressed(buttonId); }
From source file:com.apicloud.navigator.ui.wizards.TempleteFarmeWizardPage.java
License:Open Source License
/** * Create contents of the wizard./*from www. j av a 2s . 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.apicloud.navigator.ui.wizards.TempleteFarmeWizardPage.java
License:Open Source License
private void updateDate() { if ((this.selection != null) && (!(this.selection.isEmpty())) && (this.selection instanceof IStructuredSelection)) { IStructuredSelection ssel = (IStructuredSelection) this.selection; if (ssel.size() > 1) return; Object obj = ssel.getFirstElement(); if (obj instanceof IResource) { IResource res = (IResource) obj; project = res.getProject();/*from www. ja v a2 s . c om*/ } } if (project != null) { this.list.setSelection(new StructuredSelection(project)); } }
From source file:com.appcelerator.titanium.desktop.ui.wizard.NewDesktopProjectCreationPage.java
License:Apache License
@Override public void createControl(Composite parent) { super.createControl(parent); Composite group = createCommonControls(parent); // Loads the SDK versions sdkViewer.setInput(TitaniumDesktopSDKLocator.getInstance().getAvailable()); SDKEntity selection = null;//from w ww .j ava 2s. c om // Load the saved setting for the Titanium Desktop SDK and set it as the selected one (in case we still have it // available in the combo) IDialogSettings dialogSettings = getDialogSettings(); if (dialogSettings != null) { selection = TitaniumDesktopSDKLocator.getInstance() .findVersion(String.valueOf(dialogSettings.get(TITANIUM_SDK_SETTING))); } if (selection == null) { selection = TitaniumDesktopSDKLocator.getInstance().getLatestVersion(); } if (selection != null) { sdkViewer.setSelection(new StructuredSelection(selection)); } // Add the platform selection buttons according to what is available Label deploymentLabel = new Label(group, SWT.NONE); deploymentLabel.setText(Messages.NewDesktopProjectCreationPage_languageModules); Composite platformsComposite = new Composite(group, SWT.NONE); platformsComposite.setLayout(new GridLayout(3, true)); GridData gd = new GridData(GridData.FILL); platformsComposite.setLayoutData(gd); rubyButton = new Button(platformsComposite, SWT.CHECK); rubyButton.setText("Ruby"); //$NON-NLS-1$ pythonButton = new Button(platformsComposite, SWT.CHECK); pythonButton.setText("Python"); //$NON-NLS-1$ phpButton = new Button(platformsComposite, SWT.CHECK); phpButton.setText("PHP"); //$NON-NLS-1$ Control control = getControl(); Dialog.applyDialogFont(control); setControl(control); }
From source file:com.appcelerator.titanium.desktop.ui.wizard.PackageHandler.java
License:Apache License
public Object execute(ExecutionEvent event) throws ExecutionException { ITitaniumUser user = TitaniumCorePlugin.getDefault().getUserManager().getSignedInUser(); if (user == null) { // Force the login! // TODO Make it easy for user to sign in from here! MessageDialog.openError(UIUtils.getActiveShell(), Messages.PackageHandler_LoginTitle, Messages.PackageHandler_LoginMessage); return null; }//from w w w. j a va 2 s.co m DistributeDesktopWizard wizard = new DistributeDesktopWizard(); WizardDialog dialog = new WizardDialog(UIUtils.getActiveShell(), wizard); dialog.setPageSize(400, 300); IResource selectedResource = UIUtils .getSelectedResource((IEvaluationContext) event.getApplicationContext()); if (selectedResource != null) { wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(selectedResource)); } dialog.open(); return null; }
From source file:com.appnativa.studio.properties.PropertySheetViewer.java
License:Open Source License
/** * The <code>PropertySheetViewer</code> implementation of this * <code>ISelectionProvider</code> method returns the result as a * <code>StructuredSelection</code>. * <p>//from www . j a va 2 s. c om * Note that this method only includes <code>IPropertySheetEntry</code> in * the selection (no categories). * </p> */ public ISelection getSelection() { if (tree.getSelectionCount() == 0) { return StructuredSelection.EMPTY; } TreeItem[] sel = tree.getSelection(); List entries = new ArrayList(sel.length); for (int i = 0; i < sel.length; i++) { TreeItem ti = sel[i]; Object data = ti.getData(); if (data instanceof IPropertySheetEntry) { entries.add(data); } } return new StructuredSelection(entries); }
From source file:com.appnativa.studio.RMLDocument.java
License:Open Source License
public void updateSelections() { List<Widget> sels = (designPane == null) ? null : designPane.getSelectedWidgetConfigs(); StructuredSelection s;/* w w w .ja v a2 s . c om*/ final int count = (sels == null) ? 0 : sels.size(); WidgetAdaptable[] a; WidgetAdaptable wa; if (count == 0) { s = emptySelection; a = emptyWSelection; } else if (count == 1) { s = new StructuredSelection(wa = new WidgetAdaptable(this, sels.get(0))); a = new WidgetAdaptable[] { wa }; } else { int len = sels.size(); a = new WidgetAdaptable[len]; for (int i = 0; i < len; i++) { a[i] = new WidgetAdaptable(this, sels.get(i)); } s = new StructuredSelection(Arrays.asList(a)); } fireSelectionChanged(s, a); }
From source file:com.appnativa.studio.wizards.ScreenSupport.java
License:Open Source License
private void selectTabPaneViewer() { int len = workspaceViewer.getCombo().getItemCount(); for (int i = 0; i < len; i++) { Node node = (Node) workspaceViewer.getElementAt(i); if (node.id.equals("Studio.icon.toolbox.tabpane")) { workspaceViewer.setSelection(new StructuredSelection(node)); }/*from w ww. ja v a 2 s. c o m*/ } }
From source file:com.aptana.deploy.ftp.FTPDeployProvider.java
License:Open Source License
public void deploy(IContainer selectedContainer, IProgressMonitor monitor) { SynchronizeProjectAction action = new SynchronizeProjectAction(); action.setActivePart(null, UIUtils.getActivePart()); action.setSelection(new StructuredSelection(selectedContainer)); ISiteConnection[] sites = SiteConnectionUtils.findSitesForSource(selectedContainer, true); if (sites.length > 1) { String lastConnection = ResourceSynchronizationUtils.getLastSyncConnection(selectedContainer); if (lastConnection == null) { lastConnection = DeployPreferenceUtil.getDeployEndpoint(selectedContainer); }//from w ww .ja v a 2 s . c om if (lastConnection != null) { action.setSelectedSite(SiteConnectionUtils.getSiteWithDestination(lastConnection, sites)); } } action.run(null); }