List of usage examples for org.eclipse.jface.viewers TableViewer TableViewer
public TableViewer(Composite parent, int style)
From source file:com.freescale.deadlockpreventer.agent.StatisticsDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { parent.setLayout(new GridLayout(2, false)); viewer = new TableViewer(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); layoutData.horizontalSpan = 2;//from www .jav a 2 s.co m viewer.getTable().setLayoutData(layoutData); viewer.setContentProvider(new ViewContentProvider()); ColumnViewerToolTipSupport.enableFor(viewer, ToolTip.NO_RECREATE); viewer.setInput(locks); IFocusService service = (IFocusService) PlatformUI.getWorkbench().getService(IFocusService.class); service.addFocusTracker(viewer.getTable(), StatisticsDialog.class.getPackage().getName() + ".table"); viewer.setLabelProvider(new CellLabelProvider() { @Override public void update(ViewerCell cell) { Row element = (Row) cell.getElement(); if (cell.getColumnIndex() == 0) cell.setText(element.id); if (cell.getColumnIndex() == 1) cell.setText(Integer.toString(element.folllowersCount)); if (cell.getColumnIndex() == 2) cell.setText(Integer.toString(element.precedentsCount)); if (cell.getColumnIndex() == 3) cell.setText(element.location); } public String getToolTipText(Object element) { Row row = (Row) element; ILock[] locks = transaction.getLocks(row.index, row.index + 1); CharArrayWriter writer = new CharArrayWriter(); Logger.dumpLockInformation(locks, writer); return writer.toString(); } public Point getToolTipShift(Object object) { return new Point(5, 5); } public int getToolTipDisplayDelayTime(Object object) { return 2000; } public int getToolTipTimeDisplayed(Object object) { return 5000; } }); createTableViewerColumn("Lock", 200, 0); createTableViewerColumn("Followers", 70, 1); createTableViewerColumn("Precedents", 70, 2); createTableViewerColumn("Location", 250, 3); viewer.getTable().setHeaderVisible(true); viewer.getTable().setLinesVisible(true); comparator = new TableViewerComparator(); viewer.setComparator(comparator); Button button = new Button(parent, SWT.PUSH); button.setText("Export..."); layoutData = new GridData(SWT.BEGINNING, SWT.TOP, false, false); layoutData.widthHint = 80; button.setLayoutData(layoutData); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { StatisticsUtil.export(transaction); } }); Label label = new Label(parent, 0); label.setText("Total locks: " + locks.length); label.setLayoutData(new GridData(SWT.END, SWT.TOP, false, false)); return super.createDialogArea(parent); }
From source file:com.generalrobotix.ui.view.graph.SeriesDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(new RowLayout(SWT.VERTICAL)); RowData rowdata = new RowData(); rowdata.height = 100;/*from w ww .j a v a2s. co m*/ rowdata.width = 600; Label label = new Label(composite, SWT.LEFT); label.setText(MessageBundle.get("dialog.graph.series.dataseries")); //$NON-NLS-1$ tableviewer_ = new TableViewer(composite, SWT.FULL_SELECTION | SWT.BORDER); tableviewer_.getControl().setLayoutData(rowdata); Table table = tableviewer_.getTable(); table.setFont(Activator.getDefault().getFont("preference_table")); table.setLinesVisible(true); table.setHeaderVisible(true); TableColumn column = new TableColumn(table, SWT.NONE); column.setText(colNode); column.setWidth(100); column = new TableColumn(table, SWT.NONE); column.setText(colAttribute); column.setWidth(100); column = new TableColumn(table, SWT.NONE); column.setText(colIndex); column.setWidth(60); column = new TableColumn(table, SWT.NONE); column.setText(colColor); column.setWidth(60); column = new TableColumn(table, SWT.NONE); column.setText(colLegend); column.setWidth(280); String[] properties = new String[] { null, null, null, "color", "legend" }; //$NON-NLS-1$ //$NON-NLS-2$ tableviewer_.setColumnProperties(properties); CellEditor[] editors = new CellEditor[] { null, null, null, new ColorCellEditor(table), new TextCellEditor(table) }; tableviewer_.setCellEditors(editors); tableviewer_.setContentProvider(new ArrayContentProvider()); tableviewer_.setLabelProvider(new MyLabelProvider()); tableviewer_.setCellModifier(new MyCellModifier(tableviewer_)); tableviewer_.setInput(tableModel_.getList()); Composite line3 = new Composite(composite, SWT.NONE); line3.setLayout(new RowLayout()); Group group0 = new Group(line3, SWT.NONE); group0.setText(ROBOT_MODEL); group0.setLayout(new FillLayout()); comboModel_ = new Combo(group0, SWT.READ_ONLY); comboModel_.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { comboType_.removeAll(); comboLink_.removeAll(); comboAttr_.removeAll(); Iterator<String> it = nodeMap.keySet().iterator(); if (tableModel_.getRowCount() > 0) { String curAttr = currentGraph_.getTrendGraph().getDataItemInfoList()[0].dataItem.attribute; while (it.hasNext()) { String key = it.next(); if (nodeMap.get(key).contains(curAttr)) comboType_.add(key); } } else { while (it.hasNext()) { comboType_.add(it.next()); } } comboType_.setEnabled(true); comboLink_.setEnabled(false); comboAttr_.setEnabled(false); setButton_.setEnabled(false); if (comboType_.getItemCount() > 0) { comboType_.select(0); comboType_.notifyListeners(SWT.Selection, null); } } }); Group group1 = new Group(line3, SWT.NONE); group1.setText(DATA_TYPE); group1.setLayout(new FillLayout()); comboType_ = new Combo(group1, SWT.READ_ONLY); comboType_.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { comboLink_.removeAll(); comboAttr_.removeAll(); String type = comboType_.getItem(comboType_.getSelectionIndex()); String modelName = comboModel_.getItem(comboModel_.getSelectionIndex()); Iterator<GrxModelItem> it = currentModels_.iterator(); GrxModelItem model = null; while (it.hasNext()) { model = it.next(); if (model.getName().equals(modelName)) break; } if (type.equals("Joint")) { //$NON-NLS-1$ Vector<GrxLinkItem> li = model.links_; for (int i = 0; i < li.size(); i++) comboLink_.add(li.get(i).getName()); } else { String t = null; if (type.equals("ForceSensor")) //$NON-NLS-1$ t = "Force"; //$NON-NLS-1$ else if (type.equals("Gyro")) //$NON-NLS-1$ t = "RateGyro"; //$NON-NLS-1$ else if (type.equals("AccelerationSensor")) //$NON-NLS-1$ t = "Acceleration"; //$NON-NLS-1$ String[] snames = model.getSensorNames(t); if (snames != null) { for (int i = 0; i < snames.length; i++) { comboLink_.add(snames[i]); } } } comboLink_.setEnabled(true); comboAttr_.setEnabled(false); setButton_.setEnabled(false); if (comboLink_.getItemCount() > 0) { comboLink_.select(0); comboLink_.notifyListeners(SWT.Selection, null); } } }); Group group2 = new Group(line3, SWT.NONE); group2.setText(LINK_NAME); group2.setLayout(new FillLayout()); comboLink_ = new Combo(group2, SWT.READ_ONLY); comboLink_.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { comboAttr_.removeAll(); String type = comboType_.getItem(comboType_.getSelectionIndex()); List<String> l = nodeMap.get(type); if (type.equals("Joint")) { String modelName = comboModel_.getItem(comboModel_.getSelectionIndex()); Iterator<GrxModelItem> it = currentModels_.iterator(); GrxModelItem model = null; while (it.hasNext()) { model = it.next(); if (model.getName().equals(modelName)) break; } String linkName = comboLink_.getItem(comboLink_.getSelectionIndex()); boolean isControlJoint = false; if (model != null) { GrxLinkItem link = model.getLink(linkName); if (link != null) if (link.jointType_.equals("rotate") || link.jointType_.equals("slide")) isControlJoint = true; } if (tableModel_.getRowCount() > 0) { String curAttr = (String) tableModel_.getValueAt(0, 1); if (!isControlJoint) if (curAttr.equals("translation") || curAttr.equals("attitude")) comboAttr_.add(curAttr); else ; else if (l.contains(curAttr)) comboAttr_.add(curAttr); else ; } else { if (!isControlJoint) { comboAttr_.add("translation"); comboAttr_.add("attitude"); } else { Iterator<String> it0 = l.iterator(); while (it0.hasNext()) { comboAttr_.add(it0.next()); } } } } else { if (tableModel_.getRowCount() > 0) { String curAttr = (String) tableModel_.getValueAt(0, 1); if (l.contains(curAttr)) comboAttr_.add(curAttr); } else { Iterator<String> it0 = l.iterator(); while (it0.hasNext()) comboAttr_.add(it0.next()); } } comboAttr_.setEnabled(true); setButton_.setEnabled(comboAttr_.getItemCount() > 0); if (comboAttr_.getItemCount() > 0) comboAttr_.select(0); } }); Group group3 = new Group(line3, SWT.NONE); group3.setText(ATTRIBUTE); group3.setLayout(new FillLayout()); comboAttr_ = new Combo(group3, SWT.READ_ONLY); removeButton_ = new Button(line3, SWT.PUSH); removeButton_.setText(MessageBundle.get("dialog.graph.series.remove")); //$NON-NLS-1$ removeButton_.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { int ind = tableviewer_.getTable().getSelectionIndex(); if (ind < 0) return; tableModel_.removeRow(ind); tableviewer_.refresh(); int cnt = tableModel_.getRowCount(); if (cnt < 1) { _resetSelection(); return; } if (ind >= cnt) { ind -= 1; } tableviewer_.getTable().select(ind); } }); removeButton_.setEnabled(true); setButton_ = new Button(line3, SWT.PUSH); setButton_.setText(MessageBundle.get("dialog.graph.series.set")); //$NON-NLS-1$ setButton_.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { int length = 1; String combo1 = (String) comboType_.getItem(comboType_.getSelectionIndex()); if (combo1.equals("ForceSensor") || //$NON-NLS-1$ combo1.equals("AccelerationSensor") || //$NON-NLS-1$ combo1.equals("Gyro")) //$NON-NLS-1$ length = 3; String model = comboModel_.getItem(comboModel_.getSelectionIndex()); String link = comboLink_.getItem(comboLink_.getSelectionIndex()); String attr = comboAttr_.getItem(comboAttr_.getSelectionIndex()); if (combo1.equals("Joint") && (attr.equals("translation") || attr.equals("attitude"))) length = 3; for (int i = 0; i < length; i++) { String legend = model + "." + link + "." + attr + (length > 1 ? "." + i : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ if (!tableModel_.contains(legend)) { DataItemInfo newDataItemInfo = new DataItemInfo( new DataItem(model, link, attr, length > 1 ? i : -1, comboType_.getItem(comboType_.getSelectionIndex())), currentGraph_.getTrendGraph().getGraphColor(graphIndex), legend); tableModel_.addRow(newDataItemInfo, legend); tableviewer_.refresh(); graphIndex++; } } removeButton_.setEnabled(true); comboLink_.notifyListeners(SWT.Selection, null); } }); _resetSelection(); return composite; }
From source file:com.generalrobotix.ui.view.GrxPropertyView.java
License:Open Source License
/** * @brief constructor//from w w w .j a va 2 s.co m * @param name * @param manager * @param vp * @param parent */ public GrxPropertyView(String name, GrxPluginManager manager, GrxBaseViewPart vp, Composite parent) { super(name, manager, vp, parent); GrxDebugUtil.println("GrxPropertyView init"); //$NON-NLS-1$ GridLayout gl = new GridLayout(1, false); composite_.setLayout(gl); nameText_ = new Text(composite_, SWT.SINGLE | SWT.BORDER); GridData textGridData = new GridData(GridData.FILL_HORIZONTAL); textGridData.heightHint = 20; nameText_.setLayoutData(textGridData); final GrxPropertyView view = this; nameText_.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { } public void keyReleased(KeyEvent e) { if (e.character == SWT.CR && !nameText_.getText().equals(oldText)) { GrxBasePlugin p = null; if ((p = manager_.getView(nameText_.getText(), true)) != null) { if (currentPlugin_ != p) { if (currentPlugin_ != null) currentPlugin_.deleteObserver(view); _setInput(p); currentPlugin_ = p; currentPlugin_.addObserver(view); } } else if ((p = manager_.getItem(nameText_.getText())) != null) { manager_.focusedItem((GrxBaseItem) p); } else { nameText_.setText(""); //$NON-NLS-1$ if (currentPlugin_ != null) currentPlugin_.deleteObserver(view); _setInput(null); currentPlugin_ = null; } } } }); viewer_ = new TableViewer(composite_, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER | SWT.VIRTUAL); TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(40, true)); layout.addColumnData(new ColumnWeightData(60, true)); table_ = viewer_.getTable(); table_.setLayout(layout); GridData tableGridData = new GridData(GridData.FILL_BOTH); table_.setLayoutData(tableGridData); TableColumn column1 = new TableColumn(table_, SWT.LEFT); TableColumn column2 = new TableColumn(table_, SWT.LEFT); column1.setText(clmName_[0]); column2.setText(clmName_[1]); column1.setMoveable(true); column2.setMoveable(true); column1.addSelectionListener(new ColumnSelectionListener()); column2.addSelectionListener(new ColumnSelectionListener()); viewer_.setColumnProperties(clmName_); viewer_.setContentProvider(new PropertyTableContentProvider()); viewer_.setLabelProvider(new PropertyTableLabelProvider()); CellEditor[] editors = new CellEditor[] { new TextCellEditor(table_), new TextCellEditor(table_) }; viewer_.setCellEditors(editors); viewer_.setCellModifier(new PropertyTableCellModifier()); viewer_.setSorter(new PropertyTableViewerSorter()); table_.setLinesVisible(true); table_.setHeaderVisible(true); setScrollMinSize(SWT.DEFAULT, SWT.DEFAULT); setUp(); manager_.registerItemChangeListener(this, GrxBaseItem.class); // ? table_.setMenu(menuMgr_.createContextMenu(table_)); table_.addListener(SWT.MenuDetect, new Listener() { public void handleEvent(Event event) { final TableItem[] selection = table_.getSelection(); menuMgr_.removeAll(); if (selection.length != 0) menuMgr_.add(new Action() { public String getText() { return MessageBundle.get("GrxPropertyView.menu.InputValue"); } public void run() { InputDialog dialog = new InputDialog(null, getText(), MessageBundle.get("GrxPropertyView.dialog.message.input"), "", null); //$NON-NLS-1$ if (dialog.open() == InputDialog.OK && dialog.getValue() != null) { String _value = dialog.getValue(); String[] _key = new String[selection.length]; for (int i = 0; i < selection.length; i++) { // value ???????selection????????????key? _key[i] = selection[i].getText(0); } for (int i = 0; i < _key.length; i++) { if (isValidChangeValue(_key[i], _value) == false) continue; if (!currentPlugin_.getProperty(_key[i]).equals(_value)) { if (!currentPlugin_.propertyChanged(_key[i], _value)) { currentPlugin_.setProperty(_key[i], _value); } } } } } }); } }); updateTableFont(); }
From source file:com.generalrobotix.ui.view.GrxRobotStatView.java
License:Open Source License
public GrxRobotStatView(String name, GrxPluginManager manager, GrxBaseViewPart vp, Composite parent) { super(name, manager, vp, parent); osName_ = System.getProperty("os.name"); white_ = Activator.getDefault().getColor("white"); black_ = Activator.getDefault().getColor("black"); red_ = Activator.getDefault().getColor("red"); blue_ = Activator.getDefault().getColor("blue"); yellow_ = Activator.getDefault().getColor("yellow"); mainPanel_ = new Composite(composite_, SWT.NONE); GridLayout gridLayout = new GridLayout(1, false); gridLayout.marginHeight = 0;//from w w w . j ava 2s . co m gridLayout.verticalSpacing = 0; mainPanel_.setLayout(gridLayout); modelList_ = new ArrayList<GrxModelItem>(); comboModelName_ = new Combo(mainPanel_, SWT.READ_ONLY); GridData gridData = new GridData(); gridData.widthHint = COMBO_WIDTH; comboModelName_.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); comboModelName_.addSelectionListener(new SelectionAdapter() { //????????? public void widgetSelected(SelectionEvent e) { GrxModelItem item = modelList_.get(comboModelName_.getSelectionIndex()); if (item == null || item == currentModel_) return; currentModel_ = item; setJointList(); updateTableViewer(); } }); String[][] header = new String[][] { { "No", "Joint", "Angle", "Target", "Torque", "PWR", "SRV", "ARM", "T", "Pgain", "Dgain" }, { "1", "2", "3", "4", "5", "6", "7" }, }; boolean showheader[] = { true, false }; int[][] alignment = new int[][] { { SWT.RIGHT, SWT.LEFT, SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, SWT.CENTER, SWT.CENTER, SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, SWT.RIGHT }, { SWT.LEFT, SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, SWT.RIGHT }, }; for (int i = 0; i < 2; i++) { viewPanel_[i] = new Composite(mainPanel_, SWT.NONE); viewPanel_[i].setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout gridLayout1 = new GridLayout(); gridLayout1.marginHeight = 0; gridLayout1.marginWidth = 0; gridLayout1.horizontalSpacing = 0; gridLayout1.verticalSpacing = 0; viewPanel_[i].setLayout(gridLayout1); } jointTV_ = new TableViewer(viewPanel_[0], SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL); sensorTV_ = new TableViewer(viewPanel_[1], SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL); jointTV_.setContentProvider(new ArrayContentProvider()); sensorTV_.setContentProvider(new ArrayContentProvider()); jointTV_.setLabelProvider(new JointTableLabelProvider()); sensorTV_.setLabelProvider(new SensorTableLabelProvider()); viewers_ = new TableViewer[] { jointTV_, sensorTV_ }; TableColumnLayout[] layout = new TableColumnLayout[2]; for (int i = 0; i < viewers_.length; i++) { layout[i] = new TableColumnLayout(); for (int j = 0; j < header[i].length; j++) { TableColumn column = new TableColumn(viewers_[i].getTable(), SWT.NULL); column.setText(header[i][j]); column.setAlignment(alignment[i][j]); layout[i].setColumnData(column, new ColumnWeightData(columnWidth_[i][j], columnWidth_[i + 2][j])); if (i == 0) column.addControlListener(new ControlListener() { public void controlMoved(ControlEvent e) { } public void controlResized(ControlEvent e) { TableColumn column = (TableColumn) e.getSource(); int i = jointTV_.getTable().indexOf(column); int width = column.getWidth(); setInt("jcolumnWidth" + i, width); } }); else if (i == 1) column.addControlListener(new ControlListener() { public void controlMoved(ControlEvent e) { } public void controlResized(ControlEvent e) { TableColumn column = (TableColumn) e.getSource(); int i = sensorTV_.getTable().indexOf(column); int width = column.getWidth(); setInt("scolumnWidth" + i, width); } }); } viewPanel_[i].setLayout(layout[i]); viewers_[i].getTable().setHeaderVisible(showheader[i]); viewers_[i].getTable().setLinesVisible(true); viewers_[i].getTable().setLayoutData(new GridData(GridData.FILL_BOTH)); } //setScrollMinSize(SWT.DEFAULT,SWT.DEFAULT); setUp(); manager_.registerItemChangeListener(this, GrxModelItem.class); manager_.registerItemChangeListener(this, GrxWorldStateItem.class); }
From source file:com.generalrobotix.ui.view.simulation.CollisionPairPanel.java
License:Open Source License
public CollisionPairPanel(Composite parent, int style, GrxPluginManager manager) { super(parent, style); manager_ = manager;/*from ww w . java 2 s . com*/ //AttributeProperties props = AttributeProperties.getProperties("CollisionPair"); defaultStaticFriction_ = "0.5";//props.getProperty(ATTR_NAME_STATIC_FRICTION,AttributeProperties.PROPERTY_DEFAULT_VALUE); //$NON-NLS-1$ defaultSlidingFriction_ = "0.5";//props.getProperty(ATTR_NAME_SLIDING_FRICTION,AttributeProperties.PROPERTY_DEFAULT_VALUE); //$NON-NLS-1$ defaultCullingThresh_ = "0.01"; //$NON-NLS-1$ defaultRestitution_ = "0.0"; vecCollision_ = new Vector<GrxCollisionPairItem>(); setLayout(new GridLayout(1, false)); viewer_ = new TableViewer(this, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION); viewer_.getTable().setLayoutData(new GridData(GridData.FILL_BOTH)); viewer_.setContentProvider(new ArrayContentProvider()); viewer_.setLabelProvider(new InnerTableLabelProvider()); viewer_.getTable().addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { int row = viewer_.getTable().getSelectionIndex(); if (row >= 0 && row < vecCollision_.size()) { editorPanel_.setNode(vecCollision_.get(row)); } } }); TableLayout tableLayout = new TableLayout(); for (int i = 0; i < clmName_.length; i++) { new TableColumn(viewer_.getTable(), i).setText(clmName_[i]); ; tableLayout.addColumnData(new ColumnWeightData(1, true)); } viewer_.getTable().setLayout(tableLayout); viewer_.getTable().setHeaderVisible(true); viewer_.getTable().setLinesVisible(true); viewer_.setInput(vecCollision_); //viewer_.getTable().pack(); Composite pnlBttn = new Composite(this, SWT.NONE); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.heightHint = BUTTONS_HEIGHT; pnlBttn.setLayoutData(gridData); pnlBttn.setLayout(new FillLayout(SWT.HORIZONTAL)); btnAdd_ = new Button(pnlBttn, SWT.PUSH); btnAdd_.setText(MessageBundle.get("panel.add")); //$NON-NLS-1$ btnAdd_.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { _setButtonEnabled(false); editorPanel_.startAddMode(); } }); btnRemove_ = new Button(pnlBttn, SWT.PUSH); btnRemove_.setText(MessageBundle.get("panel.remove")); //$NON-NLS-1$ btnRemove_.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { int row = viewer_.getTable().getSelectionIndex(); if (row >= 0 && row < vecCollision_.size()) { if (_checkDialog(MessageBundle.get("collision.remove"))) { //$NON-NLS-1$ vecCollision_.get(row).delete(); } } } }); btnEdit_ = new Button(pnlBttn, SWT.PUSH); btnEdit_.setText(MessageBundle.get("panel.edit")); //$NON-NLS-1$ btnEdit_.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { int row = viewer_.getTable().getSelectionIndex(); if (row >= 0 && row < vecCollision_.size()) { _setButtonEnabled(false); editorPanel_.startEditMode(vecCollision_.get(row)); } } }); btnAddAll_ = new Button(pnlBttn, SWT.PUSH); btnAddAll_.setText(MessageBundle.get("panel.addAll")); //$NON-NLS-1$ btnAddAll_.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { manager_.refuseItemChange(); List<GrxModelItem> list = manager_.<GrxModelItem>getSelectedItemList(GrxModelItem.class); for (int i = 0; i < list.size(); i++) { GrxModelItem m1 = list.get(i); for (int j = i; j < list.size(); j++) { GrxModelItem m2 = list.get(j); for (int k = 0; k < m1.links_.size(); k++) { int l = 0; if (i == j) l = k; for (; l < m2.links_.size(); l++) { if (i != j || k != l) { editorPanel_.txtStaticFric_.setText(defaultStaticFriction_); editorPanel_.txtSlidingFric_.setText(defaultSlidingFriction_); editorPanel_.txtCullingThresh_.setText(defaultCullingThresh_); editorPanel_.txtRestitution_.setText(defaultRestitution_); _createItem(m1.getName(), m1.links_.get(k).getName(), m2.getName(), m2.links_.get(l).getName()); } } } } } manager_.acceptItemChange(); } }); Composite editorPanelComposite = new Composite(this, SWT.NONE); GridData editorPanelGridData = new GridData(GridData.FILL_HORIZONTAL); editorPanelComposite.setLayoutData(editorPanelGridData); editorPanelComposite.setLayout(new FillLayout(SWT.HORIZONTAL)); editorPanel_ = new CollisionPairEditorPanel(editorPanelComposite, SWT.NONE); updateTableFont(); }
From source file:com.generalrobotix.ui.view.simulation.ControllerPanel.java
License:Open Source License
public ControllerPanel(Composite parent, int style, GrxPluginManager manager) { super(parent, style); manager_ = manager;// w w w .ja v a 2 s.c o m vecRobot_ = new Vector<GrxModelItem>(); setLayout(new GridLayout(1, false)); viewer_ = new TableViewer(this, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION); viewer_.setContentProvider(new ArrayContentProvider()); viewer_.setLabelProvider(new ControllerPanelTableLabelProvider()); TableLayout tableLayout = new TableLayout(); for (int i = 0; i < clmName_.length; i++) { new TableColumn(viewer_.getTable(), i).setText(clmName_[i]); tableLayout.addColumnData(new ColumnWeightData(1, true)); } viewer_.getTable().setLayout(tableLayout); viewer_.getTable().setHeaderVisible(true); viewer_.getTable().addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { int row = viewer_.getTable().getSelectionIndex(); if (row >= 0 && row < vecRobot_.size()) { editorPanel_.setNode(vecRobot_.get(row)); } } }); viewer_.getTable().setLinesVisible(true); viewer_.getTable().setLayoutData(new GridData(GridData.FILL_BOTH)); viewer_.setInput(vecRobot_); Composite pnlBttn = new Composite(this, SWT.NONE); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.heightHint = BUTTONS_HEIGHT; pnlBttn.setLayoutData(gridData); pnlBttn.setLayout(new FillLayout(SWT.HORIZONTAL)); btnRemove_ = new Button(pnlBttn, SWT.PUSH); btnRemove_.setText(MessageBundle.get("panel.detach")); //$NON-NLS-1$ btnRemove_.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { int row = viewer_.getTable().getSelectionIndex(); if (row >= 0 && row < vecRobot_.size()) { if (_checkDialog(MessageBundle.get("controller.remove"))) //$NON-NLS-1$ { GrxModelItem node = vecRobot_.get(row); try { node.setProperty(ATTRIBUTE_CONTROLLER, ""); //$NON-NLS-1$ node.setProperty(ATTRIBUTE_CONTROL_TIME, ""); //$NON-NLS-1$ node.setProperty(ATTRIBUTE_SETUP_DIRECTORY, ""); //$NON-NLS-1$ node.setProperty(ATTRIBUTE_SETUP_COMMAND, ""); //$NON-NLS-1$ } catch (Exception ex) { ex.printStackTrace(); } _repaint(); } } } }); btnEdit_ = new Button(pnlBttn, SWT.PUSH); btnEdit_.setText(MessageBundle.get("panel.edit")); //$NON-NLS-1$ btnEdit_.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { int row = viewer_.getTable().getSelectionIndex(); if (row >= 0 && row < vecRobot_.size()) { _setButtonEnabled(false); editorPanel_.startEditMode(vecRobot_.get(row)); } } }); String[] names = GrxCorbaUtil.getObjectNameList(); if (names == null) { names = new String[0]; } Composite editorPanelComposite = new Composite(this, SWT.NONE); GridData editorPanelGridData = new GridData(GridData.FILL_HORIZONTAL); editorPanelComposite.setLayoutData(editorPanelGridData); editorPanelComposite.setLayout(new FillLayout(SWT.HORIZONTAL)); editorPanel_ = new ControllerEditorPanel(editorPanelComposite, SWT.NONE, names); updateTableFont(); }
From source file:com.genuitec.eclipse.gerrit.tools.internal.utils.dialogs.TagAndPushDialog.java
License:Open Source License
private void createRepositoriesList(Composite parent) { Label l = new Label(parent, SWT.NONE); l.setText("List of repositories:"); l.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1)); TableViewer list = new TableViewer(parent, SWT.V_SCROLL + SWT.H_SCROLL + SWT.BORDER); list.setLabelProvider(new LabelProvider() { private Image img = UIIcons.REPOSITORY.createImage(); @Override/*from w w w.ja v a 2s .com*/ public Image getImage(Object element) { return img; } @Override public void dispose() { img.dispose(); } @Override public String getText(Object element) { return ((Repository) element).getDirectory().getParentFile().getName(); } }); list.setContentProvider(new ArrayContentProvider()); list.setInput(repos); Table lst = list.getTable(); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1); gd.heightHint = 200; lst.setLayoutData(gd); }
From source file:com.github.librecut.internal.cutter.wizards.SelectCutterWizardPage.java
License:Open Source License
@Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, false); container.setLayout(layout);//from w w w .j a v a2 s.co m tableViewer = new TableViewer(container, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); tableViewer.getTable().setHeaderVisible(true); GridData gridData = new GridData(GridData.FILL_HORIZONTAL, GridData.FILL_VERTICAL, true, true); gridData.widthHint = 420; gridData.heightHint = 250; tableViewer.getTable().setLayoutData(gridData); tableViewer.setContentProvider(ArrayContentProvider.getInstance()); TableViewerColumn columnName = new TableViewerColumn(tableViewer, SWT.LEFT); columnName.getColumn().setText("Cutter"); columnName.getColumn().setWidth(300); columnName.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object obj) { if (obj instanceof ICutter) { return ((ICutter) obj).getDescriptor().getName(); } return super.getText(obj); } }); TableViewerColumn columnState = new TableViewerColumn(tableViewer, SWT.LEFT); columnState.getColumn().setText("Status"); columnState.getColumn().setWidth(100); columnState.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object obj) { if (obj instanceof ICutter) { DeviceState state = stateMap.get(obj); if (state == null) { return "Unknown"; } return state.name(); } return super.getText(obj); } }); listener = new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { selectedCutters[0] = null; ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { Object obj = ((IStructuredSelection) selection).getFirstElement(); if (obj instanceof ICutter) { DeviceState state = stateMap.get(obj); if (state == DeviceState.Ready) { selectedCutters[0] = (ICutter) obj; } } } setPageComplete(selectedCutters[0] != null); } }; tableViewer.addSelectionChangedListener(listener); tableViewer.setInput(cutters); setControl(container); setPageComplete(false); cutterUpdateJob = new Job("Updating cutter status...") { @Override protected IStatus run(IProgressMonitor monitor) { try { for (ICutter cutter : cutters) { DeviceState state = cutter.getDeviceState(); stateMap.put(cutter, state); } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { tableViewer.refresh(); } }); return Status.OK_STATUS; } finally { schedule(CUTTER_UPDATE_SLEEPING_TIME_MILLIS); } } }; cutterUpdateJob.schedule(); }
From source file:com.github.n_i_e.deepfolderview.SwtDuplicateMenu.java
License:Apache License
/** * Create contents of the window.//from w w w . j a v a 2 s .co m */ private void createContents() { shell = new Shell(); shell.setImage(SWTResourceManager.getImage(SwtDuplicateMenu.class, "/com/github/n_i_e/deepfolderview/icon/drive-harddisk.png")); shell.setMinimumSize(new Point(300, 200)); shell.setSize(640, 480); GridLayout gl_shell = new GridLayout(1, false); gl_shell.verticalSpacing = 6; gl_shell.marginWidth = 3; gl_shell.marginHeight = 3; gl_shell.horizontalSpacing = 6; shell.setLayout(gl_shell); Menu menu = new Menu(shell, SWT.BAR); shell.setMenuBar(menu); MenuItem mntmFile = new MenuItem(menu, SWT.CASCADE); mntmFile.setText(Messages.mntmFile_text); Menu menuFile = new Menu(mntmFile); mntmFile.setMenu(menuFile); MenuItem mntmOpen_1 = new MenuItem(menuFile, SWT.NONE); mntmOpen_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onOpenSelected(e); } }); mntmOpen_1.setText(Messages.mntmOpen_text); MenuItem mntmOpenInNew_1 = new MenuItem(menuFile, SWT.NONE); mntmOpenInNew_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onOpenInNewWindowSelected(e); } }); mntmOpenInNew_1.setText(Messages.mntmOpenInNewWindow_text); MenuItem mntmCopyTo_2 = new MenuItem(menuFile, SWT.NONE); mntmCopyTo_2.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onCopyToSelected(); } }); mntmCopyTo_2.setText(Messages.mntmCopyTo_text); MenuItem mntmClose = new MenuItem(menuFile, SWT.NONE); mntmClose.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onCloseSelected(); } }); mntmClose.setText(Messages.mntmClose_text); MenuItem mntmQuit = new MenuItem(menuFile, SWT.NONE); mntmQuit.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onQuitSelected(); } }); mntmQuit.setText(Messages.mntmQuit_text); MenuItem mntmEdit = new MenuItem(menu, SWT.CASCADE); mntmEdit.setText(Messages.mntmEdit_text); Menu menuEdit = new Menu(mntmEdit); mntmEdit.setMenu(menuEdit); MenuItem mntmRun_1 = new MenuItem(menuEdit, SWT.NONE); mntmRun_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onRunSelected(); } }); mntmRun_1.setText(Messages.mntmRun_text); MenuItem mntmCopyAsString_1 = new MenuItem(menuEdit, SWT.NONE); mntmCopyAsString_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onCopyAsStringSelected(); } }); mntmCopyAsString_1.setText(Messages.mntmCopyAsString_text); MenuItem mntmCopyTo_1 = new MenuItem(menuEdit, SWT.NONE); mntmCopyTo_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onCopyToSelected(); } }); mntmCopyTo_1.setText(Messages.mntmCopyTo_text); MenuItem mntmVisibility = new MenuItem(menu, SWT.CASCADE); mntmVisibility.setText(Messages.mntmVisibility_text); Menu menuVisibility = new Menu(mntmVisibility); mntmVisibility.setMenu(menuVisibility); final MenuItem mntmFoldersVisible = new MenuItem(menuVisibility, SWT.CHECK); mntmFoldersVisible.setSelection(folder_is_checked); mntmFoldersVisible.setText(Messages.mntmFoldersVisible_text); final MenuItem mntmFilesVisible = new MenuItem(menuVisibility, SWT.CHECK); mntmFilesVisible.setSelection(file_is_checked); mntmFilesVisible.setText(Messages.mntmFilesVisible_text); final MenuItem mntmCompressedFoldersVisible = new MenuItem(menuVisibility, SWT.CHECK); mntmCompressedFoldersVisible.setSelection(compressedfolder_is_checked); mntmCompressedFoldersVisible.setText(Messages.mntmCompressedFoldersVisible_text); final MenuItem mntmCompressedFilesVisible = new MenuItem(menuVisibility, SWT.CHECK); mntmCompressedFilesVisible.setSelection(compressedfile_is_checked); mntmCompressedFilesVisible.setText(Messages.mntmCompressedFilesVisible_text); MenuItem mntmHelp = new MenuItem(menu, SWT.CASCADE); mntmHelp.setText(Messages.mntmHelp_text); Menu menuHelp = new Menu(mntmHelp); mntmHelp.setMenu(menuHelp); MenuItem mntmOpenSourceLicenses = new MenuItem(menuHelp, SWT.NONE); mntmOpenSourceLicenses.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { new SwtOpenSourceLicenses(shell, SWT.TITLE | SWT.MIN | SWT.MAX | SWT.CLOSE).open(); } }); mntmOpenSourceLicenses.setText(Messages.mntmOpenSourceLicenses_text); compositeToolBar = new Composite(shell, SWT.NONE); compositeToolBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); compositeToolBar.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); compositeToolBar.setFont(SWTResourceManager.getFont("Meiryo UI", 12, SWT.NORMAL)); GridLayout gl_compositeToolBar = new GridLayout(5, false); gl_compositeToolBar.horizontalSpacing = 0; gl_compositeToolBar.verticalSpacing = 0; gl_compositeToolBar.marginWidth = 0; gl_compositeToolBar.marginHeight = 0; compositeToolBar.setLayout(gl_compositeToolBar); formToolkit.adapt(compositeToolBar); formToolkit.paintBordersFor(compositeToolBar); Button btnLeft = new Button(compositeToolBar, SWT.NONE); btnLeft.setImage(SWTResourceManager.getImage(SwtDuplicateMenu.class, "/com/github/n_i_e/deepfolderview/icon/go-previous.png")); btnLeft.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onNavigatePreviousSelected(e); } }); btnLeft.setFont(SWTResourceManager.getFont("Meiryo UI", 11, SWT.NORMAL)); formToolkit.adapt(btnLeft, true, true); Button btnRight = new Button(compositeToolBar, SWT.NONE); btnRight.setImage(SWTResourceManager.getImage(SwtDuplicateMenu.class, "/com/github/n_i_e/deepfolderview/icon/go-next.png")); btnRight.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onNavigateNextSelected(e); } }); btnRight.setFont(SWTResourceManager.getFont("Meiryo UI", 11, SWT.NORMAL)); formToolkit.adapt(btnRight, true, true); Button btnUp = new Button(compositeToolBar, SWT.NONE); btnUp.setImage(SWTResourceManager.getImage(SwtDuplicateMenu.class, "/com/github/n_i_e/deepfolderview/icon/go-up.png")); btnUp.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onUpperFolderSelected(e); } }); formToolkit.adapt(btnUp, true, true); txtLocation = new Text(compositeToolBar, SWT.BORDER); txtLocation.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent arg0) { onLocationModified(arg0); } }); GridData gd_txtLocation = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_txtLocation.widthHint = 200; txtLocation.setLayoutData(gd_txtLocation); txtLocation.setFont(SWTResourceManager.getFont("Meiryo UI", 11, SWT.NORMAL)); formToolkit.adapt(txtLocation, true, true); Button btnRefresh = new Button(compositeToolBar, SWT.NONE); btnRefresh.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { refresh(); } }); btnRefresh.setImage(SWTResourceManager.getImage(SwtDuplicateMenu.class, "/com/github/n_i_e/deepfolderview/icon/view-refresh.png")); formToolkit.adapt(btnRefresh, true, true); final TableViewer tableViewer = new TableViewer(shell, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL); table = tableViewer.getTable(); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); //table = new Table(scrolledComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL); table.setHeaderVisible(true); table.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onTableSelected(e); } @Override public void widgetDefaultSelected(SelectionEvent e) { onOpenSelected(e); } }); formToolkit.adapt(table); formToolkit.paintBordersFor(table); final TableColumn tblclmnPathL = new TableColumn(table, SWT.NONE); tblclmnPathL.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { table.setSortColumn(tblclmnPathL); if (table.getSortDirection() == SWT.UP) { table.setSortDirection(SWT.DOWN); } else { table.setSortDirection(SWT.UP); } onTblclmnPathLSelected(tblclmnPathL, e); } }); tblclmnPathL.setWidth(230); tblclmnPathL.setText(Messages.tblclmnPath_text); setTableSortDirection(tblclmnPathL, "path", orderL); final TableColumn tblclmnDateLastModifiedL = new TableColumn(table, SWT.LEFT); tblclmnDateLastModifiedL.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { table.setSortColumn(tblclmnDateLastModifiedL); if (table.getSortDirection() == SWT.UP) { table.setSortDirection(SWT.DOWN); } else { table.setSortDirection(SWT.UP); } onTblclmnDateLastModifiedLSelected(tblclmnDateLastModifiedL, e); } }); tblclmnDateLastModifiedL.setWidth(136); tblclmnDateLastModifiedL.setText(Messages.tblclmnDateLastModified_text); setTableSortDirection(tblclmnDateLastModifiedL, "datelastmodified", orderL); final TableColumn tblclmnSizeL = new TableColumn(table, SWT.RIGHT); tblclmnSizeL.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { table.setSortColumn(tblclmnSizeL); if (table.getSortDirection() == SWT.UP) { table.setSortDirection(SWT.DOWN); } else { table.setSortDirection(SWT.UP); } onTblclmnSizeLSelected(tblclmnSizeL, e); } }); tblclmnSizeL.setWidth(110); tblclmnSizeL.setText(Messages.tblclmnSize_text); setTableSortDirection(tblclmnSizeL, "size", orderL); final TableColumn tblclmnCompressedsizeL = new TableColumn(table, SWT.RIGHT); tblclmnCompressedsizeL.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { table.setSortColumn(tblclmnCompressedsizeL); if (table.getSortDirection() == SWT.UP) { table.setSortDirection(SWT.DOWN); } else { table.setSortDirection(SWT.UP); } onTblclmnCompressedsizeLSelected(tblclmnCompressedsizeL, e); } }); tblclmnCompressedsizeL.setWidth(110); tblclmnCompressedsizeL.setText(Messages.tblclmnCompressedesize_text); setTableSortDirection(tblclmnCompressedsizeL, "compressedsize", orderL); final TableColumn tblclmnPathR = new TableColumn(table, SWT.LEFT); tblclmnPathR.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { table.setSortColumn(tblclmnPathR); if (table.getSortDirection() == SWT.UP) { table.setSortDirection(SWT.DOWN); } else { table.setSortDirection(SWT.UP); } onTblclmnPathSelected(tblclmnPathR, e); } }); tblclmnPathR.setWidth(230); tblclmnPathR.setText(Messages.tblclmnPath_text); setTableSortDirection(tblclmnPathR, "path", orderR); final TableColumn tblclmnDateLastModifiedR = new TableColumn(table, SWT.LEFT); tblclmnDateLastModifiedR.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { table.setSortColumn(tblclmnDateLastModifiedR); if (table.getSortDirection() == SWT.UP) { table.setSortDirection(SWT.DOWN); } else { table.setSortDirection(SWT.UP); } onTblclmnDateLastModifiedSelected(tblclmnDateLastModifiedR, e); } }); tblclmnDateLastModifiedR.setWidth(136); tblclmnDateLastModifiedR.setText(Messages.tblclmnDateLastModified_text); setTableSortDirection(tblclmnDateLastModifiedR, "datelastmodified", orderR); final TableColumn tblclmnSizeR = new TableColumn(table, SWT.RIGHT); tblclmnSizeR.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { table.setSortColumn(tblclmnSizeR); if (table.getSortDirection() == SWT.UP) { table.setSortDirection(SWT.DOWN); } else { table.setSortDirection(SWT.UP); } onTblclmnSizeSelected(tblclmnSizeR, e); } }); tblclmnSizeR.setWidth(110); tblclmnSizeR.setText(Messages.tblclmnSize_text); setTableSortDirection(tblclmnSizeR, "size", orderR); final TableColumn tblclmnCompressedsizeR = new TableColumn(table, SWT.RIGHT); tblclmnCompressedsizeR.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { table.setSortColumn(tblclmnCompressedsizeR); if (table.getSortDirection() == SWT.UP) { table.setSortDirection(SWT.DOWN); } else { table.setSortDirection(SWT.UP); } onTblclmnCompressedsizeSelected(tblclmnCompressedsizeR, e); } }); tblclmnCompressedsizeR.setWidth(110); tblclmnCompressedsizeR.setText(Messages.tblclmnCompressedesize_text); setTableSortDirection(tblclmnCompressedsizeR, "compressedsize", orderR); Menu popupMenu = new Menu(table); table.setMenu(popupMenu); MenuItem mntmRun = new MenuItem(popupMenu, SWT.NONE); mntmRun.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onRunSelected(); } }); mntmRun.setText(Messages.mntmRun_text); MenuItem mntmOpen = new MenuItem(popupMenu, SWT.NONE); mntmOpen.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onOpenSelected(e); } }); mntmOpen.setText(Messages.mntmOpen_text); MenuItem mntmOpenInNew = new MenuItem(popupMenu, SWT.NONE); mntmOpenInNew.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onOpenInNewWindowSelected(e); } }); mntmOpenInNew.setText(Messages.mntmOpenInNewWindow_text); MenuItem mntmCopyAsString = new MenuItem(popupMenu, SWT.NONE); mntmCopyAsString.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onCopyAsStringSelected(); } }); mntmCopyAsString.setText(Messages.mntmCopyAsString_text); MenuItem mntmCopyTo = new MenuItem(popupMenu, SWT.NONE); mntmCopyTo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onCopyToSelected(); } }); mntmCopyTo.setText(Messages.mntmCopyTo_text); MenuItem menuItem = new MenuItem(popupMenu, SWT.SEPARATOR); menuItem.setText("Visibility"); final MenuItem mntmFoldersVisible_1 = new MenuItem(popupMenu, SWT.CHECK); mntmFoldersVisible_1.setSelection(folder_is_checked); mntmFoldersVisible_1.setText(Messages.mntmFoldersVisible_text); mntmFoldersVisible_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mntmFoldersVisible.setSelection(mntmFoldersVisible_1.getSelection()); onFoldersVisibleChecked(mntmFoldersVisible.getSelection()); } }); final MenuItem mntmFilesVisible_1 = new MenuItem(popupMenu, SWT.CHECK); mntmFilesVisible_1.setSelection(file_is_checked); mntmFilesVisible_1.setText(Messages.mntmFilesVisible_text); mntmFilesVisible_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mntmFilesVisible.setSelection(mntmFilesVisible_1.getSelection()); onFilesVisibleChecked(mntmFilesVisible.getSelection()); } }); final MenuItem mntmCompressedFoldersVisible_1 = new MenuItem(popupMenu, SWT.CHECK); mntmCompressedFoldersVisible_1.setSelection(compressedfolder_is_checked); mntmCompressedFoldersVisible_1.setText(Messages.mntmCompressedFoldersVisible_text); mntmCompressedFoldersVisible_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mntmCompressedFoldersVisible.setSelection(mntmCompressedFoldersVisible_1.getSelection()); onCompressedFoldersVisibleChecked(mntmCompressedFoldersVisible.getSelection()); } }); final MenuItem mntmCompressedFilesVisible_1 = new MenuItem(popupMenu, SWT.CHECK); mntmCompressedFilesVisible_1.setSelection(compressedfile_is_checked); mntmCompressedFilesVisible_1.setText(Messages.mntmCompressedFilesVisible_text); mntmCompressedFilesVisible_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mntmCompressedFilesVisible.setSelection(mntmCompressedFilesVisible_1.getSelection()); onCompressedFilesVisibleSelected(mntmCompressedFilesVisible.getSelection()); } }); mntmFoldersVisible.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mntmFoldersVisible_1.setSelection(mntmFoldersVisible.getSelection()); onFoldersVisibleChecked(mntmFoldersVisible.getSelection()); } }); mntmFilesVisible.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mntmFilesVisible_1.setSelection(mntmFilesVisible.getSelection()); onFilesVisibleChecked(mntmFilesVisible.getSelection()); } }); mntmCompressedFoldersVisible.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mntmCompressedFoldersVisible_1.setSelection(mntmCompressedFoldersVisible.getSelection()); onCompressedFoldersVisibleChecked(mntmCompressedFoldersVisible.getSelection()); } }); mntmCompressedFilesVisible.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mntmCompressedFilesVisible_1.setSelection(mntmCompressedFilesVisible.getSelection()); onCompressedFilesVisibleSelected(mntmCompressedFilesVisible.getSelection()); } }); compositeStatusBar = new Composite(shell, SWT.NONE); compositeStatusBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); compositeStatusBar.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); GridLayout gl_compositeStatusBar = new GridLayout(2, false); gl_compositeStatusBar.marginWidth = 0; gl_compositeStatusBar.marginHeight = 0; compositeStatusBar.setLayout(gl_compositeStatusBar); formToolkit.adapt(compositeStatusBar); formToolkit.paintBordersFor(compositeStatusBar); lblStatusBar = new Label(compositeStatusBar, SWT.NONE); lblStatusBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); lblStatusBar.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); formToolkit.adapt(lblStatusBar, true, true); lblStatusBar.setText(""); progressBar = new ProgressBar(compositeStatusBar, SWT.NONE); formToolkit.adapt(progressBar, true, true); m_bindingContext = initDataBindings(); }
From source file:com.github.n_i_e.deepfolderview.SwtFileFolderMenu.java
License:Apache License
/** * Create contents of the window./* ww w . ja v a 2 s . c o m*/ */ private void createContents() { shell = new Shell(); shell.setImage(SWTResourceManager.getImage(SwtFileFolderMenu.class, "/com/github/n_i_e/deepfolderview/icon/drive-harddisk.png")); shell.setMinimumSize(new Point(300, 200)); shell.setSize(640, 480); GridLayout gl_shell = new GridLayout(1, false); gl_shell.verticalSpacing = 6; gl_shell.marginWidth = 3; gl_shell.marginHeight = 3; gl_shell.horizontalSpacing = 6; shell.setLayout(gl_shell); Menu menu = new Menu(shell, SWT.BAR); shell.setMenuBar(menu); MenuItem mntmFile = new MenuItem(menu, SWT.CASCADE); mntmFile.setText(Messages.mntmFile_text); Menu menuFile = new Menu(mntmFile); mntmFile.setMenu(menuFile); MenuItem mntmOpen_1 = new MenuItem(menuFile, SWT.NONE); mntmOpen_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onOpenSelected(e); } }); mntmOpen_1.setText(Messages.mntmOpen_text); MenuItem mntmOpenInNew_1 = new MenuItem(menuFile, SWT.NONE); mntmOpenInNew_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onOpenInNewWindowSelected(e); } }); mntmOpenInNew_1.setText(Messages.mntmOpenInNewWindow_text); MenuItem mntmOpenDuplicateDetails_1 = new MenuItem(menuFile, SWT.NONE); mntmOpenDuplicateDetails_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onOpenDuplicateDetailsSelected(e); } }); mntmOpenDuplicateDetails_1.setText(Messages.mntmOpenDuplicateDetails_text); MenuItem mntmCopyTo_2 = new MenuItem(menuFile, SWT.NONE); mntmCopyTo_2.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onCopyToSelected(); } }); mntmCopyTo_2.setText(Messages.mntmCopyTo_text); MenuItem mntmClose = new MenuItem(menuFile, SWT.NONE); mntmClose.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onCloseSelected(); } }); mntmClose.setText(Messages.mntmClose_text); MenuItem mntmQuit = new MenuItem(menuFile, SWT.NONE); mntmQuit.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onQuitSelected(); } }); mntmQuit.setText(Messages.mntmQuit_text); MenuItem mntmEdit = new MenuItem(menu, SWT.CASCADE); mntmEdit.setText(Messages.mntmEdit_text); Menu menuEdit = new Menu(mntmEdit); mntmEdit.setMenu(menuEdit); MenuItem mntmRun_1 = new MenuItem(menuEdit, SWT.NONE); mntmRun_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onRunSelected(); } }); mntmRun_1.setText(Messages.mntmRun_text); MenuItem mntmCopyAsString_1 = new MenuItem(menuEdit, SWT.NONE); mntmCopyAsString_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onCopyAsStringSelected(); } }); mntmCopyAsString_1.setText(Messages.mntmCopyAsString_text); MenuItem mntmCopyTo_1 = new MenuItem(menuEdit, SWT.NONE); mntmCopyTo_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onCopyToSelected(); } }); mntmCopyTo_1.setText(Messages.mntmCopyTo_text); MenuItem mntmVisibility = new MenuItem(menu, SWT.CASCADE); mntmVisibility.setText(Messages.mntmVisibility_text); Menu menuVisibility = new Menu(mntmVisibility); mntmVisibility.setMenu(menuVisibility); final MenuItem mntmFoldersVisible = new MenuItem(menuVisibility, SWT.CHECK); mntmFoldersVisible.setSelection(true); mntmFoldersVisible.setText(Messages.mntmFoldersVisible_text); final MenuItem mntmFilesVisible = new MenuItem(menuVisibility, SWT.CHECK); mntmFilesVisible.setSelection(true); mntmFilesVisible.setText(Messages.mntmFilesVisible_text); final MenuItem mntmCompressedFoldersVisible = new MenuItem(menuVisibility, SWT.CHECK); mntmCompressedFoldersVisible.setSelection(true); mntmCompressedFoldersVisible.setText(Messages.mntmCompressedFoldersVisible_text); final MenuItem mntmCompressedFilesVisible = new MenuItem(menuVisibility, SWT.CHECK); mntmCompressedFilesVisible.setSelection(true); mntmCompressedFilesVisible.setText(Messages.mntmCompressedFilesVisible_text); MenuItem mntmHelp = new MenuItem(menu, SWT.CASCADE); mntmHelp.setText(Messages.mntmHelp_text); Menu menuHelp = new Menu(mntmHelp); mntmHelp.setMenu(menuHelp); MenuItem mntmOpenSourceLicenses = new MenuItem(menuHelp, SWT.NONE); mntmOpenSourceLicenses.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { new SwtOpenSourceLicenses(shell, SWT.TITLE | SWT.MIN | SWT.MAX | SWT.CLOSE).open(); } }); mntmOpenSourceLicenses.setText(Messages.mntmOpenSourceLicenses_text); compositeToolBar = new Composite(shell, SWT.NONE); compositeToolBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); compositeToolBar.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); compositeToolBar.setFont(SWTResourceManager.getFont("Meiryo UI", 12, SWT.NORMAL)); GridLayout gl_compositeToolBar = new GridLayout(5, false); gl_compositeToolBar.horizontalSpacing = 0; gl_compositeToolBar.verticalSpacing = 0; gl_compositeToolBar.marginWidth = 0; gl_compositeToolBar.marginHeight = 0; compositeToolBar.setLayout(gl_compositeToolBar); formToolkit.adapt(compositeToolBar); formToolkit.paintBordersFor(compositeToolBar); Button btnLeft = new Button(compositeToolBar, SWT.NONE); btnLeft.setImage(SWTResourceManager.getImage(SwtFileFolderMenu.class, "/com/github/n_i_e/deepfolderview/icon/go-previous.png")); btnLeft.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onNavigatePreviousSelected(e); } }); btnLeft.setFont(SWTResourceManager.getFont("Meiryo UI", 11, SWT.NORMAL)); formToolkit.adapt(btnLeft, true, true); Button btnRight = new Button(compositeToolBar, SWT.NONE); btnRight.setImage(SWTResourceManager.getImage(SwtFileFolderMenu.class, "/com/github/n_i_e/deepfolderview/icon/go-next.png")); btnRight.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onNavigateNextSelected(e); } }); btnRight.setFont(SWTResourceManager.getFont("Meiryo UI", 11, SWT.NORMAL)); formToolkit.adapt(btnRight, true, true); Button btnUp = new Button(compositeToolBar, SWT.NONE); btnUp.setImage(SWTResourceManager.getImage(SwtFileFolderMenu.class, "/com/github/n_i_e/deepfolderview/icon/go-up.png")); btnUp.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onUpperFolderSelected(e); } }); formToolkit.adapt(btnUp, true, true); txtLocation = new Text(compositeToolBar, SWT.BORDER); txtLocation.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent arg0) { onLocationModified(arg0); } }); GridData gd_txtLocation = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_txtLocation.widthHint = 200; txtLocation.setLayoutData(gd_txtLocation); txtLocation.setFont(SWTResourceManager.getFont("Meiryo UI", 11, SWT.NORMAL)); formToolkit.adapt(txtLocation, true, true); Button btnRefresh = new Button(compositeToolBar, SWT.NONE); btnRefresh.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { refresh(); } }); btnRefresh.setImage(SWTResourceManager.getImage(SwtFileFolderMenu.class, "/com/github/n_i_e/deepfolderview/icon/view-refresh.png")); formToolkit.adapt(btnRefresh, true, true); final TableViewer tableViewer = new TableViewer(shell, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL); table = tableViewer.getTable(); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); //table = new Table(scrolledComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL); table.setHeaderVisible(true); table.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onTableSelected(e); } @Override public void widgetDefaultSelected(SelectionEvent e) { onOpenSelected(e); } }); formToolkit.adapt(table); formToolkit.paintBordersFor(table); final TableColumn tblclmnPath = new TableColumn(table, SWT.LEFT); tblclmnPath.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { table.setSortColumn(tblclmnPath); if (table.getSortDirection() == SWT.UP) { table.setSortDirection(SWT.DOWN); } else { table.setSortDirection(SWT.UP); } onTblclmnPathSelected(tblclmnPath, e); } }); tblclmnPath.setWidth(230); tblclmnPath.setText(Messages.tblclmnPath_text); setTableSortDirection(tblclmnPath, "path", order); final TableColumn tblclmnDateLastModified = new TableColumn(table, SWT.LEFT); tblclmnDateLastModified.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { table.setSortColumn(tblclmnDateLastModified); if (table.getSortDirection() == SWT.UP) { table.setSortDirection(SWT.DOWN); } else { table.setSortDirection(SWT.UP); } onTblclmnDateLastModifiedSelected(tblclmnDateLastModified, e); } }); tblclmnDateLastModified.setWidth(136); tblclmnDateLastModified.setText(Messages.tblclmnDateLastModified_text); setTableSortDirection(tblclmnDateLastModified, "datelastmodified", order); final TableColumn tblclmnSize = new TableColumn(table, SWT.RIGHT); tblclmnSize.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { table.setSortColumn(tblclmnSize); if (table.getSortDirection() == SWT.UP) { table.setSortDirection(SWT.DOWN); } else { table.setSortDirection(SWT.UP); } onTblclmnSizeSelected(tblclmnSize, e); } }); tblclmnSize.setWidth(110); tblclmnSize.setText(Messages.tblclmnSize_text); setTableSortDirection(tblclmnSize, "size", order); final TableColumn tblclmnCompressedsize = new TableColumn(table, SWT.RIGHT); tblclmnCompressedsize.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { table.setSortColumn(tblclmnCompressedsize); if (table.getSortDirection() == SWT.UP) { table.setSortDirection(SWT.DOWN); } else { table.setSortDirection(SWT.UP); } onTblclmnCompressedsizeSelected(tblclmnCompressedsize, e); } }); tblclmnCompressedsize.setWidth(110); tblclmnCompressedsize.setText(Messages.tblclmnCompressedesize_text); setTableSortDirection(tblclmnCompressedsize, "compressedsize", order); final TableColumn tblclmnDuplicate = new TableColumn(table, SWT.NONE); tblclmnDuplicate.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { table.setSortColumn(tblclmnDuplicate); if (table.getSortDirection() == SWT.UP) { table.setSortDirection(SWT.DOWN); } else { table.setSortDirection(SWT.UP); } onTblclmnDuplicateSelected(tblclmnDuplicate, e); } }); tblclmnDuplicate.setWidth(35); tblclmnDuplicate.setText(Messages.tblclmnDuplicate_text); setTableSortDirection(tblclmnDuplicate, "duplicate", order); final TableColumn tblclmnDedupablesize = new TableColumn(table, SWT.RIGHT); tblclmnDedupablesize.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { table.setSortColumn(tblclmnDedupablesize); if (table.getSortDirection() == SWT.UP) { table.setSortDirection(SWT.DOWN); } else { table.setSortDirection(SWT.UP); } onTblclmnDedupablesizeSelected(tblclmnDedupablesize, e); } }); tblclmnDedupablesize.setWidth(110); tblclmnDedupablesize.setText(Messages.tblclmnDedupablesize_text); setTableSortDirection(tblclmnDedupablesize, "dedupablesize", order); Menu popupMenu = new Menu(table); table.setMenu(popupMenu); MenuItem mntmRun = new MenuItem(popupMenu, SWT.NONE); mntmRun.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onRunSelected(); } }); mntmRun.setText(Messages.mntmRun_text); MenuItem mntmOpen = new MenuItem(popupMenu, SWT.NONE); mntmOpen.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onOpenSelected(e); } }); mntmOpen.setText(Messages.mntmOpen_text); MenuItem mntmOpenInNew = new MenuItem(popupMenu, SWT.NONE); mntmOpenInNew.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onOpenInNewWindowSelected(e); } }); mntmOpenInNew.setText(Messages.mntmOpenInNewWindow_text); MenuItem mntmOpenDuplicateDetails = new MenuItem(popupMenu, SWT.NONE); mntmOpenDuplicateDetails.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onOpenDuplicateDetailsSelected(e); } }); mntmOpenDuplicateDetails.setText(Messages.mntmOpenDuplicateDetails_text); MenuItem mntmCopyAsString = new MenuItem(popupMenu, SWT.NONE); mntmCopyAsString.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onCopyAsStringSelected(); } }); mntmCopyAsString.setText(Messages.mntmCopyAsString_text); MenuItem mntmCopyTo = new MenuItem(popupMenu, SWT.NONE); mntmCopyTo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onCopyToSelected(); } }); mntmCopyTo.setText(Messages.mntmCopyTo_text); MenuItem menuItem = new MenuItem(popupMenu, SWT.SEPARATOR); menuItem.setText("Visibility"); final MenuItem mntmFoldersVisible_1 = new MenuItem(popupMenu, SWT.CHECK); mntmFoldersVisible_1.setSelection(true); mntmFoldersVisible_1.setText(Messages.mntmFoldersVisible_text); mntmFoldersVisible_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mntmFoldersVisible.setSelection(mntmFoldersVisible_1.getSelection()); onFoldersVisibleChecked(mntmFoldersVisible.getSelection()); } }); final MenuItem mntmFilesVisible_1 = new MenuItem(popupMenu, SWT.CHECK); mntmFilesVisible_1.setSelection(true); mntmFilesVisible_1.setText(Messages.mntmFilesVisible_text); mntmFilesVisible_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mntmFilesVisible.setSelection(mntmFilesVisible_1.getSelection()); onFilesVisibleChecked(mntmFilesVisible.getSelection()); } }); final MenuItem mntmCompressedFoldersVisible_1 = new MenuItem(popupMenu, SWT.CHECK); mntmCompressedFoldersVisible_1.setSelection(true); mntmCompressedFoldersVisible_1.setText(Messages.mntmCompressedFoldersVisible_text); mntmCompressedFoldersVisible_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mntmCompressedFoldersVisible.setSelection(mntmCompressedFoldersVisible_1.getSelection()); onCompressedFoldersVisibleChecked(mntmCompressedFoldersVisible.getSelection()); } }); final MenuItem mntmCompressedFilesVisible_1 = new MenuItem(popupMenu, SWT.CHECK); mntmCompressedFilesVisible_1.setSelection(true); mntmCompressedFilesVisible_1.setText(Messages.mntmCompressedFilesVisible_text); mntmCompressedFilesVisible_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mntmCompressedFilesVisible.setSelection(mntmCompressedFilesVisible_1.getSelection()); onCompressedFilesVisibleSelected(mntmCompressedFilesVisible.getSelection()); } }); mntmFoldersVisible.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mntmFoldersVisible_1.setSelection(mntmFoldersVisible.getSelection()); onFoldersVisibleChecked(mntmFoldersVisible.getSelection()); } }); mntmFilesVisible.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mntmFilesVisible_1.setSelection(mntmFilesVisible.getSelection()); onFilesVisibleChecked(mntmFilesVisible.getSelection()); } }); mntmCompressedFoldersVisible.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mntmCompressedFoldersVisible_1.setSelection(mntmCompressedFoldersVisible.getSelection()); onCompressedFoldersVisibleChecked(mntmCompressedFoldersVisible.getSelection()); } }); mntmCompressedFilesVisible.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mntmCompressedFilesVisible_1.setSelection(mntmCompressedFilesVisible.getSelection()); onCompressedFilesVisibleSelected(mntmCompressedFilesVisible.getSelection()); } }); compositeStatusBar = new Composite(shell, SWT.NONE); compositeStatusBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); compositeStatusBar.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); GridLayout gl_compositeStatusBar = new GridLayout(2, false); gl_compositeStatusBar.marginWidth = 0; gl_compositeStatusBar.marginHeight = 0; compositeStatusBar.setLayout(gl_compositeStatusBar); formToolkit.adapt(compositeStatusBar); formToolkit.paintBordersFor(compositeStatusBar); lblStatusBar = new Label(compositeStatusBar, SWT.NONE); lblStatusBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); lblStatusBar.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); formToolkit.adapt(lblStatusBar, true, true); lblStatusBar.setText(""); progressBar = new ProgressBar(compositeStatusBar, SWT.NONE); formToolkit.adapt(progressBar, true, true); m_bindingContext = initDataBindings(); }