List of usage examples for org.eclipse.jface.viewers TableViewer TableViewer
public TableViewer(Composite parent, int style)
From source file:com.application.areca.launcher.gui.composites.HistoryComposite.java
License:Open Source License
public HistoryComposite(Composite parent) { super(parent, SWT.NONE); GridLayout layout = new GridLayout(1, false); layout.marginHeight = 0;/*from w w w . jav a 2 s.com*/ layout.marginWidth = 0; setLayout(layout); viewer = new TableViewer(this, SWT.BORDER | SWT.SINGLE); table = viewer.getTable(); table.setLinesVisible(AbstractWindow.getTableLinesVisible()); table.setHeaderVisible(true); TableColumn col1 = new org.eclipse.swt.widgets.TableColumn(table, SWT.NONE); col1.setMoveable(true); TableColumn col2 = new org.eclipse.swt.widgets.TableColumn(table, SWT.NONE); col2.setMoveable(true); table.getColumn(1).setText(RM.getLabel("history.datecolumn.label")); table.getColumn(0).setText(RM.getLabel("history.actioncolumn.label")); table.getColumn(1).setWidth(AbstractWindow.computeWidth(300)); table.getColumn(0).setWidth(AbstractWindow.computeWidth(400)); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); buildBottomComposite(this); }
From source file:com.application.areca.launcher.gui.composites.IndicatorsComposite.java
License:Open Source License
public IndicatorsComposite(Composite parent) { super(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0;// w w w . j a va 2 s. co m layout.marginWidth = 0; layout.numColumns = 1; setLayout(layout); viewer = new TableViewer(this, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL); table = viewer.getTable(); table.setLinesVisible(AbstractWindow.getTableLinesVisible()); table.setHeaderVisible(true); new org.eclipse.swt.widgets.TableColumn(table, SWT.NONE); new org.eclipse.swt.widgets.TableColumn(table, SWT.NONE); new org.eclipse.swt.widgets.TableColumn(table, SWT.NONE | SWT.WRAP); table.getColumn(0).setWidth(AbstractWindow.computeWidth(300)); table.getColumn(0).setMoveable(true); table.getColumn(1).setWidth(AbstractWindow.computeWidth(400)); table.getColumn(1).setMoveable(true); table.getColumn(2).setWidth(AbstractWindow.computeWidth(100)); table.getColumn(2).setAlignment(SWT.RIGHT); table.getColumn(2).setMoveable(true); GridData dt1 = new GridData(); dt1.grabExcessHorizontalSpace = true; dt1.grabExcessVerticalSpace = true; dt1.horizontalAlignment = SWT.FILL; dt1.verticalAlignment = SWT.FILL; table.setLayoutData(dt1); }
From source file:com.application.areca.launcher.gui.composites.PhysicalViewComposite.java
License:Open Source License
public PhysicalViewComposite(final CTabFolder parent) { super(parent, SWT.NONE); GridLayout lyt = new GridLayout(6, false); lyt.marginHeight = 0;//from ww w . j a v a 2 s . c o m lyt.marginBottom = 2; lyt.verticalSpacing = 2; lyt.marginWidth = 0; setLayout(lyt); viewer = new TableViewer(this, SWT.BORDER | SWT.MULTI); viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { application.showArchiveDetail(null); } }); table = viewer.getTable(); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 6, 1)); table.setLinesVisible(AbstractWindow.getTableLinesVisible()); table.setHeaderVisible(true); String[] titles = new String[] { ResourceManager.instance().getLabel("mainpanel.description.label"), ResourceManager.instance().getLabel("mainpanel.date.label"), ResourceManager.instance().getLabel("mainpanel.size.label") }; for (int i = 0; i < titles.length; i++) { TableColumn column = new TableColumn(table, SWT.NONE); column.setText(titles[i]); column.setMoveable(true); } table.getColumn(1).setWidth(AbstractWindow.computeWidth(200)); table.getColumn(0).setWidth(AbstractWindow.computeWidth(400)); table.getColumn(2).setWidth(AbstractWindow.computeWidth(150)); table.getColumn(2).setAlignment(SWT.RIGHT); table.addSelectionListener(this); table.setMenu(Application.getInstance().getActionContextMenu()); /* messageMainContainer = new Composite(this, SWT.NONE); messageMainContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 6, 1)); GridLayout lytMsg = new GridLayout(1, false); lytMsg.marginHeight = 1; lytMsg.marginWidth = 1; messageMainContainer.setLayout(lytMsg); */ Label lblIncrementalImg = new Label(this, SWT.NONE); lblIncrementalImg.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); lblIncrementalImg.setImage(ArecaImages.ICO_FS_FOLDER); Label lblIncremental = new Label(this, SWT.NONE); lblIncremental.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); lblIncremental.setText(ResourceManager.instance().getLabel("archivedetail.incremental.label")); Label lblDifferentialImg = new Label(this, SWT.NONE); lblDifferentialImg.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); lblDifferentialImg.setImage(ArecaImages.ICO_FS_FOLDER_DIFFERENTIAL); Label lblDifferential = new Label(this, SWT.NONE); lblDifferential.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); lblDifferential.setText(ResourceManager.instance().getLabel("archivedetail.differential.label")); Label lblFullImg = new Label(this, SWT.NONE); lblFullImg.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); lblFullImg.setImage(ArecaImages.ICO_FS_FOLDER_FULL); Label lblFull = new Label(this, SWT.NONE); lblFull.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); lblFull.setText(ResourceManager.instance().getLabel("archivedetail.full.label")); parent.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { Application.getInstance().setLatestVersionRecoveryMode(parent.getSelectionIndex() != 0); } }); }
From source file:com.application.areca.launcher.gui.composites.ProcessorsTable.java
License:Open Source License
public ProcessorsTable(Composite parent, TargetEditionWindow tge, boolean preprocess) { parent.setLayout(initLayout(5));/* w ww . jav a 2 s . co m*/ this.main = tge; this.preprocess = preprocess; TableViewer viewer = new TableViewer(parent, SWT.BORDER | SWT.SINGLE); tblProc = viewer.getTable(); GridData dt = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 2); dt.heightHint = AbstractWindow.computeHeight(50); tblProc.setLayoutData(dt); TableColumn col1 = new TableColumn(tblProc, SWT.NONE); col1.setText(RM.getLabel("targetedition.proctable.type.label")); col1.setWidth(AbstractWindow.computeWidth(200)); col1.setMoveable(true); TableColumn col2 = new TableColumn(tblProc, SWT.NONE); col2.setText(RM.getLabel("targetedition.proctable.parameters.label")); col2.setWidth(AbstractWindow.computeWidth(200)); col2.setMoveable(true); tblProc.setHeaderVisible(true); tblProc.setLinesVisible(AbstractWindow.getTableLinesVisible()); viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { editCurrentProcessor(); } }); btnUp = new Button(parent, SWT.PUSH); btnUp.setText(RM.getLabel("common.up.label")); btnUp.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false)); btnUp.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { up(); } }); btnDown = new Button(parent, SWT.PUSH); btnDown.setText(RM.getLabel("common.down.label")); btnDown.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); btnDown.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { down(); } }); btnAddProc = new Button(parent, SWT.PUSH); btnAddProc.setText(RM.getLabel("targetedition.addprocaction.label")); btnAddProc.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { Processor newproc = showProcEditionFrame(null); if (newproc != null) { addProcessor(newproc); main.publicRegisterUpdate(); } } }); btnModifyProc = new Button(parent, SWT.PUSH); btnModifyProc.setText(RM.getLabel("targetedition.editprocaction.label")); btnModifyProc.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { editCurrentProcessor(); } }); btnRemoveProc = new Button(parent, SWT.PUSH); btnRemoveProc.setText(RM.getLabel("targetedition.removeprocaction.label")); btnRemoveProc.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { removeCurrentProcessor(); } }); tblProc.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { updateProcListState(); } }); tblProc.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent evt) { if (evt.character == SWT.DEL) { removeCurrentProcessor(); } } public void keyReleased(KeyEvent evt) { } }); if (preprocess) { chkForwardErrors = new Button(parent, SWT.CHECK); chkForwardErrors.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); chkForwardErrors.setText(RM.getLabel("targetedition.fwderrors.label")); chkForwardErrors.setSelection(true); } }
From source file:com.application.areca.launcher.gui.composites.PropertiesComposite.java
License:Open Source License
public PropertiesComposite(Composite parent) { super(parent, SWT.NONE); GridLayout lt = new GridLayout(1, false); lt.marginHeight = 0;/*from w w w . j ava2 s .c o m*/ lt.marginWidth = 0; setLayout(lt); viewer = new TableViewer(this, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); table = viewer.getTable(); table.setLinesVisible(AbstractWindow.getTableLinesVisible()); table.setHeaderVisible(true); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); TableColumn col1 = new TableColumn(table, SWT.NONE); col1.setWidth(AbstractWindow.computeWidth(100)); col1.setMoveable(true); TableColumn col2 = new TableColumn(table, SWT.NONE); col2.setWidth(AbstractWindow.computeWidth(250)); col2.setMoveable(true); lnk = new Link(this, SWT.NONE); lnk.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); // REFRESH DATA this.refresh(); }
From source file:com.application.areca.launcher.gui.TargetEditionWindow.java
License:Open Source License
private void initSourcesTab(Composite composite) { composite.setLayout(initLayout(4));// w w w . j a v a 2 s .c o m TableViewer viewer = new TableViewer(composite, SWT.BORDER | SWT.MULTI); tblSources = viewer.getTable(); GridData dt = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1); dt.heightHint = computeHeight(100); tblSources.setLayoutData(dt); TableColumn col1 = new TableColumn(tblSources, SWT.NONE); col1.setText(RM.getLabel("targetedition.sourcedirfield.label")); col1.setWidth(AbstractWindow.computeWidth(400)); col1.setMoveable(true); tblSources.setHeaderVisible(true); tblSources.setLinesVisible(AbstractWindow.getTableLinesVisible()); viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { editCurrentSource(); } }); tblSources.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent evt) { if (evt.character == SWT.DEL) { deleteCurrentSource(); } } public void keyReleased(KeyEvent evt) { } }); Label lblRoot = new Label(composite, SWT.NONE | SWT.WRAP); lblRoot.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); lblRoot.setText(RM.getLabel("targetedition.globalroot.label")); lblRoot.setToolTipText(RM.getLabel("targetedition.globalroot.tt")); txtRootValue = new Text(composite, SWT.BORDER); txtRootValue.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); txtRootValue.setEnabled(false); txtRootValue.setToolTipText(RM.getLabel("targetedition.globalroot.tt")); Label lblDnd = new Label(composite, SWT.NONE | SWT.WRAP); lblDnd.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 4, 1)); lblDnd.setText(RM.getLabel("targetedition.sources.dnd.label")); btnAddSource = new Button(composite, SWT.PUSH); btnAddSource.setText(RM.getLabel("targetedition.addprocaction.label")); btnAddSource.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { File newFile = showSourceEditionFrame(null); if (newFile != null) { addSource(newFile); arrangeSources(); registerUpdate(); } } }); btnModifySource = new Button(composite, SWT.PUSH); btnModifySource.setText(RM.getLabel("targetedition.editprocaction.label")); btnModifySource.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { editCurrentSource(); } }); btnRemoveSource = new Button(composite, SWT.PUSH); btnRemoveSource.setText(RM.getLabel("targetedition.removeprocaction.label")); btnRemoveSource.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { deleteCurrentSource(); } }); tblSources.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { updateSourceListState(); } }); final int operation = DND.DROP_MOVE; Transfer[] types = new Transfer[] { FileTransfer.getInstance() }; DropTarget target = new DropTarget(tblSources, operation); target.setTransfer(types); target.addDropListener(new DropTargetAdapter() { public void dragEnter(DropTargetEvent event) { event.detail = operation; event.feedback = DND.FEEDBACK_SCROLL; } public void dragOver(DropTargetEvent event) { event.detail = operation; event.feedback = DND.FEEDBACK_SCROLL; } public void drop(DropTargetEvent event) { String[] files = (String[]) event.data; for (int i = 0; i < files.length; i++) { addSource(new File(files[i])); } arrangeSources(); registerUpdate(); } }); }
From source file:com.aptana.editor.common.internal.scripting.TemplateSelectionPage.java
License:Open Source License
public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); container.setLayout(GridLayoutFactory.swtDefaults().spacing(10, 10).create()); container.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); createAbove(container, 1);/*w w w . j a v a 2 s. c o m*/ Label label = new Label(container, SWT.NONE); label.setText(Messages.TemplateSelectionPage_available_templates); GridData gd = new GridData(); label.setLayoutData(gd); SashForm sashForm = new SashForm(container, SWT.VERTICAL); gd = new GridData(GridData.FILL_BOTH); // limit the width of the sash form to avoid the wizard // opening very wide. This is just preferred size - // it can be made bigger by the wizard // See bug #83356 gd.widthHint = 300; sashForm.setLayoutData(gd); templateSelectionViewer = new TableViewer(sashForm, SWT.BORDER); templateSelectionViewer.setContentProvider(new ListContentProvider()); templateSelectionViewer.setLabelProvider(new ListLabelProvider()); createPreview(sashForm); initializeViewer(); templateSelectionViewer.setInput(templates); templateSelectionViewer.addSelectionChangedListener(this); Dialog.applyDialogFont(container); setControl(container); }
From source file:com.aptana.editor.common.preferences.TasksPreferencePage.java
License:Open Source License
/** * @param parent// w w w .ja va 2 s . c o m */ private void createTaskTableArea(Composite parent) { fTasksTableViewer = new TableViewer(parent, SWT.BORDER | SWT.SINGLE); Table table = fTasksTableViewer.getTable(); table.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); table.setHeaderVisible(true); table.setLinesVisible(true); table.setFont(parent.getFont()); TableColumn tagNameColumn = new TableColumn(table, SWT.NONE); tagNameColumn.setText(Messages.TasksPreferencePage_TagNameColumnHeader); tagNameColumn.setWidth(100); TableColumn tagPriorityColumn = new TableColumn(table, SWT.NONE); tagPriorityColumn.setText(Messages.TasksPreferencePage_PriorityColumnHeader); tagPriorityColumn.setWidth(100); fTasksTableViewer.setContentProvider(ArrayContentProvider.getInstance()); fTasksTableViewer.setLabelProvider(new TaskLabelProvider()); fTasksTableViewer.setComparator(new ViewerComparator()); fTasksTableViewer.setInput(getTaskTags()); fTasksTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { // Enable/disable buttons updateButtonStates(); } }); createTaskButtons(parent); }
From source file:com.aptana.editor.php.internal.ui.dialog.CustomFilteredItemsSelectionDialog.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) *//*from ww w .ja va2 s .com*/ protected Control createDialogArea(Composite parent) { Composite dialogArea = (Composite) super.createDialogArea(parent); Composite content = new Composite(dialogArea, SWT.NONE); GridData gd = new GridData(GridData.FILL_BOTH); content.setLayoutData(gd); GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginWidth = 0; layout.marginHeight = 0; content.setLayout(layout); createHeader(content); pattern = new Text(content, SWT.SINGLE | SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); pattern.setLayoutData(gd); createExtras(content); createLabels(content); list = new TableViewer(content, (multi ? SWT.MULTI : SWT.SINGLE) | SWT.BORDER | SWT.V_SCROLL | SWT.VIRTUAL); list.setContentProvider(contentProvider); list.setLabelProvider(getItemsListLabelProvider()); list.setInput(new Object[0]); list.setItemCount(contentProvider.getElements(null).length); gd = new GridData(GridData.FILL_BOTH); list.getTable().setLayoutData(gd); createPopupMenu(); pattern.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { applyFilter(); } }); pattern.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.ARROW_DOWN) { if (list.getTable().getItemCount() > 0) { list.getTable().setFocus(); } } } }); list.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { StructuredSelection selection = (StructuredSelection) event.getSelection(); handleSelected(selection); } }); list.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { handleDoubleClick(); } }); list.getTable().addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.DEL) { List<?> selectedElements = ((StructuredSelection) list.getSelection()).toList(); Object item = null; boolean isSelectedHistory = true; for (Iterator<?> it = selectedElements.iterator(); it.hasNext();) { item = it.next(); if (item instanceof ItemsListSeparator || !isHistoryElement(item)) { isSelectedHistory = false; break; } } if (isSelectedHistory) { removeSelectedItems(selectedElements); } } if (e.keyCode == SWT.ARROW_UP && (e.stateMask & SWT.SHIFT) != 0 && (e.stateMask & SWT.CTRL) != 0) { StructuredSelection selection = (StructuredSelection) list.getSelection(); if (selection.size() == 1) { Object element = selection.getFirstElement(); if (element.equals(list.getElementAt(0))) { pattern.setFocus(); } if (list.getElementAt( list.getTable().getSelectionIndex() - 1) instanceof ItemsListSeparator) { list.getTable().setSelection(list.getTable().getSelectionIndex() - 1); } list.getTable().notifyListeners(SWT.Selection, new Event()); } } if (e.keyCode == SWT.ARROW_DOWN && (e.stateMask & SWT.SHIFT) != 0 && (e.stateMask & SWT.CTRL) != 0) { if (list.getElementAt(list.getTable().getSelectionIndex() + 1) instanceof ItemsListSeparator) { list.getTable().setSelection(list.getTable().getSelectionIndex() + 1); } list.getTable().notifyListeners(SWT.Selection, new Event()); } } }); createExtendedContentArea(content); details = new DetailsContentViewer(content, SWT.BORDER | SWT.FLAT); details.setVisible(toggleStatusLineAction.isChecked()); details.setContentProvider(new NullContentProvider()); details.setLabelProvider(getDetailsLabelProvider()); applyDialogFont(content); restoreDialog(getDialogSettings()); if (initialPatternText != null) { pattern.setText(initialPatternText); } switch (selectionMode) { case CARET_BEGINNING: pattern.setSelection(0, 0); break; case FULL_SELECTION: pattern.setSelection(0, initialPatternText.length()); break; } // apply filter even if pattern is empty (display history) applyFilter(); return dialogArea; }
From source file:com.aptana.editor.php.internal.ui.preferences.BuildPathEditingComposite.java
License:Open Source License
private void createDirectoryPart(TabItem item) { TabFolder parent2 = item.getParent(); Composite projectPart = new Composite(parent2, SWT.NONE); projectPart.setLayout(new GridLayout(2, false)); directoryViewer = new TableViewer(projectPart, SWT.BORDER | SWT.MULTI); directoryViewer.setLabelProvider(new LabelProvider() { @Override//from w w w . ja v a 2s. com public Image getImage(Object element) { return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER); } @Override public String getText(Object element) { File fl = (File) element; return fl.getAbsolutePath(); } }); directoryViewer.setContentProvider(new ArrayContentProvider()); directoryViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); Composite buttonsComp = new Composite(projectPart, SWT.NONE); buttonsComp.setLayoutData(new GridData(GridData.FILL_VERTICAL)); buttonsComp.setLayout(new GridLayout(1, false)); Button add = new Button(buttonsComp, SWT.NONE); add.setText(Messages.BuildPathEditingComposite_AddDirectory); add.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { DirectoryDialog dialog = new DirectoryDialog(Display.getCurrent().getActiveShell(), SWT.NONE); dialog.setText(Messages.BuildPathEditingComposite_AddDirectoryDescription); String open = dialog.open(); if (open != null) { addWithValidation(directoryViewer, new File(open)); } } }); add.setLayoutData(GridDataFactory.fillDefaults().hint(100, -1).create()); final Button remove = new Button(buttonsComp, SWT.NONE); remove.setText(Messages.BuildPathEditingComposite_RemoveDirectory); remove.setLayoutData(GridDataFactory.fillDefaults().hint(100, -1).create()); directoryViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { remove.setEnabled(!event.getSelection().isEmpty()); } }); remove.setEnabled(false); remove.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { IStructuredSelection sel = (IStructuredSelection) directoryViewer.getSelection(); Object[] selections = sel.toArray(); for (Object selected : selections) { directoryViewer.remove(selected); } } }); directoryViewer.setSorter(new ViewerSorter()); item.setControl(projectPart); }