List of usage examples for org.eclipse.jface.viewers StructuredSelection EMPTY
StructuredSelection EMPTY
To view the source code for org.eclipse.jface.viewers StructuredSelection EMPTY.
Click Source Link
From source file:com.salesforce.ide.ui.actions.BaseAction.java
License:Open Source License
@SuppressWarnings("unchecked") public void selectionChanged(IAction action, ISelection selection) { if (selection instanceof IStructuredSelection) { setSelection(selection);// w w w .j av a2 s.c o m } else { this.selection = StructuredSelection.EMPTY; } if (actionController != null) { actionController.setSelection(selection); } if (selection instanceof IStructuredSelection && !selection.isEmpty()) { List<IResource> selectedResources = new ArrayList<IResource>(); for (Iterator iterator = ((IStructuredSelection) selection).iterator(); iterator.hasNext();) { Object selectedObject = iterator.next(); if (!(selectedObject instanceof IResource)) { continue; } IResource selectedResource = (IResource) selectedObject; selectedResources.add(selectedResource); project = selectedResource.getProject(); } this.selectedResources = filter(selectedResources); if (actionController != null) { actionController.setProject(project); actionController.setSelectedResources(this.selectedResources, false); } } }
From source file:com.salesforce.ide.ui.actions.OpenNewComponentWizardToolbarAction.java
License:Open Source License
@Override public void selectionChanged(IAction action, ISelection selection) { if (selection instanceof IStructuredSelection) { setSelection(selection);/*from ww w. j a va 2 s . c om*/ } else { setSelection(StructuredSelection.EMPTY); } }
From source file:com.siteview.mde.internal.ui.editor.FormOutlinePage.java
License:Open Source License
public ISelection getSelection() { if (fTreeViewer == null) return StructuredSelection.EMPTY; return fTreeViewer.getSelection(); }
From source file:com.siteview.mde.internal.ui.editor.MDESourcePage.java
License:Open Source License
/** * @param rangeElement/*from w w w .j a v a2 s . co m*/ */ protected void updateOutlinePageSelection(Object rangeElement) { // Set selection in source outline page if the 'Link with Editor' // feature is on if (MDEPlugin.getDefault().getPreferenceStore().getBoolean("ToggleLinkWithEditorAction.isChecked")) { //$NON-NLS-1$ // Ensure we have a source outline page if ((fOutlinePage instanceof SourceOutlinePage) == false) { return; } SourceOutlinePage outlinePage = (SourceOutlinePage) fOutlinePage; // Temporarily remove the listener to prevent a selection event being fired // back at this page outlinePage.removeAllSelectionChangedListeners(); if (rangeElement != null) { outlinePage.setSelection(new StructuredSelection(rangeElement)); } else { outlinePage.setSelection(StructuredSelection.EMPTY); } outlinePage.addAllSelectionChangedListeners(); } }
From source file:com.siteview.mde.internal.ui.editor.outline.QuickOutlinePopupDialog.java
License:Open Source License
/** * Selects the first element in the tree which * matches the current filter pattern./*from ww w . ja va 2s . c o m*/ */ private void selectFirstMatch() { Tree tree = fTreeViewer.getTree(); Object element = findFirstMatchToPattern(tree.getItems()); if (element != null) { fTreeViewer.setSelection(new StructuredSelection(element), true); } else { fTreeViewer.setSelection(StructuredSelection.EMPTY); } }
From source file:com.siteview.mde.internal.ui.editor.schema.NewClassCreationWizard.java
License:Open Source License
public void addPages() { if (fIsInterface) fMainPage = new NewInterfaceWizardPage(); else/*from w ww .j a va 2 s .c o m*/ fMainPage = new NewClassWizardPage(); addPage(fMainPage); if (fIsInterface) { ((NewInterfaceWizardPage) fMainPage).init(StructuredSelection.EMPTY); if (className != null) ((NewInterfaceWizardPage) fMainPage).setTypeName(className, true); if (packageRoot != null) ((NewInterfaceWizardPage) fMainPage).setPackageFragmentRoot(packageRoot, true); if (packageName != null) ((NewInterfaceWizardPage) fMainPage).setPackageFragment(packageName, true); } else { ((NewClassWizardPage) fMainPage).init(StructuredSelection.EMPTY); if (className != null) ((NewClassWizardPage) fMainPage).setTypeName(className, true); if (packageRoot != null) ((NewClassWizardPage) fMainPage).setPackageFragmentRoot(packageRoot, true); if (packageName != null) ((NewClassWizardPage) fMainPage).setPackageFragment(packageName, true); } }
From source file:com.siteview.mde.internal.ui.launcher.AbstractPluginBlock.java
License:Open Source License
/** * called before the TreeView is refreshed. This allows any subclasses to cache * any information in the view and redisplay after the refresh. This is used by the * OSGiBundleBlock to cache the values of the default launch and auto launch columns * in the table tree./*from w ww .ja v a 2 s .com*/ * * @param treeView The tree view that will be refreshed. */ protected void refreshTreeView(CheckboxTreeViewer treeView) { // Remove any selection if (treeView.getTree().getItemCount() > 0) { treeView.getTree().setSelection(treeView.getTree().getItem(0)); } else { treeView.setSelection(new StructuredSelection(StructuredSelection.EMPTY)); } // Reset any editors on the tree viewer if (levelColumnEditor != null && levelColumnEditor.getEditor() != null && !levelColumnEditor.getEditor().isDisposed()) { levelColumnEditor.getEditor().dispose(); } if (autoColumnEditor != null && autoColumnEditor.getEditor() != null && !autoColumnEditor.getEditor().isDisposed()) { autoColumnEditor.getEditor().dispose(); } }
From source file:com.siteview.mde.internal.ui.wizards.extension.PointSelectionPage.java
License:Open Source License
private void handlePointSelection(IMonitorExtensionPoint element) { fCurrentPoint = element;/*ww w . java 2 s. c om*/ fTemplateViewer.setInput(fCurrentPoint); fTemplateViewer.setSelection(StructuredSelection.EMPTY); String fullPointID = IdUtil.getFullId(fCurrentPoint, fModel); String description = XMLComponentRegistry.Instance().getDescription(fullPointID, XMLComponentRegistry.F_SCHEMA_COMPONENT); String name = XMLComponentRegistry.Instance().getName(fullPointID, XMLComponentRegistry.F_SCHEMA_COMPONENT); URL url = null; if ((description == null) || (name == null)) { url = SchemaRegistry.getSchemaURL(fCurrentPoint, fModel); } if (url != null) { SchemaAnnotationHandler handler = new SchemaAnnotationHandler(); SchemaUtil.parseURL(url, handler); description = handler.getDescription(); name = handler.getName(); } if (description == null) { setPointDescriptionText(MDEUIMessages.PointSelectionPage_noDescAvailable); } else { setPointDescriptionText(description); } if (name == null) { name = fullPointID; } // Check if the extension point is deprecated and display a warning SchemaRegistry reg = MDECore.getDefault().getSchemaRegistry(); ISchema schema = reg.getSchema(fCurrentPoint.getFullId()); if (schema != null && schema.isDeperecated()) { setMessage(NLS.bind(MDEUIMessages.NewExtensionWizard_PointSelectionPage_pluginDescription_deprecated, name), IMessageProvider.WARNING); } else { setMessage(null); setDescription(NLS.bind(MDEUIMessages.NewExtensionWizard_PointSelectionPage_pluginDescription, name)); } setDescriptionText(""); //$NON-NLS-1$ fTemplateLabel .setText(NLS.bind(MDEUIMessages.NewExtensionWizard_PointSelectionPage_contributedTemplates_label, name.toLowerCase(Locale.ENGLISH))); fDescLink.setText(NLS.bind(MDEUIMessages.PointSelectionPage_extPointDesc, name)); setSelectedNode(null); setPageComplete(true); XMLComponentRegistry.Instance().putDescription(fullPointID, description, XMLComponentRegistry.F_SCHEMA_COMPONENT); XMLComponentRegistry.Instance().putName(fullPointID, name, XMLComponentRegistry.F_SCHEMA_COMPONENT); }
From source file:com.siteview.mde.internal.ui.wizards.target.MoveTargetDefinitionWizard.java
License:Open Source License
public void addPages() { fPage = new MoveTargetDefinitionPage("New Target Definition", StructuredSelection.EMPTY); //$NON-NLS-1$ addPage(fPage);/*w w w . j a v a2s .c om*/ fPage.setFilter(fFilter); }
From source file:com.ssn.quickoverviewruler.QuickAnnotationInformationControl.java
License:Open Source License
@Override protected void selectFirstMatch() { Tree tree = getTreeViewer().getTree(); Object element = null;//from ww w . jav a 2s. co m if (fPatternMatcher != null) { element = findElement(tree.getItems()); } if (element != null) getTreeViewer().setSelection(new StructuredSelection(element), true); else getTreeViewer().setSelection(StructuredSelection.EMPTY); }