Java Code Examples for org.eclipse.swt.events.SelectionEvent#getSource()

The following examples show how to use org.eclipse.swt.events.SelectionEvent#getSource() . 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: SvnWizardAnnotatePage.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private SelectionListener getSelectionListener() {
	SelectionListener selectionListener = new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			if (e.getSource() == selectFromRevisionButton) {
				showLog(fromRevisionText);
			}
			else if (e.getSource() == toHeadButton || e.getSource() == toRevisionButton) {
				toRevisionText.setEnabled(toRevisionButton.getSelection());
				selectToRevisionButton.setEnabled(toRevisionButton.getSelection());
				if (toRevisionButton.getSelection()) toRevisionText.setFocus();					
			}
			else if (e.getSource() == selectToRevisionButton) {
				showLog(toRevisionText);					
			}
			setPageComplete(canFinish());
		}	
	};
	return selectionListener;
}
 
Example 2
Source File: ProjectNaturesPage.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void widgetSelected(SelectionEvent e)
{
	Object source = e.getSource();
	if (source == fSetPrimaryMenuItem || source == fMakePrimaryButton)
	{
		ISelection selection = fTableViewer.getSelection();
		if (!selection.isEmpty() && selection instanceof StructuredSelection)
		{
			Object firstElement = ((StructuredSelection) selection).getFirstElement();
			// make the element checked
			fTableViewer.setChecked(firstElement, true);
			// make it as primary
			updatePrimaryNature(firstElement.toString());
			fTableViewer.refresh();
			updateButtons();
		}
	}
}
 
Example 3
Source File: EnhancedTableViewer.java    From eclipse-cs with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void widgetSelected(SelectionEvent e) {

  if (e.getSource() instanceof TableColumn) {

    TableColumn col = (TableColumn) e.getSource();
    Table table = col.getParent();

    int colIndex = table.indexOf(col);

    if (colIndex == mSortedColumnIndex) {
      mSortDirection = mSortDirection * DIRECTION_REVERSE;
    } else {
      mSortedColumnIndex = colIndex;
      mSortDirection = DIRECTION_FORWARD;
    }

    resort();
    saveState();
  }
}
 
Example 4
Source File: CompilerWorkingDirectoryBlock.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
public void widgetSelected(SelectionEvent e) {
    Object source= e.getSource();
    if (source == fWorkspaceButton) {
        handleWorkspaceDirBrowseButtonSelected();
    }
    else if (source == fFileSystemButton) {
        handleWorkingDirBrowseButtonSelected();
    } 
    else if (source == fVariablesButton) {
        handleWorkingDirVariablesButtonSelected();
    } 
    
    else if(source == fRbDefaultDir || source == fRbOtherDir) {
        handleRadiobuttonSelected(fRbDefaultDir.getSelection());
        if (actionListener != null) {
            actionListener.actionPerformed(null);
        }
    }
}
 
Example 5
Source File: SortTreeColumnSelectionListener.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void sort(SelectionEvent e) {
	// 1) Get tree column which fire this selection event
	TreeColumn treeColumn = (TreeColumn) e.getSource();
	// 2) Get the owner tree
	Tree tree = treeColumn.getParent();
	// 3) Modify the SWT Tree sort
	tree.setSortColumn(treeColumn);
	tree.setSortDirection(getSortDirection());
}
 
Example 6
Source File: SettingsDialog.java    From slr-toolkit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void widgetSelected(SelectionEvent e) {
	if(e.getSource() == closeButton) {
		shell.close();
		return;
	}
	
	if(e.getSource() == applyButton) {			
		collectAndSaveSettings();			
		return;
	}
	
	if(e.getSource() == okButton) {
		collectAndSaveSettings();
		shell.close();
		return;
	}
	
	if(e.getSource() == comboChartSelect) {
		switch (comboChartSelect.getSelectionIndex()) {
			case 0:
				sl_stackComposite.topControl = pageBarChart;
				stackComposite.layout();
				break;
			case 1:
				sl_stackComposite.topControl = pageBubbleChart;
				stackComposite.layout();
				break;
			case 2:
				sl_stackComposite.topControl = pagePieChart;
				stackComposite.layout();
				break;
		}
	}		
}
 
Example 7
Source File: AbstractMainTab.java    From typescript.java with MIT License 5 votes vote down vote up
@Override
public void widgetSelected(SelectionEvent e) {
	setDirty(true);
	Object source = e.getSource();
	if (source == workspaceWorkingDirectoryButton) {
		handleWorkspaceWorkingDirectoryButtonSelected();
	} else if (source == fileWorkingDirectoryButton) {
		handleFileWorkingDirectoryButtonSelected();
	} else if (source == variablesWorkingDirectoryButton) {
		handleVariablesButtonSelected(workDirectoryField);
	}
}
 
Example 8
Source File: ValidateableTableSectionPart.java    From tlaplus with MIT License 5 votes vote down vote up
public void widgetSelected(SelectionEvent e)
{
    Object source = e.getSource();
    if (source == buttonAdd)
    {
        doAdd();
    } else if (source == buttonRemove)
    {
        doRemove();
    } else if (source == buttonEdit)
    {
        doEdit();
    }
}
 
Example 9
Source File: GeneralPagePie.java    From slr-toolkit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void widgetSelected(SelectionEvent e) {
	if(e.getSource() == explosion) {
		lblExplosion.setText("Explosion: " + String.valueOf(explosion.getSelection()));
	}
	
}
 
Example 10
Source File: AbstractLauncherTab.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
public void widgetSelected(SelectionEvent e) {
    Object source = e.getSource();
    if (source == getBrowseProjectButton()) {
        browseProject();
    } else {
        // read all fields into config and revalidate
        updateLaunchConfigurationDialog(); 
    }
}
 
Example 11
Source File: LibrarySelectorGroup.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private void setManualSelection(SelectionEvent event) {
  Preconditions.checkArgument(event.getSource() instanceof Button);

  Button button = (Button) event.getSource();
  Library clicked = (Library) button.getData();
  if (button.getSelection()) {
    explicitSelectedLibraries.add(clicked);
  } else {
    explicitSelectedLibraries.remove(clicked);
  }
  updateButtons();
  fireSelectionListeners();
}
 
Example 12
Source File: LegendPagePie.java    From slr-toolkit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void widgetSelected(SelectionEvent e) {
	if(e.getSource() == scale) {
		
		lblMaxPercent.setText("Max. Percent:  " + scale.getSelection()+ "%");			
		lblMaxPercent.getParent().layout(); 
	}
}
 
Example 13
Source File: GeneralPageBubble.java    From slr-toolkit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void widgetSelected(SelectionEvent e) {
	if(e.getSource() == bubbleScale) {
		lblBubbles.setText("Bubbles Scaling Factor: "+ String.format("%.2f", getScalingFactor()));
	}
	
}
 
Example 14
Source File: LegendPageBar.java    From slr-toolkit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void widgetSelected(SelectionEvent e) {
	if(e.getSource() == scale) {
		
		lblMaxPercent.setText("Max. Percent:  " + scale.getSelection()+ "%");			
		lblMaxPercent.getParent().layout(); 
	}
}
 
Example 15
Source File: SortTableColumnSelectionListener.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void sort(SelectionEvent e) {
	// 1) Get table column which fire this selection event
	TableColumn tableColumn = (TableColumn) e.getSource();
	// 2) Get the owner table
	Table table = tableColumn.getParent();
	// 3) Modify the SWT Table sort
	table.setSortColumn(tableColumn);
	table.setSortDirection(getSortDirection());
}
 
Example 16
Source File: SortTableColumnSelectionListener.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Table getParent(SelectionEvent e) {
	// 1) Get table column which fire this selection event
	TableColumn tableColumn = (TableColumn) e.getSource();
	// 2) Get the owner table
	return tableColumn.getParent();
}
 
Example 17
Source File: ResultAndNavigationPageLinksRenderer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void widgetSelected(SelectionEvent e) {
	// Link was clicked, update the page controller according to the
	// selected
	// link.
	Link hyperlink = (Link) e.getSource();
	int newCurrentPage = 0;
	if (hyperlink == previousLink) {
		newCurrentPage = getController().getCurrentPage() - 1;
	} else if (hyperlink == nextLink) {
		newCurrentPage = getController().getCurrentPage() + 1;
	} else if (hyperlink == pageLinks) {
		newCurrentPage = Integer.parseInt(e.text);
	}
	getController().setCurrentPage(newCurrentPage);
}
 
Example 18
Source File: SortTreeColumnSelectionListener.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Tree getParent(SelectionEvent e) {
	// 1) Get tree column which fire this selection event
	TreeColumn treeColumn = (TreeColumn) e.getSource();
	// 2) Get the owner tree
	return treeColumn.getParent();
}
 
Example 19
Source File: FindBarDecorator.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public void widgetSelected(SelectionEvent e)
{
	Object source = e.getSource();
	handleWidgetSelected(source);
}
 
Example 20
Source File: TreeDialogBar.java    From slr-toolkit with Eclipse Public License 1.0 3 votes vote down vote up
@Override
public void widgetSelected(SelectionEvent e) {
	if(e.getSource() == tree ) {
		if(!(tree.getSelectionCount() > 1)) {
			
			IStructuredSelection currentSelection = (IStructuredSelection) treeViewer.getSelection();
			
			selectedTerm = (Term) currentSelection.getFirstElement();
			
		}
	}
	
}