org.eclipse.jface.viewers.ISelectionChangedListener Java Examples

The following examples show how to use org.eclipse.jface.viewers.ISelectionChangedListener. 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: DetailViewEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example #2
Source File: ComponentEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example #3
Source File: SecurityEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example #4
Source File: MemoryEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example #5
Source File: InfrastructureEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example #6
Source File: CDateTimeSelectionProvider.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Notifies any selection changed listeners that the viewer's selection has changed.
 * Only listeners registered at the time this method is called are notified.
 *
 * @param event a selection changed event
 *
 * @see ISelectionChangedListener#selectionChanged
 */
private void fireSelectionChanged(final SelectionChangedEvent event) {
    Object[] listeners = selectionChangedListeners.getListeners();
    for (int i = 0; i < listeners.length; ++i) {
        final ISelectionChangedListener l = (ISelectionChangedListener) listeners[i];
        SafeRunnable.run(new SafeRunnable() {
            public void run() {
                l.selectionChanged(event);
            }
        });
    }
}
 
Example #7
Source File: TreeMapper.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Select no item
 */
private void unselect() {
	selectedMapping = null;
	selectedFigure = null;
	currentSelection = new StructuredSelection();
	for (ISelectionChangedListener listener : selectionChangedListeners) {
		listener.selectionChanged(new SelectionChangedEvent(this, currentSelection));
	}
}
 
Example #8
Source File: TreeMapper.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @param mapping
 * @param arrowFigure
 */
protected void fireMappingSelection(M mapping, LinkFigure arrowFigure) {
	if (selectedFigure != null) {
		applyDefaultMappingStyle(selectedFigure);
	}
	applySelectedMappingFeedback(arrowFigure);
	selectedFigure = arrowFigure;
	selectedMapping = mapping;
	currentSelection = new StructuredSelection(selectedMapping);
	for (ISelectionChangedListener listener : selectionChangedListeners) {
		listener.selectionChanged(new SelectionChangedEvent(this, currentSelection));
	}
}
 
Example #9
Source File: RecipeEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example #10
Source File: SourceView.java    From lapse-plus with GNU General Public License v3.0 5 votes vote down vote up
/**
 * This is a callback that will allow us
 * to create the viewer and initialize it.
 */
public void createPartControl(Composite parent) {
	
	fClipboard= new Clipboard(parent.getDisplay());
	
	viewer = new LocationViewer(parent);
	viewer.setContentProvider(new ViewContentProvider());
	viewer.setLabelProvider(new ViewLabelProvider());
	viewer.setSorter(new ColumnBasedSorter(2));
	viewer.setInput(getViewSite());
	
	makeActions();
	
	hookContextMenu();
	hookDoubleClickAction();
	
	viewer.addSelectionChangedListener(new ISelectionChangedListener() {
		public void selectionChanged(SelectionChangedEvent event) {
			IStructuredSelection sel = (IStructuredSelection) event.getSelection();
			if(sel != null) {
				int size = sel.toArray().length;
				if(size > 0) {
					IStatusLineManager slManager = getViewSite().getActionBars().getStatusLineManager();
					slManager.setMessage("Selected " + size + (size > 1 ? " entries." : "entry."));
				}
			}
		}
	});
	
	contributeToActionBars();
}
 
Example #11
Source File: WorldEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example #12
Source File: ChooseImplementationDialog.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite container) {
	final Control control = super.createDialogArea(container);
	getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() {
		@Override
		public void selectionChanged(SelectionChangedEvent event) {
			getOkButton().setEnabled(!getTableViewer().getSelection().isEmpty());
		}
	});
	return control;
}
 
Example #13
Source File: ProfileEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example #14
Source File: OsgiEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example #15
Source File: MainEntryPoint.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private Composite createMenu ( final Composite parent )
{
    final Composite menu = new Composite ( parent, SWT.NONE );

    menu.setLayout ( new FillLayout () );

    this.viewer = new TreeViewer ( menu, SWT.FULL_SELECTION );

    this.treeContentProvider = new ObservableListTreeContentProvider ( new FactoryImpl (), null );
    this.viewer.setContentProvider ( this.treeContentProvider );

    this.viewer.setLabelProvider ( new TreeNodeLabelProvider ( this.viewer,
            BeansObservables.observeMap ( this.treeContentProvider.getRealizedElements (), TreeNode.PROP_NAME ),
            BeansObservables.observeMap ( this.treeContentProvider.getRealizedElements (), TreeNode.PROP_PROVIDER_SET )
            ) );

    this.viewer.setInput ( this.manager.getRootNode () );

    this.viewer.addSelectionChangedListener ( new ISelectionChangedListener () {

        @Override
        public void selectionChanged ( final SelectionChangedEvent event )
        {
            handleSelectionChanged ( event );
        }
    } );

    this.viewer.setAutoExpandLevel ( 2 );

    return menu;
}
 
Example #16
Source File: GlobalizeEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example #17
Source File: CrossflowEditor.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection(ISelection selection) {
	editorSelection = selection;

	for (ISelectionChangedListener listener : selectionChangedListeners) {
		listener.selectionChanged(new SelectionChangedEvent(this, selection));
	}
	setStatusLineManager(selection);
}
 
Example #18
Source File: SetupEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example #19
Source File: TestResultsView.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
private void hookSingleClickAction() {
	testTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
		@Override
		public void selectionChanged(SelectionChangedEvent event) {
			singleClickAction.run();
		}
	});
}
 
Example #20
Source File: DeploymentEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example #21
Source File: VisualInterfaceEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example #22
Source File: ChartEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to
 * set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void setSelection ( final ISelection selection )
{
    this.editorSelection = selection;

    for ( final ISelectionChangedListener listener : this.selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example #23
Source File: ItemEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSelection ( ISelection selection )
{
    editorSelection = selection;

    for ( ISelectionChangedListener listener : selectionChangedListeners )
    {
        listener.selectionChanged ( new SelectionChangedEvent ( this, selection ) );
    }
    setStatusLineManager ( selection );
}
 
Example #24
Source File: WorldEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * This accesses a cached version of the content outliner.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage ()
{
    if ( contentOutlinePage == null )
    {
        // The content outline is just a tree.
        //
        class MyContentOutlinePage extends ContentOutlinePage
        {
            @Override
            public void createControl ( Composite parent )
            {
                super.createControl ( parent );
                contentOutlineViewer = getTreeViewer ();
                contentOutlineViewer.addSelectionChangedListener ( this );

                // Set up the tree viewer.
                //
                contentOutlineViewer.setContentProvider ( new AdapterFactoryContentProvider ( adapterFactory ) );
                contentOutlineViewer.setLabelProvider ( new DelegatingStyledCellLabelProvider ( new DecoratingColumLabelProvider.StyledLabelProvider ( new AdapterFactoryLabelProvider.StyledLabelProvider ( adapterFactory, contentOutlineViewer ), new DiagnosticDecorator.Styled ( editingDomain.getResourceSet (), contentOutlineViewer ) ) ) );
                contentOutlineViewer.setInput ( editingDomain.getResourceSet () );

                new ColumnViewerInformationControlToolTipSupport ( contentOutlineViewer, new DiagnosticDecorator.Styled.EditingDomainLocationListener ( editingDomain, contentOutlineViewer ) );

                // Make sure our popups work.
                //
                createContextMenuFor ( contentOutlineViewer );

                if ( !editingDomain.getResourceSet ().getResources ().isEmpty () )
                {
                    // Select the root object in the view.
                    //
                    contentOutlineViewer.setSelection ( new StructuredSelection ( editingDomain.getResourceSet ().getResources ().get ( 0 ) ), true );
                }
            }

            @Override
            public void makeContributions ( IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager )
            {
                super.makeContributions ( menuManager, toolBarManager, statusLineManager );
                contentOutlineStatusLineManager = statusLineManager;
            }

            @Override
            public void setActionBars ( IActionBars actionBars )
            {
                super.setActionBars ( actionBars );
                getActionBarContributor ().shareGlobalActions ( this, actionBars );
            }
        }

        contentOutlinePage = new MyContentOutlinePage ();

        // Listen to selection so that we can handle it is a special way.
        //
        contentOutlinePage.addSelectionChangedListener ( new ISelectionChangedListener () {
            // This ensures that we handle selections correctly.
            //
            public void selectionChanged ( SelectionChangedEvent event )
            {
                handleContentOutlineSelection ( event.getSelection () );
            }
        } );
    }

    return contentOutlinePage;
}
 
Example #25
Source File: TreeMapper.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public void addSelectionChangedListener(ISelectionChangedListener listener) {
	this.selectionChangedListeners.add(listener);
}
 
Example #26
Source File: RecipeEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * This accesses a cached version of the content outliner.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage ()
{
    if ( contentOutlinePage == null )
    {
        // The content outline is just a tree.
        //
        class MyContentOutlinePage extends ContentOutlinePage
        {
            @Override
            public void createControl ( Composite parent )
            {
                super.createControl ( parent );
                contentOutlineViewer = getTreeViewer ();
                contentOutlineViewer.addSelectionChangedListener ( this );

                // Set up the tree viewer.
                //
                contentOutlineViewer.setContentProvider ( new AdapterFactoryContentProvider ( adapterFactory ) );
                contentOutlineViewer.setLabelProvider ( new DelegatingStyledCellLabelProvider ( new DecoratingColumLabelProvider.StyledLabelProvider ( new AdapterFactoryLabelProvider.StyledLabelProvider ( adapterFactory, contentOutlineViewer ), new DiagnosticDecorator.Styled ( editingDomain.getResourceSet (), contentOutlineViewer ) ) ) );
                contentOutlineViewer.setInput ( editingDomain.getResourceSet () );

                new ColumnViewerInformationControlToolTipSupport ( contentOutlineViewer, new DiagnosticDecorator.Styled.EditingDomainLocationListener ( editingDomain, contentOutlineViewer ) );

                // Make sure our popups work.
                //
                createContextMenuFor ( contentOutlineViewer );

                if ( !editingDomain.getResourceSet ().getResources ().isEmpty () )
                {
                    // Select the root object in the view.
                    //
                    contentOutlineViewer.setSelection ( new StructuredSelection ( editingDomain.getResourceSet ().getResources ().get ( 0 ) ), true );
                }
            }

            @Override
            public void makeContributions ( IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager )
            {
                super.makeContributions ( menuManager, toolBarManager, statusLineManager );
                contentOutlineStatusLineManager = statusLineManager;
            }

            @Override
            public void setActionBars ( IActionBars actionBars )
            {
                super.setActionBars ( actionBars );
                getActionBarContributor ().shareGlobalActions ( this, actionBars );
            }
        }

        contentOutlinePage = new MyContentOutlinePage ();

        // Listen to selection so that we can handle it is a special way.
        //
        contentOutlinePage.addSelectionChangedListener ( new ISelectionChangedListener () {
            // This ensures that we handle selections correctly.
            //
            public void selectionChanged ( SelectionChangedEvent event )
            {
                handleContentOutlineSelection ( event.getSelection () );
            }
        } );
    }

    return contentOutlinePage;
}
 
Example #27
Source File: DeploymentEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * This accesses a cached version of the content outliner.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage ()
{
    if ( contentOutlinePage == null )
    {
        // The content outline is just a tree.
        //
        class MyContentOutlinePage extends ContentOutlinePage
        {
            @Override
            public void createControl ( Composite parent )
            {
                super.createControl ( parent );
                contentOutlineViewer = getTreeViewer ();
                contentOutlineViewer.addSelectionChangedListener ( this );

                // Set up the tree viewer.
                //
                contentOutlineViewer.setContentProvider ( new AdapterFactoryContentProvider ( adapterFactory ) );
                contentOutlineViewer.setLabelProvider ( new DelegatingStyledCellLabelProvider ( new DecoratingColumLabelProvider.StyledLabelProvider ( new AdapterFactoryLabelProvider.StyledLabelProvider ( adapterFactory, contentOutlineViewer ), new DiagnosticDecorator.Styled ( editingDomain.getResourceSet (), contentOutlineViewer ) ) ) );
                contentOutlineViewer.setInput ( editingDomain.getResourceSet () );

                new ColumnViewerInformationControlToolTipSupport ( contentOutlineViewer, new DiagnosticDecorator.Styled.EditingDomainLocationListener ( editingDomain, contentOutlineViewer ) );

                // Make sure our popups work.
                //
                createContextMenuFor ( contentOutlineViewer );

                if ( !editingDomain.getResourceSet ().getResources ().isEmpty () )
                {
                    // Select the root object in the view.
                    //
                    contentOutlineViewer.setSelection ( new StructuredSelection ( editingDomain.getResourceSet ().getResources ().get ( 0 ) ), true );
                }
            }

            @Override
            public void makeContributions ( IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager )
            {
                super.makeContributions ( menuManager, toolBarManager, statusLineManager );
                contentOutlineStatusLineManager = statusLineManager;
            }

            @Override
            public void setActionBars ( IActionBars actionBars )
            {
                super.setActionBars ( actionBars );
                getActionBarContributor ().shareGlobalActions ( this, actionBars );
            }
        }

        contentOutlinePage = new MyContentOutlinePage ();

        // Listen to selection so that we can handle it is a special way.
        //
        contentOutlinePage.addSelectionChangedListener ( new ISelectionChangedListener () {
            // This ensures that we handle selections correctly.
            //
            public void selectionChanged ( SelectionChangedEvent event )
            {
                handleContentOutlineSelection ( event.getSelection () );
            }
        } );
    }

    return contentOutlinePage;
}
 
Example #28
Source File: ConfigurationEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * This accesses a cached version of the content outliner.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage ()
{
    if ( contentOutlinePage == null )
    {
        // The content outline is just a tree.
        //
        class MyContentOutlinePage extends ContentOutlinePage
        {
            @Override
            public void createControl ( Composite parent )
            {
                super.createControl ( parent );
                contentOutlineViewer = getTreeViewer ();
                contentOutlineViewer.addSelectionChangedListener ( this );

                // Set up the tree viewer.
                //
                contentOutlineViewer.setContentProvider ( new AdapterFactoryContentProvider ( adapterFactory ) );
                contentOutlineViewer.setLabelProvider ( new AdapterFactoryLabelProvider ( adapterFactory ) );
                contentOutlineViewer.setInput ( editingDomain.getResourceSet () );

                // Make sure our popups work.
                //
                createContextMenuFor ( contentOutlineViewer );

                if ( !editingDomain.getResourceSet ().getResources ().isEmpty () )
                {
                    // Select the root object in the view.
                    //
                    contentOutlineViewer.setSelection ( new StructuredSelection ( editingDomain.getResourceSet ().getResources ().get ( 0 ) ), true );
                }
            }

            @Override
            public void makeContributions ( IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager )
            {
                super.makeContributions ( menuManager, toolBarManager, statusLineManager );
                contentOutlineStatusLineManager = statusLineManager;
            }

            @Override
            public void setActionBars ( IActionBars actionBars )
            {
                super.setActionBars ( actionBars );
                getActionBarContributor ().shareGlobalActions ( this, actionBars );
            }
        }

        contentOutlinePage = new MyContentOutlinePage ();

        // Listen to selection so that we can handle it is a special way.
        //
        contentOutlinePage.addSelectionChangedListener
                ( new ISelectionChangedListener ()
                {
                    // This ensures that we handle selections correctly.
                    //
                    public void selectionChanged ( SelectionChangedEvent event )
                    {
                        handleContentOutlineSelection ( event.getSelection () );
                    }
                } );
    }

    return contentOutlinePage;
}
 
Example #29
Source File: VisualInterfaceEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * This accesses a cached version of the content outliner.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage ()
{
    if ( contentOutlinePage == null )
    {
        // The content outline is just a tree.
        //
        class MyContentOutlinePage extends ContentOutlinePage
        {
            @Override
            public void createControl ( Composite parent )
            {
                super.createControl ( parent );
                contentOutlineViewer = getTreeViewer ();
                contentOutlineViewer.addSelectionChangedListener ( this );

                // Set up the tree viewer.
                //
                contentOutlineViewer.setUseHashlookup ( true );
                contentOutlineViewer.setContentProvider ( new AdapterFactoryContentProvider ( adapterFactory ) );
                contentOutlineViewer.setLabelProvider ( new AdapterFactoryLabelProvider ( adapterFactory ) );
                contentOutlineViewer.setInput ( editingDomain.getResourceSet () );

                // Make sure our popups work.
                //
                createContextMenuFor ( contentOutlineViewer );

                if ( !editingDomain.getResourceSet ().getResources ().isEmpty () )
                {
                    // Select the root object in the view.
                    //
                    contentOutlineViewer.setSelection ( new StructuredSelection ( editingDomain.getResourceSet ().getResources ().get ( 0 ) ), true );
                }
            }

            @Override
            public void makeContributions ( IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager )
            {
                super.makeContributions ( menuManager, toolBarManager, statusLineManager );
                contentOutlineStatusLineManager = statusLineManager;
            }

            @Override
            public void setActionBars ( IActionBars actionBars )
            {
                super.setActionBars ( actionBars );
                getActionBarContributor ().shareGlobalActions ( this, actionBars );
            }
        }

        contentOutlinePage = new MyContentOutlinePage ();

        // Listen to selection so that we can handle it is a special way.
        //
        contentOutlinePage.addSelectionChangedListener ( new ISelectionChangedListener () {
            // This ensures that we handle selections correctly.
            //
            public void selectionChanged ( SelectionChangedEvent event )
            {
                handleContentOutlineSelection ( event.getSelection () );
            }
        } );
    }

    return contentOutlinePage;
}
 
Example #30
Source File: SecurityEditor.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * This accesses a cached version of the content outliner.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IContentOutlinePage getContentOutlinePage ()
{
    if ( contentOutlinePage == null )
    {
        // The content outline is just a tree.
        //
        class MyContentOutlinePage extends ContentOutlinePage
        {
            @Override
            public void createControl ( Composite parent )
            {
                super.createControl ( parent );
                contentOutlineViewer = getTreeViewer ();
                contentOutlineViewer.addSelectionChangedListener ( this );

                // Set up the tree viewer.
                //
                contentOutlineViewer.setContentProvider ( new AdapterFactoryContentProvider ( adapterFactory ) );
                contentOutlineViewer.setLabelProvider ( new AdapterFactoryLabelProvider ( adapterFactory ) );
                contentOutlineViewer.setInput ( editingDomain.getResourceSet () );

                // Make sure our popups work.
                //
                createContextMenuFor ( contentOutlineViewer );

                if ( !editingDomain.getResourceSet ().getResources ().isEmpty () )
                {
                    // Select the root object in the view.
                    //
                    contentOutlineViewer.setSelection ( new StructuredSelection ( editingDomain.getResourceSet ().getResources ().get ( 0 ) ), true );
                }
            }

            @Override
            public void makeContributions ( IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager )
            {
                super.makeContributions ( menuManager, toolBarManager, statusLineManager );
                contentOutlineStatusLineManager = statusLineManager;
            }

            @Override
            public void setActionBars ( IActionBars actionBars )
            {
                super.setActionBars ( actionBars );
                getActionBarContributor ().shareGlobalActions ( this, actionBars );
            }
        }

        contentOutlinePage = new MyContentOutlinePage ();

        // Listen to selection so that we can handle it is a special way.
        //
        contentOutlinePage.addSelectionChangedListener
                ( new ISelectionChangedListener ()
                {
                    // This ensures that we handle selections correctly.
                    //
                    public void selectionChanged ( SelectionChangedEvent event )
                    {
                        handleContentOutlineSelection ( event.getSelection () );
                    }
                } );
    }

    return contentOutlinePage;
}