Java Code Examples for org.eclipse.swt.widgets.Tree.addSelectionListener()

The following are Jave code examples for showing how to use addSelectionListener() of the org.eclipse.swt.widgets.Tree class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: PDFReporter-Studio   File: GetinputNewWizardPage.java   View Source Code Vote up 5 votes
@Override
public void createControl(Composite parent) {
	if (loadedElementsList == null) getResourceInput();
	parentControl = parent;
	Composite container = new Composite(parent, SWT.NONE);
	container.setLayoutData(new GridData(GridData.FILL_VERTICAL));
	container.setLayout(new GridLayout(2, false));

	resourceList = new TreeViewer(container);
	resourceList.setContentProvider(new ViewContentProvider());
	resourceList.setLabelProvider(new ViewLabelProvider());
	resourceList.setInput(loadedElementsList);
	GridData treeData = new GridData(GridData.FILL_BOTH);
	treeData.widthHint = 350;
	resourceList.getControl().setLayoutData(treeData);

	Group infoGroup = new Group(container, SWT.NONE);
	infoGroup.setText(Messages.resource_wiz_information_title);
	infoGroup.setLayout(new GridLayout(2, false));
	GridData infoData = new GridData(GridData.FILL_BOTH);
	infoData.widthHint = 300;
	infoGroup.setLayoutData(infoData);

	pluginLbl = createInfoElement(infoGroup, Messages.resource_wiz_information_plugin, "");
	packageLbl = createInfoElement(infoGroup, Messages.resource_wiz_information_package, "");
	fileNameLbl = createInfoElement(infoGroup, Messages.resource_wiz_information_name, "");
	descriptionLbl = createInfoElement(infoGroup, Messages.resource_wiz_information_description, "");

	Tree tree = (Tree) resourceList.getControl();
	tree.addSelectionListener(new SelectionAdapter() {
	  @Override
	  public void widgetSelected(SelectionEvent e) {
			updateDescription((TreeItem)e.item);
	    }
	}); 
	
	setControl(container);
}
 
Example 2
Project: EsperDist   File: EventComposite.java   View Source Code Vote up 4 votes
public void init(){
	//all
	wholeSash=new SashForm(parent, SWT.VERTICAL|SWT.BORDER);
	//top
	topSash=new SashForm(wholeSash, SWT.HORIZONTAL|SWT.BORDER);
	
	middleSash=new SashForm(wholeSash, SWT.HORIZONTAL|SWT.BORDER);
	
	
	
	SashForm eplTextBtnSash=new SashForm(wholeSash, SWT.HORIZONTAL|SWT.BORDER);
	eplText=new Text(eplTextBtnSash, SWT.MULTI);
	submitBtn=new Button(eplTextBtnSash, SWT.BORDER|SWT.CENTER);
	submitBtn.setText("submit epl");
	
	infoText=new Text(wholeSash, SWT.MULTI);
	
	//top.left		
	eventTree=new Tree(topSash, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	eventTree.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));		
	eventTree.addSelectionListener(new TreeSelectionListener());
	
	//top.right
	initEventStatTable(topSash);
	
	//middle.left
	eplTable=new EplTable(middleSash,SWT.V_SCROLL|SWT.H_SCROLL|SWT.FULL_SELECTION);
	eplTable.getTable().addSelectionListener(new EplTableSelectionListener());
	initEplStatTable(middleSash);		
	
	topSash.setWeights(new int[]{1,3});
	middleSash.setWeights(new int[]{1,1});
	eplTextBtnSash.setWeights(new int[]{7,1});
	wholeSash.setWeights(new int[]{14,10,2,3});
	
	submitBtn.addSelectionListener(new SumbitButtonDownListener());
	eventTree.layout();
	eventStatTable.layout();
	topSash.layout();
	wholeSash.layout();
}
 
Example 3
Project: SMVHunter   File: NativeHeapPanel.java   View Source Code Vote up 4 votes
private void initializeDetailsTree(Tree tree) {
    tree.setHeaderVisible(true);
    tree.setLinesVisible(true);

    List<String> properties = Arrays.asList(new String[] {
            "Library",
            "Total",
            "Percentage",
            "Count",
            "Size",
            "Method",
    });

    List<String> sampleValues = Arrays.asList(new String[] {
            "/path/in/device/to/system/library.so",
            "123456789",
            " 100%",
            "123456789",
            "123456789",
            "PossiblyLongDemangledMethodName",
    });

    // right align numeric values
    List<Integer> swtFlags = Arrays.asList(new Integer[] {
            SWT.LEFT,
            SWT.RIGHT,
            SWT.RIGHT,
            SWT.RIGHT,
            SWT.RIGHT,
            SWT.LEFT,
    });

    for (int i = 0; i < properties.size(); i++) {
        String p = properties.get(i);
        String v = sampleValues.get(i);
        int flags = swtFlags.get(i);
        TableHelper.createTreeColumn(tree, p, flags, v, getPref("details", p), mPrefStore);
    }

    mDetailsTreeViewer = new TreeViewer(tree);

    mDetailsTreeViewer.setUseHashlookup(true);

    boolean displayZygotes = mPrefStore.getBoolean(PREFS_SHOW_ZYGOTE_ALLOCATIONS);
    mContentProviderByAllocations = new NativeHeapProviderByAllocations(mDetailsTreeViewer,
            displayZygotes);
    mContentProviderByLibrary = new NativeHeapProviderByLibrary(mDetailsTreeViewer,
            displayZygotes);
    if (mPrefStore.getBoolean(PREFS_GROUP_BY_LIBRARY)) {
        mDetailsTreeViewer.setContentProvider(mContentProviderByLibrary);
    } else {
        mDetailsTreeViewer.setContentProvider(mContentProviderByAllocations);
    }

    mDetailsTreeLabelProvider = new NativeHeapLabelProvider();
    mDetailsTreeViewer.setLabelProvider(mDetailsTreeLabelProvider);

    mDetailsTreeViewer.setInput(null);

    tree.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            displayStackTraceForSelection();
        }
    });
}
 
Example 4
Project: cmake-eclipse-helper   File: CMakeMainWizardPage.java   View Source Code Vote up 4 votes
private void createDynamicGroup(Composite parent) {
	Composite c = new Composite(parent, SWT.NONE);
	c.setLayoutData(new GridData(GridData.FILL_BOTH));
	c.setLayout(new GridLayout(2, true));

	Label l1 = new Label(c, SWT.NONE);
	l1.setText("Templates");
	l1.setFont(parent.getFont());
	l1.setLayoutData(new GridData(GridData.BEGINNING));

	rightLabel = new Label(c, SWT.NONE);
	rightLabel.setFont(parent.getFont());
	rightLabel.setText("Description");
	rightLabel.setLayoutData(new GridData(GridData.BEGINNING));

	tree = new Tree(c, SWT.SINGLE | SWT.BORDER);
	tree.setLayoutData(new GridData(GridData.FILL_BOTH));
	tree.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			TreeItem[] tis = tree.getSelection();
			if (tis == null || tis.length == 0)
				return;
			
			String description = (String)tis[0].getData(K_DESC);
			if ( description == null ) {
				description = "";
			}
			choice = tis[0];
			right.setText(description);
			//switchTo((CWizardHandler) tis[0].getData(), (EntryDescriptor) tis[0].getData(DESC));
			setPageComplete(validatePage());
		}
	});
	
	right = new Text(c, SWT.WRAP | SWT.BORDER);
	right.setEditable(false);
	l1.setFont(parent.getFont());
	right.setLayoutData(new GridData(GridData.FILL_BOTH));
	
	loadData();
}