org.eclipse.jface.viewers.IOpenListener Java Examples

The following examples show how to use org.eclipse.jface.viewers.IOpenListener. 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: BonitaCompareEditorInput.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Viewer createDiffViewer(final Composite parent) {
    viewer = new DiffTreeViewer(parent, getCompareConfiguration());
    viewer.addOpenListener(new IOpenListener() {

        @Override
        public void open(final OpenEvent event) {
            final IStructuredSelection sel = (IStructuredSelection) event.getSelection();
            final DiffNode obj = (DiffNode) sel.getFirstElement();
            obj.setDontExpand(false);
        }
    });
    viewer.setFilters(getFilters());
    viewer.setLabelProvider(new DiffTreeLabelProvider());
    viewer.setContentProvider(new BonitaScriptRefactoringContentProvider());
    viewer.setInput(root);
    viewer.expandAll();

    return viewer;
}
 
Example #2
Source File: TreeConflictsView.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public void createPartControl(Composite parent) {
	GridLayout layout = new GridLayout();
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	layout.numColumns = 1;
	parent.setLayout(layout);		

	treeViewer = new TreeViewer(parent, SWT.FULL_SELECTION);
	treeViewer.setLabelProvider(new ConflictsLabelProvider());
	treeViewer.setContentProvider(new ConflictsContentProvider());
	treeViewer.setUseHashlookup(true);
	GridData layoutData = new GridData();
	layoutData.grabExcessHorizontalSpace = true;
	layoutData.grabExcessVerticalSpace = true;
	layoutData.horizontalAlignment = GridData.FILL;
	layoutData.verticalAlignment = GridData.FILL;
	treeViewer.getControl().setLayoutData(layoutData);
	TableLayout tableLayout = new TableLayout();
	treeViewer.getTree().setLayout(tableLayout);

	DisposeListener disposeListener = new DisposeListener() {
		public void widgetDisposed(DisposeEvent e) {
			TreeColumn col = (TreeColumn)e.getSource();
			if (col.getWidth() > 0) settings.put("TreeConflictsView.col." + col.getText(), col.getWidth()); //$NON-NLS-1$
		}			
	};
	for (int i = 0; i < columnHeaders.length; i++) {
		TreeColumn tc = new TreeColumn(treeViewer.getTree(), SWT.NONE,i);
		tc.setResizable(columnLayouts[i].resizable);
		tc.setText(columnHeaders[i]);
		setColumnWidth(tableLayout, disposeListener, tc, i);
	}
	
	treeViewer.getTree().setHeaderVisible(true);
	treeViewer.getTree().setLinesVisible(false);
	
	treeViewer.setInput(this);

	treeViewer.addOpenListener(new IOpenListener() {
		public void open(OpenEvent evt) {
			openAction.run();
		}	
	});
	
	createMenus();
	createToolbar();
	
	String path = settings.get("TreeConflictsView.resource"); //$NON-NLS-1$
	if (path != null) {
		boolean container = settings.getBoolean("TreeConflictsView.container"); //$NON-NLS-1$
		if (container) resource = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(new Path(path));
		else resource = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(path));
	}
	if (resource == null)
		setContentDescription(Policy.bind("TreeConflictsView.noResource")); //$NON-NLS-1$
	else
		setContentDescription(resource.getFullPath().toString());
}
 
Example #3
Source File: PackageViewerWrapper.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void addOpenListener(IOpenListener listener) {
	fViewer.addOpenListener(listener);
	fListenerList.add(listener);
}
 
Example #4
Source File: PackageViewerWrapper.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void removeOpenListener(IOpenListener listener) {
	fViewer.removeOpenListener(listener);
	fListenerList.remove(listener);
}