IViewPart [] parts = MyPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getViews(); IProject activeProject = null; for(int i=0;i<parts.length;i++) { if(parts[i] instanceof ResourceNavigator) { ResourceNavigator navigator = (ResourceNavigator)parts[i]; StructuredSelection sel = (StructuredSelection)navigator.getTreeViewer().getSelection(); IResource resource = (IResource)sel.getFirstElement(); activeProject = resource.getProject(); break; } } String activeProjectName = activeProject .getName();
private String getTextFromSelection(ISelection selection) { if (selection instanceof StructuredSelection) { Object firstElement = ((StructuredSelection) selection).getFirstElement(); if (firstElement instanceof String) { return (String) firstElement; } } return null; }
/** * {@inheritDoc} */ @Override public void init(IWorkbench workbench, IStructuredSelection selection) { this.workbench = workbench; StructuredSelection structuredSelection = (StructuredSelection) selection; if (structuredSelection.getFirstElement() instanceof ICmrRepositoryProvider) { cmrRepositoryDefinition = ((ICmrRepositoryProvider) structuredSelection.getFirstElement()).getCmrRepositoryDefinition(); } }
/** * {@inheritDoc} */ @Override public void init(IWorkbench workbench, IStructuredSelection selection) { this.workbench = workbench; StructuredSelection structuredSelection = (StructuredSelection) selection; if (structuredSelection.getFirstElement() instanceof ICmrRepositoryProvider) { cmrRepositoryDefinition = ((ICmrRepositoryProvider) structuredSelection.getFirstElement()).getCmrRepositoryDefinition(); } }
/** * {@inheritDoc} */ @Override public void init(IWorkbench workbench, IStructuredSelection selection) { this.workbench = workbench; StructuredSelection structuredSelection = (StructuredSelection) selection; if (structuredSelection.getFirstElement() instanceof ICmrRepositoryProvider) { cmrRepositoryDefinition = ((ICmrRepositoryProvider) structuredSelection.getFirstElement()).getCmrRepositoryDefinition(); } }
/** * {@inheritDoc} */ @Override public void init(IWorkbench workbench, IStructuredSelection selection) { StructuredSelection structuredSelection = (StructuredSelection) selection; if (structuredSelection.getFirstElement() instanceof ICmrRepositoryProvider) { cmrRepositoryDefinition = ((ICmrRepositoryProvider) structuredSelection.getFirstElement()).getCmrRepositoryDefinition(); } }
/** * {@inheritDoc} */ @Override public void init(IWorkbench workbench, IStructuredSelection selection) { StructuredSelection structuredSelection = (StructuredSelection) selection; if (structuredSelection.getFirstElement() instanceof ICmrRepositoryProvider) { cmrRepositoryDefinition = ((ICmrRepositoryProvider) structuredSelection.getFirstElement()).getCmrRepositoryDefinition(); } }
public void widgetSelected(SelectionEvent e) { StructuredSelection selection = (StructuredSelection) DriverDefinitionsDialog.this.mTreeViewer .getSelection(); if (selection.getFirstElement() instanceof IPropertySet) { editDriver(selection); } }
private StatusAdapter getStatusAdapterFromEvent( SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection instanceof StructuredSelection) { StructuredSelection structuredSelection = (StructuredSelection) selection; Object element = structuredSelection.getFirstElement(); if (element instanceof StatusAdapter) { return (StatusAdapter) element; } } return null; }
public void widgetSelected(SelectionEvent e) { StructuredSelection selection = (StructuredSelection) DriverDefinitionsDialog.this.mTreeViewer .getSelection(); if (selection.getFirstElement() instanceof CategoryDescriptor) { addDriver(selection); } }
public void selectionChanged(SelectionChangedEvent event) { StructuredSelection selection = (StructuredSelection) DriverPreferences.this.mTreeViewer .getSelection(); if (selection != null && selection.size() > 0 && selection.getFirstElement() != null) updateButtons (selection.getFirstElement()); else updateButtons ( null ); }
private void removeSyntax() { Object o = ( ( StructuredSelection ) syntaxViewer.getSelection() ).getFirstElement(); syntaxList.remove( o ); syntaxViewer.refresh(); }
private boolean doOpen(ISelection selection) { if (!(selection instanceof StructuredSelection)) return false; StructuredSelection structuredSelection= (StructuredSelection) selection; if (structuredSelection.isEmpty()) return false; return open(structuredSelection.getFirstElement()); }
public void widgetSelected( SelectionEvent e ) { StructuredSelection selection = ( StructuredSelection ) saslRealmsTableViewer.getSelection(); if ( !selection.isEmpty() ) { String saslRealm = ( String ) selection.getFirstElement(); saslRealms.remove( saslRealm ); saslRealmsTableViewer.refresh(); setEditorDirty(); } } } );
public void widgetSelected( SelectionEvent e ) { StructuredSelection selection = ( StructuredSelection ) saslRealmsTableViewer.getSelection(); if ( !selection.isEmpty() ) { String saslRealm = ( String ) selection.getFirstElement(); saslRealms.remove( saslRealm ); saslRealmsTableViewer.refresh(); setEditorDirty(); } } } );
/** * {@inheritDoc} */ protected void okPressed() { StructuredSelection selection = ( StructuredSelection ) extendedOperationsTableViewer.getSelection(); if ( !selection.isEmpty() ) { selectedExtendedOperation = ( ExtendedOperationEnum ) selection.getFirstElement(); } super.okPressed(); }
public void widgetSelected( SelectionEvent e ) { StructuredSelection selection = ( StructuredSelection ) viewer.getSelection(); if ( !selection.isEmpty() ) { InterceptorEnum interceptor = ( InterceptorEnum ) selection.getFirstElement(); interceptors.remove( interceptor ); viewer.refresh(); setEditorDirty(); } } } );
public void widgetSelected( SelectionEvent e ) { StructuredSelection selection = ( StructuredSelection ) viewer.getSelection(); if ( !selection.isEmpty() ) { InterceptorEnum interceptor = ( InterceptorEnum ) selection.getFirstElement(); interceptors.remove( interceptor ); viewer.refresh(); setEditorDirty(); } } } );
public void widgetSelected( SelectionEvent e ) { StructuredSelection selection = ( StructuredSelection ) viewer.getSelection(); if ( !selection.isEmpty() ) { ExtendedOperationEnum extendedOperation = ( ExtendedOperationEnum ) selection.getFirstElement(); extendedOperations.remove( extendedOperation ); viewer.refresh(); setEditorDirty(); } } } );
public void doubleClick(DoubleClickEvent event) { StructuredSelection selection = (StructuredSelection) event.getSelection(); Object selectedElement = selection.getFirstElement(); if (selectedElement instanceof TreeNode) { TreeNode treeNode = (TreeNode) selectedElement; // create and open dialog for certificate chain X509CertificateViewDialog certificateViewDialog = new X509CertificateViewDialog(getShell(), (X509Certificate) treeNode.getValue()); certificateViewDialog.open(); } } };