Java Code Examples for org.eclipse.jface.viewers.SelectionChangedEvent#getSource()
The following examples show how to use
org.eclipse.jface.viewers.SelectionChangedEvent#getSource() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CheckstylePropertyPage.java From eclipse-cs with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void selectionChanged(SelectionChangedEvent event) { Object source = event.getSource(); if (source == mFilterList) { ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { Object selectedElement = ((IStructuredSelection) selection).getFirstElement(); if (selectedElement instanceof IFilter) { IFilter filterDef = (IFilter) selectedElement; mTxtFilterDescription.setText(filterDef.getDescription()); // activate edit button mBtnEditFilter.setEnabled(PluginFilterEditors.hasEditor(filterDef)); } } } }
Example 2
Source File: WhiteSpaceTabPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public void selectionChanged(SelectionChangedEvent event) { final IStructuredSelection selection= (IStructuredSelection)event.getSelection(); if (selection.isEmpty() || !(selection.getFirstElement() instanceof Node)) return; final Node selected= (Node)selection.getFirstElement(); if (selected == null || selected == fLastSelected) return; if (event.getSource() == fInnerViewer && selected instanceof InnerNode) { fLastSelected= (InnerNode)selected; fDialogSettings.put(PREF_INNER_INDEX, selected.index); innerViewerChanged((InnerNode)selected); } else if (event.getSource() == fOptionsViewer && selected instanceof OptionNode) fDialogSettings.put(PREF_OPTION_INDEX, selected.index); }
Example 3
Source File: TableComboViewerSnippet1.java From nebula with Eclipse Public License 2.0 | 5 votes |
public void selectionChanged(SelectionChangedEvent event) { listenerGroup.setText("Listener Results - (" + text + ")"); Model model = (Model) ((IStructuredSelection) event.getSelection()).getFirstElement(); toggleSelection(model); String selectionText = getSelectionText(); listenerResults.setText(selectionText); TableComboViewer viewer = ((TableComboViewer) event.getSource()); viewer.getTableCombo().setText(selectionText); viewer.update(model, null); }
Example 4
Source File: CheckConfigurationWorkingSetEditor.java From eclipse-cs with GNU Lesser General Public License v2.1 | 5 votes |
/** * @see ISelectionChangedListener#selectionChanged( * org.eclipse.jface.viewers.SelectionChangedEvent) */ @Override public void selectionChanged(SelectionChangedEvent event) { if (event.getSource() == mViewer && event.getSelection() instanceof IStructuredSelection) { CheckConfigurationWorkingCopy config = (CheckConfigurationWorkingCopy) ((IStructuredSelection) event .getSelection()).getFirstElement(); boolean configSelected = config != null; if (configSelected) { mConfigurationDescription .setText(config.getDescription() != null ? config.getDescription() : ""); //$NON-NLS-1$ if (mIsShowUsage) { try { mUsageView.setInput(ProjectConfigurationFactory .getProjectsUsingConfig(config.getSourceCheckConfiguration())); } catch (CheckstylePluginException e) { CheckstyleLog.log(e); } } } else { mConfigurationDescription.setText(""); //$NON-NLS-1$ if (mIsShowUsage) { mUsageView.setInput(new ArrayList<IProject>()); } } mEditButton.setEnabled(configSelected); mConfigureButton.setEnabled(configSelected); mCopyButton.setEnabled(configSelected); mRemoveButton.setEnabled(configSelected && config.isEditable()); mDefaultButton.setEnabled(configSelected); mExportButton.setEnabled(configSelected); } }
Example 5
Source File: ValidateableTableSectionPart.java From tlaplus with MIT License | 5 votes |
public void selectionChanged(SelectionChangedEvent event) { Object source = event.getSource(); if (source == tableViewer) { changeButtonEnablement(); } }
Example 6
Source File: CloudSpaceBluemixWizardPage.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
@Override public void selectionChanged(SelectionChangedEvent event) { if (event.getSource() == _orgViewer) { updateSpaces(_orgViewer.getTable().getSelectionIndex(), null); } _hasChanged = true; }
Example 7
Source File: BlockSelector.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override public void selectionChanged(SelectionChangedEvent event){ TreeViewer tv = (TreeViewer) event.getSource(); StructuredSelection ss = (StructuredSelection) tv.getSelection(); Object selected = null; Object firstElement = ss.isEmpty() ? null : ss.getFirstElement(); if (firstElement instanceof BlockTreeViewerItem) { selected = ((BlockTreeViewerItem) firstElement).getBlock(); } tvfa.updateSelection((Identifiable) selected); if (selected != null) { ContextServiceHolder.get().getRootContext().setTyped(selected); } }
Example 8
Source File: EigenartikelSelector.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override public void selectionChanged(SelectionChangedEvent event){ TreeViewer tv = (TreeViewer) event.getSource(); StructuredSelection ss = (StructuredSelection) tv.getSelection(); tvfa.updateSelection(ss.isEmpty() ? null : ss.getFirstElement()); if (!ss.isEmpty()) { IArticle ea = (IArticle) ss.getFirstElement(); ContextServiceHolder.get().getRootContext() .setNamed("ch.elexis.core.ui.eigenartikel.selection", ea); } else { ContextServiceHolder.get().getRootContext() .setNamed("ch.elexis.core.ui.eigenartikel.selection", null); } }
Example 9
Source File: EClassTypeViewer.java From dsl-devkit with Eclipse Public License 1.0 | 4 votes |
/** {@inheritDoc} */ public void selectionChanged(final SelectionChangedEvent event) { if (!event.getSelection().isEmpty() && event.getSource() instanceof XtextElementSelectionListener) { setInput(((XtextElementSelectionListener) event.getSource()).getSelectedElementType()); } }
Example 10
Source File: JointDataSetPage.java From birt with Eclipse Public License 1.0 | 4 votes |
public void selectionChanged( SelectionChangedEvent event ) { selectionChanged = true; if ( event.getSource( ) instanceof ComboViewer ) { this.setPageMessage( Messages.getString( "JointDataSetPage.page.detail" ), //$NON-NLS-1$ IMessageProvider.NONE ); if ( ( (ComboViewer) event.getSource( ) ).equals( rightDataSetChooser ) ) leftSelected = false; else leftSelected = true; if ( ( (IStructuredSelection) event.getSelection( ) ).getFirstElement( ) instanceof DataSetHandle ) { DataSetHandle handle = (DataSetHandle) ( (IStructuredSelection) event.getSelection( ) ).getFirstElement( ); if ( leftSelected ) { leftDataSetName = handle.getQualifiedName( ); leftHandle = handle; } else { rightDataSetName = handle.getQualifiedName( ); rightHandle = handle; } DataSetViewData[] columsItems = null; try { DataSessionContext context = new DataSessionContext( DataSessionContext.MODE_DIRECT_PRESENTATION, handle.getModuleHandle( ) ); DataRequestSession session = DataRequestSession.newSession( context ); columsItems = DataSetProvider.getCurrentInstance( ) .populateAllCachedMetaData( handle, session ); populateColumns( columsItems ); session.shutdown( ); } catch ( BirtException e ) { ExceptionHandler.handle( e ); } } } else if ( event.getSource( ) instanceof ListViewer ) { if ( ( (ListViewer) event.getSource( ) ).equals( rightColumnList ) ) leftSelected = false; else leftSelected = true; if ( ( (IStructuredSelection) event.getSelection( ) ).getFirstElement( ) instanceof DataSetViewData ) { DataSetViewData itemModel = (DataSetViewData) ( (IStructuredSelection) event.getSelection( ) ).getFirstElement( ); if ( leftSelected ) leftColumnSelection = itemModel.getName( ); else rightColumnSelection = itemModel.getName( ); } } if ( !this.nameEditor.isDisposed( ) ) setPageComplete( canPageComplete( ) ); }
Example 11
Source File: JSEditor.java From birt with Eclipse Public License 1.0 | 4 votes |
public void selectionChanged( SelectionChangedEvent event ) { ISelection selection = event.getSelection( ); if ( selection != null ) { Object[] sel = ( (IStructuredSelection) selection ).toArray( ); if ( sel.length == 1 ) { if ( sel[0] instanceof IPropertyDefn ) { // Save the current expression into the DE using DE API DesignElementHandle desHandle = (DesignElementHandle) cmbExprListViewer.getInput( ); saveModel( ); // Update the editor to display the expression // corresponding to the selected combo item ( method // name/ expression name ) IPropertyDefn elePropDefn = (IPropertyDefn) sel[0]; cmbItemLastSelected = elePropDefn; setEditorText( desHandle.getStringProperty( elePropDefn.getName( ) ) ); if ( event.getSource( ) == cmbExprListViewer ) { // Store the main selection state only selectionMap.put( getModel( ), selection ); } else if ( event.getSource( ) == cmbSubFunctionsViewer ) { // Store both the main and sub selection state here. List<Object> selectionList = new ArrayList<Object>( ); selectionList.add( ( (StructuredSelection) cmbExprListViewer.getSelection( ) ).getFirstElement( ) ); selectionList.add( ( (StructuredSelection) selection ).getFirstElement( ) ); selectionMap.put( getModel( ), new StructuredSelection( selectionList ) ); } String method = cmbItemLastSelected.getName( ); updateScriptContext( desHandle, method ); updateMethodDescription( method ); refreshAll( ); } } } }
Example 12
Source File: ExpressionBuilder.java From birt with Eclipse Public License 1.0 | 4 votes |
public void selectionChanged( SelectionChangedEvent event ) { IStructuredSelection selection = (IStructuredSelection) event.getSelection( ); Viewer target = null; if ( event.getSource( ) == categoryTable ) { target = subCategoryTable; } else if ( event.getSource( ) == subCategoryTable ) { target = functionTable; } if ( target != null ) { target.setInput( selection == null ? null : selection.getFirstElement( ) ); } if ( event.getSource( ) == functionTable ) { Table table = functionTable.getTable( ); if ( table.getSelectionCount( ) == 1 ) { messageLine.getParent( ).setVisible( true ); String message = provider.getDisplayText( table.getSelection( )[0].getData( ) ); message = message.replaceAll( "&", "&" ); //$NON-NLS-1$//$NON-NLS-2$ message = message.replaceAll( "<", "<" ); //$NON-NLS-1$ //$NON-NLS-2$ message = message.replaceAll( ">", ">" ); //$NON-NLS-1$//$NON-NLS-2$ messageLine.setText( "<form><p> <b>" //$NON-NLS-1$ + Messages.getString( "ExpressionBuilder.Label.Hint" ) //$NON-NLS-1$ + "</b>: " //$NON-NLS-1$ + message + "</p></form>", true, false ); //$NON-NLS-1$ messageLine.getParent( ).layout( ); } else { messageLine.getParent( ).setVisible( false ); } } }