use of org.eclipse.jface.viewers.IDoubleClickListener in project azure-tools-for-java by Microsoft.
the class BlobExplorerFileEditor method createTable.
private Table createTable(Composite parent) {
blobListTable = new Table(parent, SWT.BORDER | SWT.FULL_SELECTION);
blobListTable.setHeaderVisible(true);
blobListTable.setLinesVisible(true);
GridData gridData = new GridData();
// gridData.heightHint = 75;
gridData.horizontalAlignment = SWT.FILL;
gridData.verticalAlignment = SWT.FILL;
gridData.grabExcessVerticalSpace = true;
gridData.grabExcessHorizontalSpace = true;
GridLayout gridLayoutTable = new GridLayout();
gridLayoutTable.numColumns = 6;
gridLayoutTable.marginRight = 0;
blobListTable.setLayout(gridLayoutTable);
blobListTable.setLayoutData(gridData);
for (int i = 0; i < 6; i++) {
new TableColumn(blobListTable, SWT.FILL);
}
blobListTable.getColumn(0).setText("");
blobListTable.getColumn(1).setText("Name");
blobListTable.getColumn(2).setText("Size");
blobListTable.getColumn(3).setText("Last Modified (UTC)");
blobListTable.getColumn(4).setText("Content Type");
blobListTable.getColumn(5).setText("URL");
blobListTable.getColumn(0).setWidth(25);
blobListTable.getColumn(1).setWidth(280);
blobListTable.getColumn(2).setWidth(60);
blobListTable.getColumn(3).setWidth(110);
blobListTable.getColumn(4).setWidth(140);
blobListTable.getColumn(5).setWidth(250);
tableViewer = new TableViewer(blobListTable);
tableViewer.setUseHashlookup(true);
tableViewer.setContentProvider(new BlobListContentProvider());
tableViewer.setLabelProvider(new BlobListLabelProvider());
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
boolean directorySelected = tableViewer.getTable().getSelectionIndex() > -1 && isDirectorySelected();
deleteButton.setEnabled(!directorySelected);
// openButton.setEnabled(!directorySelected);
saveAsButton.setEnabled(!directorySelected);
}
});
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
tableSelection();
}
});
fillGrid();
return blobListTable;
}
use of org.eclipse.jface.viewers.IDoubleClickListener in project tdi-studio-se by Talend.
the class DatabaseTypeFilter method createDialogArea.
protected Control createDialogArea(Composite parent, String specifiedPId) {
Composite container = (Composite) super.createDialogArea(parent);
//$NON-NLS-1$
TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "before createDialogArea...");
GridData data = (GridData) container.getLayoutData();
data.minimumHeight = 400;
data.heightHint = 400;
data.minimumWidth = 500;
data.widthHint = 500;
container.setLayoutData(data);
createFilterField(container);
Composite viewContainer = new Composite(container, SWT.BORDER);
viewContainer.setLayout(new GridLayout());
viewContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
repositoryTreeViewer = RepoCommonViewerProvider.NORMAL.createViewer(viewContainer, specifiedPId);
//$NON-NLS-1$
TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "finshed createViewer");
repositoryTreeViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
addFilter(textFilter);
if (dbSupportFilter != null) {
addFilter(dbSupportFilter);
}
if (additionalFilters != null) {
addFilter(additionalFilters);
}
ViewerFilter filter = typeProcessor.makeFilter();
addFilter(filter);
//$NON-NLS-1$
TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "finshed add Filters");
//$NON-NLS-1$
TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "set input");
repositoryTreeViewer.expandToLevel(2);
//$NON-NLS-1$
TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "expandAll");
final Label label = new Label(container, SWT.NONE);
//$NON-NLS-1$
label.setText(Messages.getString("RepositoryReviewDialog.label"));
label.setForeground(new Color(null, 250, 0, 0));
label.setVisible(false);
// see feature 0003664: tRunJob: When opening the tree dialog to select the job target, it could be useful to
// open it on previous selected job if exists
selectNode();
//$NON-NLS-1$
TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "selectNode");
repositoryTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
boolean highlightOKButton = isSelectionValid(event);
getButton(IDialogConstants.OK_ID).setEnabled(highlightOKButton);
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
if (selection != null && !selection.isEmpty()) {
RepositoryNode node = (RepositoryNode) selection.getFirstElement();
if (!highlightOKButton && node.getType() == ENodeType.REPOSITORY_ELEMENT && node.getObjectType().equals(ERepositoryObjectType.METADATA_VALIDATION_RULES)) {
label.setVisible(true);
} else {
label.setVisible(false);
}
}
}
});
repositoryTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
if (getButton(IDialogConstants.OK_ID).isEnabled()) {
okPressed();
}
}
});
//$NON-NLS-1$
TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "finished createDialogArea...");
TimeMeasure.end(RepositoryReviewDialog.class.getSimpleName());
TimeMeasure.display = false;
TimeMeasure.displaySteps = false;
TimeMeasure.measureActive = false;
return container;
}
use of org.eclipse.jface.viewers.IDoubleClickListener in project tdi-studio-se by Talend.
the class JobVMArgumentsComposite method getTableControl.
/**
* Returns this field editor's list control.
*
* @param parent the parent control
* @return the list control
*/
protected TableViewer getTableControl(Composite parent) {
if (viewer == null) {
Table table = createTable(parent);
viewer = new TableViewer(table);
viewer.setContentProvider(createContentProvider());
viewer.setLabelProvider(createLabelProvider());
table.setFont(parent.getFont());
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
JobVMArgumentsComposite.this.selectionChanged();
}
});
viewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
editItem(event.getSelection());
}
});
}
// doLoadDefault();
return viewer;
}
use of org.eclipse.jface.viewers.IDoubleClickListener in project tdi-studio-se by Talend.
the class TnsEditorDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
TnsParser tnsparser = new TnsParser(tnsFile);
treeViewer = new TreeViewer(parent);
Tree tree = treeViewer.getTree();
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
GridData layoutData = new GridData(GridData.FILL_BOTH);
layoutData.heightHint = 400;
layoutData.widthHint = 300;
tree.setLayoutData(layoutData);
TreeColumn column1st = new TreeColumn(tree, SWT.NONE);
//$NON-NLS-1$
column1st.setText(Messages.getString("TnsEditorDialog.Service"));
column1st.setWidth(200);
TreeColumn column2nd = new TreeColumn(tree, SWT.NONE);
//$NON-NLS-1$
column2nd.setText(Messages.getString("TnsEditorDialog.Value"));
column2nd.setWidth(200);
treeViewer.setContentProvider(new TnsContentProvider());
treeViewer.setLabelProvider(new TnsTableProvider());
treeViewer.setInput(tnsparser.getTree());
treeViewer.expandAll();
treeViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
okPressed();
}
});
return tree;
}
use of org.eclipse.jface.viewers.IDoubleClickListener in project tdi-studio-se by Talend.
the class ProcessVersionComposite method addSortListener.
/**
* DOC Administrator Comment method "addSortListener".
*
* @param table
* @param column1
* @param column2
* @param column3
*/
private void addSortListener(final Table table, final TableColumn column1, final TableColumn column2, final TableColumn column3, final TableColumn column4) {
Listener sortListener = new Listener() {
private int direction = 1;
@Override
public void handleEvent(Event e) {
final TableColumn column = (TableColumn) e.widget;
if (column == table.getSortColumn()) {
direction = -direction;
}
if (direction == 1) {
table.setSortDirection(SWT.DOWN);
} else {
table.setSortDirection(SWT.UP);
}
table.setSortColumn(column);
tableViewer.setSorter(new ViewerSorter() {
int index = 0;
@Override
public void sort(Viewer viewer, Object[] elements) {
while (index < table.getColumns().length && table.getColumn(index) != column) {
index++;
}
super.sort(viewer, elements);
}
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
ITableLabelProvider labelProvider = (ITableLabelProvider) tableViewer.getLabelProvider();
String columnText = labelProvider.getColumnText(e1, index) != null ? labelProvider.getColumnText(e1, index) : //$NON-NLS-1$
"";
String columnText2 = labelProvider.getColumnText(e2, index) != null ? labelProvider.getColumnText(e2, index) : //$NON-NLS-1$
"";
return getComparator().compare(columnText, columnText2) * direction;
}
});
}
};
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
/*
* (non-Javadoc)
*
* @seeorg.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.
* SelectionChangedEvent)
*/
@Override
public void selectionChanged(SelectionChangedEvent event) {
ProcessVersionComposite.this.selection = event.getSelection();
if (getParentWizard() != null) {
((WizardPage) getParentWizard()).setPageComplete(true);
}
}
});
column1.addListener(SWT.Selection, sortListener);
column2.addListener(SWT.Selection, sortListener);
column3.addListener(SWT.Selection, sortListener);
column4.addListener(SWT.Selection, sortListener);
table.setSortColumn(column1);
table.setSortDirection(SWT.DOWN);
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
if (getParentWizard() == null) {
ITreeContextualAction editPropertiesAction = getEditPropertiesAction(EditPropertiesAction.class);
if (editPropertiesAction != null) {
editPropertiesAction.run();
}
}
}
});
}
Aggregations