Search in sources :

Example 6 with IViewSite

use of org.eclipse.ui.IViewSite in project yamcs-studio by yamcs.

the class OPIView method setOPIInput.

/**
 * @param input
 *            Display file that this view should execute
 * @param persist
 *            Persist the input to memento?
 */
public void setOPIInput(final IEditorInput input, final boolean persist) throws PartInitException {
    if (debug) {
        final IViewSite view = getViewSite();
        System.out.println(view.getId() + ":" + view.getSecondaryId() + " displays " + input.getName());
    }
    this.input = input;
    setTitleToolTip(input.getToolTipText());
    opiRuntimeDelegate.init(site, input);
    if (opiRuntimeToolBarDelegate != null)
        opiRuntimeToolBarDelegate.setActiveOPIRuntime(this);
    if (persist)
        persist();
}
Also used : IViewSite(org.eclipse.ui.IViewSite)

Example 7 with IViewSite

use of org.eclipse.ui.IViewSite in project usbdm-eclipse-plugins by podonoghue.

the class UsbdmDevicePeripheralsView method contributeToActionBars.

/**
 *  Add selected actions to menu bar
 */
private void contributeToActionBars() {
    IViewSite site = getViewSite();
    if (site == null) {
        return;
    }
    IActionBars bars = site.getActionBars();
    fillLocalPullDown(bars.getMenuManager());
    fillLocalToolBar(bars.getToolBarManager());
}
Also used : IViewSite(org.eclipse.ui.IViewSite) IActionBars(org.eclipse.ui.IActionBars)

Example 8 with IViewSite

use of org.eclipse.ui.IViewSite in project ecf by eclipse.

the class EndpointDiscoveryView method createPartControl.

public void createPartControl(Composite parent) {
    this.discovery = DiscoveryComponent.getDefault();
    this.discovery.setView(this);
    IViewSite viewSite = getViewSite();
    this.contentProvider = createContentProvider(viewSite);
    viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    viewer.setContentProvider(this.contentProvider);
    viewer.setLabelProvider(new WorkbenchLabelProvider());
    viewer.setAutoExpandLevel(TreeViewer.ALL_LEVELS);
    viewer.setInput(viewSite);
    makeActions();
    hookContextMenu();
    contributeToActionBars();
    // setup clipboard
    clipboard = new Clipboard(viewer.getControl().getDisplay());
    getSite().setSelectionProvider(viewer);
    // Add any previously discovered endpoints
    viewer.getControl().getDisplay().asyncExec(new Runnable() {

        @Override
        public void run() {
            IEndpointDescriptionLocator locator = discovery.getEndpointDescriptionLocator();
            if (locator != null) {
                EndpointDescription[] eds = locator.getDiscoveredEndpoints();
                for (EndpointDescription ed : eds) handleEndpointDescription(EndpointEvent.ADDED, ed);
            }
        }
    });
    showServicesInRegistryBrowser();
}
Also used : IViewSite(org.eclipse.ui.IViewSite) IEndpointDescriptionLocator(org.eclipse.ecf.osgi.services.remoteserviceadmin.IEndpointDescriptionLocator) WorkbenchLabelProvider(org.eclipse.ui.model.WorkbenchLabelProvider) TreeViewer(org.eclipse.jface.viewers.TreeViewer) Clipboard(org.eclipse.swt.dnd.Clipboard) EndpointDescription(org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescription)

Example 9 with IViewSite

use of org.eclipse.ui.IViewSite in project ecf by eclipse.

the class AbstractRemoteServiceAdminView method createPartControl.

@Override
public void createPartControl(Composite parent) {
    IViewSite viewSite = getViewSite();
    this.contentProvider = createContentProvider(viewSite);
    viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    viewer.setContentProvider(this.contentProvider);
    viewer.setLabelProvider(new WorkbenchLabelProvider());
    viewer.setAutoExpandLevel(TreeViewer.ALL_LEVELS);
    viewer.setInput(viewSite);
    makeActions();
    hookContextMenu();
    viewSite.setSelectionProvider(viewer);
    setupListeners();
    setupSelectionListeners();
    RemoteServiceAdmin rsa = getLocalRSA();
    if (rsa != null)
        updateModel();
}
Also used : IViewSite(org.eclipse.ui.IViewSite) WorkbenchLabelProvider(org.eclipse.ui.model.WorkbenchLabelProvider) RemoteServiceAdmin(org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin) TreeViewer(org.eclipse.jface.viewers.TreeViewer)

Example 10 with IViewSite

use of org.eclipse.ui.IViewSite in project tdi-studio-se by Talend.

the class StatLogsAndImplicitcontextTreeViewPage method createImplicitcontextTree.

private void createImplicitcontextTree(Composite composite) {
    //$NON-NLS-1$
    Group g = widgetFactory.createGroup(composite, Messages.getString("ExtraComposite.ImplicitContextSettings"));
    GridData gd = new GridData(GridData.FILL_BOTH);
    g.setLayoutData(gd);
    g.setLayout(new FillLayout());
    viewer = new CheckboxRepositoryTreeViewer(g, SWT.MULTI | SWT.V_SCROLL);
    contentProvider = new AllJobContentProvider(repositoryView);
    viewer.setContentProvider(contentProvider);
    viewer.setLabelProvider(new RepositoryLabelProvider(repositoryView));
    viewer.setSorter(repositoryView.getViewer().getSorter());
    IViewSite viewSite = repositoryView.getViewSite();
    viewer.setInput(viewSite);
    // This only tree listener aim is to change open/close icons on folders :
    viewer.addTreeListener(new ITreeViewerListener() {

        @Override
        public void treeCollapsed(TreeExpansionEvent event) {
            RepositoryNode node = (RepositoryNode) event.getElement();
            if (node.getType().equals(ENodeType.SIMPLE_FOLDER)) {
                TreeItem item = getObject(viewer.getTree(), event.getElement());
                if (item != null) {
                    item.setImage(ImageProvider.getImage(ECoreImage.FOLDER_CLOSE_ICON));
                }
            }
        }

        @Override
        public void treeExpanded(TreeExpansionEvent event) {
            RepositoryNode node = (RepositoryNode) event.getElement();
            if (node.getType().equals(ENodeType.SIMPLE_FOLDER)) {
                TreeItem item = getObject(viewer.getTree(), event.getElement());
                if (item != null) {
                    item.setImage(ImageProvider.getImage(ECoreImage.FOLDER_OPEN_ICON));
                }
            }
        }
    });
    viewer.addCheckStateListener(new ICheckStateListener() {

        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            RepositoryNode node = (RepositoryNode) event.getElement();
            List<RepositoryNode> objects = new ArrayList<RepositoryNode>();
            processItems(objects, node);
            if (event.getChecked()) {
                addedObjects.addAll(objects);
                removedObjects.removeAll(objects);
                checkedObjects.addAll(addedObjects);
            } else {
                addedObjects.removeAll(objects);
                removedObjects.addAll(objects);
                checkedObjects.removeAll(objects);
            }
            // set checked
            viewer.setCheckedElements(checkedObjects.toArray());
        // viewer.refresh();
        }
    });
    RepositoryNode[] nodes = contentProvider.getContents();
    List<RepositoryNode> objects = new ArrayList<RepositoryNode>();
    if (nodes != null) {
        for (RepositoryNode n : nodes) {
            processItems(objects, n);
            for (RepositoryNode node : objects) {
                if (isUseProjectSetting(node)) {
                    if (!checkedObjects.contains(node)) {
                        checkedObjects.add(node);
                    }
                }
            }
        }
    }
    viewer.setCheckedElements(checkedObjects.toArray());
    if (nodes != null) {
        viewer.setExpandedElements(nodes);
    }
}
Also used : Group(org.eclipse.swt.widgets.Group) TreeItem(org.eclipse.swt.widgets.TreeItem) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) ITreeViewerListener(org.eclipse.jface.viewers.ITreeViewerListener) ArrayList(java.util.ArrayList) FillLayout(org.eclipse.swt.layout.FillLayout) RepositoryLabelProvider(org.talend.core.repository.ui.view.RepositoryLabelProvider) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IViewSite(org.eclipse.ui.IViewSite) CheckboxRepositoryTreeViewer(org.talend.repository.viewer.ui.viewer.CheckboxRepositoryTreeViewer) GridData(org.eclipse.swt.layout.GridData) List(java.util.List) ArrayList(java.util.ArrayList) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) TreeExpansionEvent(org.eclipse.jface.viewers.TreeExpansionEvent)

Aggregations

IViewSite (org.eclipse.ui.IViewSite)15 FillLayout (org.eclipse.swt.layout.FillLayout)3 IActionBars (org.eclipse.ui.IActionBars)3 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 IStatusLineManager (org.eclipse.jface.action.IStatusLineManager)2 IToolBarManager (org.eclipse.jface.action.IToolBarManager)2 CheckStateChangedEvent (org.eclipse.jface.viewers.CheckStateChangedEvent)2 ICheckStateListener (org.eclipse.jface.viewers.ICheckStateListener)2 ITreeViewerListener (org.eclipse.jface.viewers.ITreeViewerListener)2 TreeExpansionEvent (org.eclipse.jface.viewers.TreeExpansionEvent)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 GridData (org.eclipse.swt.layout.GridData)2 Group (org.eclipse.swt.widgets.Group)2 TreeItem (org.eclipse.swt.widgets.TreeItem)2 WorkbenchLabelProvider (org.eclipse.ui.model.WorkbenchLabelProvider)2 ProjectRepositoryNode (org.talend.core.repository.model.ProjectRepositoryNode)2 RepositoryLabelProvider (org.talend.core.repository.ui.view.RepositoryLabelProvider)2 IRepositoryNode (org.talend.repository.model.IRepositoryNode)2