List of usage examples for org.eclipse.jface.viewers IStructuredSelection size
public int size();
From source file:com.nokia.tools.variant.confml.ui.dialogs.LayerSelectionDialog.java
License:Open Source License
public void setFilterText(String filterText) { IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); if (!selection.isEmpty() && selection.getFirstElement() instanceof EConfMLLayer) { EObject container = (EObject) selection.getFirstElement(); while (container != null && !(container instanceof EConfigurationProject)) { container = container.eContainer(); }//from w ww.ja v a 2 s . c o m selection = new StructuredSelection(container); } if (!(selection.size() > 0 && (new Path(filterText)).segment(0) != null && ((LabelProvider) viewer.getLabelProvider()).getText(selection.getFirstElement()).toLowerCase() .contains((new Path(filterText)).segment(0).toString().toLowerCase()))) { this.filterText = filterText; viewer.refresh(); // if (!filterText.trim().equals("") &&!filterText.equals(TYPE_FILTER_TEXT)) { // viewer.expandAll(); // } } }
From source file:com.nokia.tools.variant.resourcelibrary.actions.CreateFolderAction.java
License:Open Source License
@Override protected boolean updateSelection(IStructuredSelection selection) { if (selection.isEmpty()) { // creating in root return true; }// w ww. j a v a 2 s .c o m if (selection.size() != 1) { return false; } ResourceStorage rs = (ResourceStorage) selection.getFirstElement(); if (!(rs.getFileSystemElement() instanceof Directory)) { return false; } return true; }
From source file:com.nokia.tools.variant.resourcelibrary.actions.ImportResourceAction.java
License:Open Source License
@Override protected boolean updateSelection(IStructuredSelection selection) { return selection.isEmpty() || selection.size() == 1; }
From source file:com.nokia.tools.variant.resourcelibrary.actions.OpenEditorAction.java
License:Open Source License
@Override protected boolean updateSelection(IStructuredSelection selection) { if (selection.size() != 1) { return false; }/* ww w . jav a2 s .c o m*/ FileSystemElement fse = ((ResourceStorage) selection.getFirstElement()).getFileSystemElement(); if (fse instanceof Directory) { return false; } return true; }
From source file:com.nokia.tools.variant.resourcelibrary.actions.RenameResourceAction.java
License:Open Source License
@Override protected boolean updateSelection(IStructuredSelection selection) { if (selection.size() != 1) { return false; }/*from w w w.j a va2s .c om*/ FileSystemElement fse = ((ResourceStorage) selection.getFirstElement()).getFileSystemElement(); if (ResourceLibraryCommandHelper.checkModifyStatus(fse) != ResourceLibraryCommandHelper.STATUS_OK || fse.touchedByReadonlySetting()) { return false; } return true; }
From source file:com.opcoach.e4.contextExplorer.parts.ContextExplorerPart.java
License:Open Source License
/** * Create contents of the view part.//from w w w . j a v a2 s.c o m */ @PostConstruct public void createControls(Composite parent, MApplication a, IEclipseContext ctx) { parent.setLayout(new GridLayout(1, false)); final Composite comp = new Composite(parent, SWT.NONE); comp.setLayout(new GridLayout(5, false)); Button expandAll = new Button(comp, SWT.FLAT); expandAll.setImage(imgReg.get("expandall")); expandAll.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { tv.expandAll(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); Button collapseAll = new Button(comp, SWT.FLAT); collapseAll.setImage(imgReg.get("collapseall")); collapseAll.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { tv.collapseAll(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); // Do the search widget final Text text = new Text(comp, SWT.SEARCH | SWT.ICON_SEARCH); GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).applyTo(text); text.setMessage("Search data"); text.setToolTipText("Highlight the contexts where contained objects match this string pattern"); text.addKeyListener(new KeyListener() { @Override public void keyReleased(KeyEvent e) { contextRegistry.setPattern(text.getText()); tv.refresh(true); contentTable.refresh(true); } @Override public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub } }); final Button ignoreCase = new Button(comp, SWT.CHECK); ignoreCase.setText("Ignore case"); ignoreCase.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { contextRegistry.setIgnoreCase(ignoreCase.getSelection()); tv.refresh(true); contentTable.refresh(true); } }); final Button ignoreWildCards = new Button(comp, SWT.CHECK); ignoreWildCards.setText("Ignore WildCards"); ignoreWildCards.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { contextRegistry.setIgnoreWildCards(ignoreWildCards.getSelection()); tv.refresh(true); contentTable.refresh(true); } }); SashForm sashForm = new SashForm(parent, SWT.VERTICAL); sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // TreeViewer on the top tv = new TreeViewer(sashForm); treeContentProvider = ContextInjectionFactory.make(ContextTreeProvider.class, ctx); tv.setContentProvider(treeContentProvider); tv.setLabelProvider(treeContentProvider); // tv.setInput(a); tv.setInput(getAllBundleContexts()); tv.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection ss = (IStructuredSelection) event.getSelection(); selService.setSelection((ss.size() == 1) ? ss.getFirstElement() : ss.toArray()); } }); createContextContentTable(a, sashForm, ctx); // Set the correct weight for sahsform sashForm.setWeights(new int[] { 15, 85 }); // Open all the tree tv.expandAll(); }
From source file:com.openlegacy.enterprise.ide.eclipse.editors.pages.details.jpa.FieldsJpaManyToOneFieldDetailsPage.java
License:Open Source License
@Override protected void selectionChanged(IStructuredSelection selection) { if (selection.size() == 1) { fieldModel = (JpaManyToOneFieldModel) selection.getFirstElement(); } else {//w w w . j av a 2 s . co m fieldModel = null; } }
From source file:com.openlegacy.enterprise.ide.eclipse.editors.pages.details.jpa.GeneralJpaNavigationDetailsPage.java
License:Open Source License
@Override protected void selectionChanged(IStructuredSelection selection) { if (selection.size() == 1) { navigationModel = (JpaNavigationModel) selection.getFirstElement(); } else {/*from w w w . j av a 2s . c o m*/ navigationModel = null; } }
From source file:com.openlegacy.enterprise.ide.eclipse.editors.pages.details.rpc.FieldsRpcDateFieldDetailsPage.java
License:Open Source License
@Override protected void selectionChanged(IStructuredSelection selection) { if (selection.size() == 1) { fieldModel = (RpcDateFieldModel) selection.getFirstElement(); } else {/*from w w w .j a va 2 s. co m*/ fieldModel = null; } }
From source file:com.openlegacy.enterprise.ide.eclipse.editors.pages.details.rpc.FieldsRpcEnumFieldDetailsPage.java
License:Open Source License
@Override protected void selectionChanged(IStructuredSelection selection) { if (selection.size() == 1) { fieldModel = (RpcEnumFieldModel) selection.getFirstElement(); } else {//from w w w. j a v a 2s . c o m fieldModel = null; } }