下面列出了org.eclipse.swt.events.SelectionEvent#getSource ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@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();
}
}
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);
}
}
}
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();
}
}
}
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;
}
@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();
}
@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());
}
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);
}
@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();
}
@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());
}
@Override
public void widgetSelected(SelectionEvent e) {
if(e.getSource() == scale) {
lblMaxPercent.setText("Max. Percent: " + scale.getSelection()+ "%");
lblMaxPercent.getParent().layout();
}
}
@Override
public void widgetSelected(SelectionEvent e) {
if(e.getSource() == bubbleScale) {
lblBubbles.setText("Bubbles Scaling Factor: "+ String.format("%.2f", getScalingFactor()));
}
}
@Override
public void widgetSelected(SelectionEvent e) {
if(e.getSource() == scale) {
lblMaxPercent.setText("Max. Percent: " + scale.getSelection()+ "%");
lblMaxPercent.getParent().layout();
}
}
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();
}
public void widgetSelected(SelectionEvent e) {
Object source = e.getSource();
if (source == getBrowseProjectButton()) {
browseProject();
} else {
// read all fields into config and revalidate
updateLaunchConfigurationDialog();
}
}
@Override
public void widgetSelected(SelectionEvent e) {
if(e.getSource() == explosion) {
lblExplosion.setText("Explosion: " + String.valueOf(explosion.getSelection()));
}
}
public void widgetSelected(SelectionEvent e)
{
Object source = e.getSource();
if (source == buttonAdd)
{
doAdd();
} else if (source == buttonRemove)
{
doRemove();
} else if (source == buttonEdit)
{
doEdit();
}
}
@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);
}
}
@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;
}
}
}
public void widgetSelected(SelectionEvent e)
{
Object source = e.getSource();
handleWidgetSelected(source);
}
@Override
public void widgetSelected(SelectionEvent e) {
if(e.getSource() == tree ) {
if(!(tree.getSelectionCount() > 1)) {
IStructuredSelection currentSelection = (IStructuredSelection) treeViewer.getSelection();
selectedTerm = (Term) currentSelection.getFirstElement();
}
}
}