@Override public void createPartControl ( final Composite parent ) { this.container = parent; createEditingDomain (); parent.setLayout ( new FillLayout () ); this.viewer = new TreeViewer ( parent ); this.viewer.setAutoExpandLevel ( 2 ); this.viewer.setContentProvider ( new AdapterFactoryContentProvider ( this.factory ) ); this.viewer.setLabelProvider ( new AdapterFactoryLabelProvider ( this.factory ) ); createContextMenuFor ( this.viewer ); new AdapterFactoryTreeEditor ( this.viewer.getTree (), this.factory ); getViewSite ().setSelectionProvider ( this.viewer ); attachSelectionService (); getViewSite ().getActionBars ().getMenuManager ().add ( new Separator ( "additions" ) ); this.actionBarContributor.init ( getViewSite ().getActionBars () ); this.actionBarContributor.setViewPart ( this ); }
/** * Starting point for the demonstration application. * * @param args ignored. */ public static void main( String[] args ) { JFreeChart chart = createChart(createDataset()); Display display = new Display(); Shell shell = new Shell(display); shell.setSize(600, 400); shell.setLayout(new FillLayout()); shell.setText("Test for jfreechart running with SWT"); final ChartComposite frame = new ChartComposite(shell, SWT.NONE, chart, true); //frame.setDisplayToolTips(false); frame.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } }
public AudibleBrowser(Composite parent, String url) { this.parent = parent; try { browser = new Browser(parent, SWT.BORDER); browser.addTitleListener(event -> getShell().setText(event.title)); } catch (SWTError e) { error = e; /* Browser widget could not be instantiated */ parent.setLayout(new FillLayout()); Label label = new Label(parent, SWT.CENTER | SWT.WRAP); label.setText(getResourceString("BrowserNotCreated")); // label.requestLayout(); return; } initResources(); if (url.length() > 0) browser.setUrl(getResourceString(url)); if (true) show(false, null, null, true, true, true, true); else show(false, null, null, false, false, false, false); }
/** {@code key} defines which data source will be used for display. */ public DashboardComposite(String key, Composite parent, int style) { super(parent, style); this.key = key; this.setLayout(new FillLayout()); final SashForm sf = new SashForm(this, SWT.HORIZONTAL); sf.setLayout(new FillLayout()); this.canvas = new VisualisationCanvas(sf, SWT.NONE); this.text = new Text(sf, SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI); text.setText(""); createVisualisationControls(sf); sf.setWeights(new int[] { 45, 45, 10 }); }
@SuppressWarnings("unchecked") @Override public void createControl(Composite parent) { Composite listComposite = new Composite(parent, NONE); listComposite.setLayout(new FillLayout()); ListViewer projectListViewer = new ListViewer(listComposite, SWT.BORDER | SWT.MULTI); projectListViewer.setContentProvider(ArrayContentProvider.getInstance()); projectListViewer.setInput(getNonTestProjects()); // Data binding DataBindingContext databindingContext = new DataBindingContext(); parent.addDisposeListener(e -> databindingContext.dispose()); databindingContext.bindList(ViewersObservables.observeMultiSelection(projectListViewer), PojoProperties.list(N4MFProjectInfo.class, N4MFProjectInfo.TESTED_PROJECT_PROP_NAME) .observe(projectInfo)); setControl(listComposite); }
private void createTabFolder ( final Composite parent ) { this.tabFolder = new CTabFolder ( parent, SWT.TOP ); this.tabFolder.setLayoutData ( new GridData ( GridData.FILL, GridData.FILL, true, true ) ); for ( final GeneratorPageInformation page : this.pages ) { final CTabItem tabItem = new CTabItem ( this.tabFolder, SWT.NONE ); final Composite tabComposite = new Composite ( this.tabFolder, SWT.NONE ); tabComposite.setLayout ( new FillLayout () ); page.getGeneratorPage ().createPage ( tabComposite ); tabItem.setText ( page.getLabel () ); tabItem.setControl ( tabComposite ); page.getGeneratorPage ().setTarget ( this ); } this.tabFolder.setSelection ( 0 ); }
@Override public void createPartControl ( final Composite parent ) { parent.setLayout ( new FillLayout () ); this.wrapper = new Composite ( parent, SWT.NONE ); this.wrapper.setLayout ( GridLayoutFactory.slimStack () ); this.shell = parent.getShell (); PlatformUI.getWorkbench ().getHelpSystem ().setHelp ( this.wrapper, "org.eclipse.scada.ui.chart.view.chartView" ); //$NON-NLS-1$ fillMenu ( getViewSite ().getActionBars ().getMenuManager () ); fillToolbar ( getViewSite ().getActionBars ().getToolBarManager () ); createChartControl ( parent ); }
private void createComponents () { final FillLayout layout = new FillLayout ( SWT.VERTICAL ); layout.marginHeight = 12; layout.marginWidth = 12; setLayout ( layout ); final Text filterTextField = new Text ( this, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL ); filterTextField.setText ( this.filter ); filterTextField.addKeyListener ( new KeyAdapter () { @Override public void keyReleased ( final KeyEvent e ) { verifyFilter ( filterTextField.getText () ); } } ); }
public TrendControlImage ( final Composite parent, final int style, final String connectionId, final String itemId, final String queryString ) { super ( parent, style ); this.connectionId = connectionId; this.itemId = itemId; this.queryString = queryString; setLayout ( new FillLayout () ); final Button button = new Button ( parent, SWT.PUSH | SWT.FLAT ); button.setImage ( org.eclipse.scada.vi.details.swt.Activator.getDefault ().getImageRegistry ().get ( org.eclipse.scada.vi.details.swt.Activator.IMG_TREND ) ); button.addSelectionListener ( new SelectionAdapter () { @Override public void widgetSelected ( final SelectionEvent e ) { startHdView (); } } ); }
public DescriptorLabel ( final Composite parent, final int style, final String text, final DataItemDescriptor descriptor ) { super ( parent, SWT.NONE ); setLayout ( new FillLayout () ); Label label = new Label ( this, style ); if ( text != null ) { label.setText ( text ); } // TODO: make properties if ( SessionManager.getDefault ().hasRole ( "developer" ) ) //$NON-NLS-1$ { label.setToolTipText ( String.format ( "%s", descriptor ) ); //$NON-NLS-1$ } }
public LabelComposite ( final Composite parent, final int style, final DataItemDescriptor descriptor, final String format ) { super ( parent, style, null, null ); setLayout ( new FillLayout () ); this.label = new Label ( this, SWT.NONE ); this.format = format; if ( descriptor != null ) { this.registrationManager.registerItem ( "value", descriptor.getItemId (), descriptor.getConnectionInformation (), false, false ); //$NON-NLS-1$ } else { this.label.setText ( format ); } }
private void createFillLayout ( final Composite parent, final FillLayoutComponent component, final Map<String, String> properties ) { final VisibilityProvider provider = this.visibleFactory.createProvider ( component.getVisibility () ); final ComponentVisibility visibility = new ComponentVisibility ( provider, new SubTrackingVisibleComponent () { @Override public void create () { final Composite childParent = new Composite ( parent, SWT.NONE ); childParent.setLayout ( new FillLayout ( SWT.VERTICAL ) ); for ( final Component child : component.getChildren () ) { final DetailComponentImpl comp = new DetailComponentImpl ( child, DetailComponentImpl.this.viewContext ); comp.init ( DetailComponentImpl.this.visibleFactory, childParent, properties ); trackSub ( comp ); } trackControl ( childParent ); } } ); addComponent ( visibility ); }
@Override public void createPartControl ( final Composite parent ) { addListener (); parent.setLayout ( new FillLayout () ); this.table = new Table ( parent, SWT.FULL_SELECTION ); this.table.setHeaderVisible ( true ); this.indexCol = new TableColumn ( this.table, SWT.NONE ); this.indexCol.setText ( Messages.QueryDataView_ColIndex ); this.indexCol.setWidth ( 50 ); this.qualityCol = new TableColumn ( this.table, SWT.NONE ); this.qualityCol.setText ( Messages.QueryDataView_ColQuality ); this.qualityCol.setWidth ( 75 ); this.manualCol = new TableColumn ( this.table, SWT.NONE ); this.manualCol.setText ( Messages.QueryDataView_ColManual ); this.manualCol.setWidth ( 75 ); this.invalidColor = JFaceColors.getErrorBackground ( getDisplay () ); }
protected void openWithWaitShell ( final Shell parentShell, final String detailViewId, final Map<String, String> parameters ) { final Shell waitShell = new Shell ( parentShell, SWT.PRIMARY_MODAL | SWT.BORDER ); waitShell.setLayout ( new FillLayout () ); final Label label = new Label ( waitShell, SWT.NONE ); label.setText ( "Opening view…" ); waitShell.pack (); waitShell.open (); // make sure the text is visible waitShell.getDisplay ().update (); try { open ( parentShell, detailViewId, parameters ); } finally { // close the wait shell waitShell.close (); } }
public ServersViewer ( final Composite parent ) { parent.setLayout ( new FillLayout () ); this.viewer = new TreeViewer ( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL ); this.contentProvider = new ObservableSetTreeContentProvider ( new ObservableFactoryImpl (), null ); this.viewer.setContentProvider ( this.contentProvider ); this.labelProvider = new ServerLabelProvider ( this.contentProvider.getKnownElements () ); this.viewer.setLabelProvider ( this.labelProvider ); this.viewer.setInput ( HivesPlugin.getDefault ().getServerManager () ); this.viewer.getControl ().addDisposeListener ( new DisposeListener () { @Override public void widgetDisposed ( final DisposeEvent e ) { handleDispose (); } } ); ColumnViewerToolTipSupport.enableFor ( this.viewer ); }
public ToggleButton(Composite parent, int style) { super(parent, style); if (colorOn == null) { colorOn = getDisplay().getSystemColor(SWT.COLOR_GREEN); colorOff = getDisplay().getSystemColor(SWT.COLOR_RED); } FillLayout layout = new FillLayout(); layout.marginHeight = layout.marginWidth = 2; setLayout(layout); button = new Button(this, SWT.TOGGLE); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { updateColor(); } }); }
/** * This method initializes compositeXml * */ private void createCompositeXml() { compositeXml = new Composite(sashForm, SWT.NONE); compositeXml.setLayout(new FillLayout()); xmlView = new StructuredTextViewer(compositeXml, null, null, false, SWT.H_SCROLL | SWT.V_SCROLL); xmlView.setEditable(false); colorManager = new ColorManager(); xmlView.configure(new XMLConfiguration(colorManager)); Document document = new Document( "Click on the XML generation button to view the XML document generated by Convertigo."); IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT, }); partitioner.connect(document); document.setDocumentPartitioner(partitioner); xmlView.setDocument(document); }
/** * This method initializes compositeXml * */ private void createCompositeXml() { compositeXml = new Composite(sashForm, SWT.NONE); compositeXml.setLayout(new FillLayout()); xmlView = new StructuredTextViewer(compositeXml, null, null, false, SWT.H_SCROLL | SWT.V_SCROLL); xmlView.setEditable(false); colorManager = new ColorManager(); xmlView.configure(new XMLConfiguration(colorManager)); Document document = new Document("Click on the XML generation button to view the XML document generated by Convertigo."); IDocumentPartitioner partitioner = new FastPartitioner( new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT, } ); partitioner.connect(document); document.setDocumentPartitioner(partitioner); xmlView.setDocument(document); }
/** * Setup the Disk window and display (open) it. */ public void open() { shell = new Shell(parentShell, SWT.SHELL_TRIM); shell.setLayout(new FillLayout()); shell.setImage(imageManager.get(ImageManager.ICON_DISK)); setStandardWindowTitle(); shell.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent event) { dispose(event); } }); CTabFolder tabFolder = new CTabFolder(shell, SWT.BOTTOM); new DiskExplorerTab(tabFolder, disks, imageManager, this); diskMapTabs = new DiskMapTab[disks.length]; for (int i=0; i<disks.length; i++) { if (disks[i].supportsDiskMap()) { diskMapTabs[i] = new DiskMapTab(tabFolder, disks[i]); } } diskInfoTab = new DiskInfoTab(tabFolder, disks); tabFolder.setSelection(tabFolder.getItems()[0]); shell.open(); }
/** * @wbp.parser.entryPoint */ @Override public void createControl(Composite parent) { fRootControl = new Composite(parent, SWT.NULL); fRootControl.setLayout(new FillLayout(SWT.HORIZONTAL)); viewer = new TreeViewer(fRootControl, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new ViewLabelProvider(createImageDescriptor()))); viewer.addDoubleClickListener(new IDoubleClickListener () { @Override public void doubleClick(DoubleClickEvent evt) { TreeSelection sel = (TreeSelection) evt.getSelection(); IFile file = (IFile) sel.getFirstElement(); if (isModelFile(file)) { JDTManager.openEditor(file, "org.gw4e.eclipse.studio.editor.GW4EEditor", null); return; } JDTManager.openEditor(file, null); } }); files = new ArrayList<IFile>(); }
/** * Create the Shell, setting up any elements that are not set up by the main Composite. * @param parentShell The parent windows' Shell. * @param classLoader The system MugglClassLoader. */ private void createShell(Shell parentShell, MugglClassLoader classLoader) { this.shell = new Shell(this.display, SWT.BORDER | SWT.CLOSE | SWT.TITLE | SWT.MIN); this.shell.setText(Globals.WINDOWS_TITLE + Globals.WINDOWS_TITLE_CONNECTOR + "Options"); this.shell.setLayout(new FillLayout(SWT.VERTICAL)); final Image small = new Image(shell.getDisplay(), OptionsWindow.class.getResourceAsStream("/images/tray_small.png")); final Image large = new Image(shell.getDisplay(), OptionsWindow.class.getResourceAsStream("/images/tray_large.png")); this.shell.setImages(new Image[] { small, large }); // No need to read it later, so it is not assigned to a variable. new OptionsComposite(this, this.shell, SWT.NONE, classLoader); // Compute the needed size. Point point = this.shell.computeSize(SWT.DEFAULT, SWT.DEFAULT); point.x += 2; point.y += 2; int[] posXY = StaticGuiSupport.getCenteredPosition(point.x, point.y, parentShell); this.shell.setBounds(posXY[0], posXY[1], point.x, point.y); }
/** * Create the Shell, setting up any elements that are not set up by the main Composite. * @param parent The Composite which this Window is invoked by. * @param method The Method thats' parameters will be defined in this Window. */ private void createShell(FileSelectionComposite parent, Method method) { this.shell = new Shell(this.display, SWT.BORDER | SWT.CLOSE | SWT.TITLE | SWT.MIN); this.shell.setText( Globals.WINDOWS_TITLE + Globals.WINDOWS_TITLE_CONNECTOR + "Method Parameters and Variable Generators for " + method.getFullNameWithParameterTypesAndNames()); this.shell.setLayout(new FillLayout(SWT.VERTICAL)); new MethodParametersComposite(parent, this, this.shell, this.display, SWT.NONE, method); // Compute the needed size. Point point = this.shell.computeSize(SWT.DEFAULT, SWT.DEFAULT); point.x += 2; point.y += 2; int[] posXY = StaticGuiSupport.getCenteredPosition(point.x, point.y, parent.getShell()); this.shell.setBounds(posXY[0], posXY[1], point.x, point.y); }
/** * Create the Shell, setting up any elements that are not set up by the main Composite. * @param arrayModificationHandler The ArrayModificationHandler the holds the represented array. * @param myDimension The dimension of a probably multidimensional array this Window represents. * @param dimensionsIndexes Dimension indexes of the higher-level dimensions the array represented might be a part of. */ private void createShell(ArrayModificationHandler arrayModificationHandler, int myDimension, int[] dimensionsIndexes) { this.shell = new Shell(this.display, SWT.BORDER | SWT.CLOSE | SWT.TITLE | SWT.MIN); this.shell.setText(Globals.WINDOWS_TITLE + Globals.WINDOWS_TITLE_CONNECTOR + "Array Entries"); this.shell.setLayout(new FillLayout(SWT.VERTICAL)); // Initialize the composite. new ArrayEntriesComposite(this, this.shell, this.display, SWT.NONE, arrayModificationHandler, myDimension, dimensionsIndexes); // Compute the needed size. Point point = this.shell.computeSize(SWT.DEFAULT, SWT.DEFAULT); point.x += 2; point.y += 2; int[] posXY = StaticGuiSupport.getCenteredPosition(point.x, point.y, this.parent.getShell()); this.shell.setBounds(posXY[0], posXY[1], point.x, point.y); }
private void buildLeftColumn() { final Composite composite = new Composite(this.shell, SWT.NONE); final GridData gd = new GridData(GridData.FILL, GridData.BEGINNING, false, true, 1, 1); composite.setLayoutData(gd); final FillLayout compositeLayout = new FillLayout(); compositeLayout.marginWidth = 2; composite.setLayout(compositeLayout); final Label label = new Label(composite, SWT.NONE); if (this.image == null) { this.image = new Image(display, this.getClass().getClassLoader() .getResourceAsStream("images/document_wrench_color.png")); shell.addListener(SWT.Close, new Listener() { @Override public void handleEvent(Event event) { image.dispose(); } }); } label.setImage(this.image); }
private void buildLeftColumn() { final Composite composite = new Composite(this.shell, SWT.NONE); final GridData gd = new GridData(GridData.FILL, GridData.BEGINNING, false, true, 1, 1); composite.setLayoutData(gd); final FillLayout compositeLayout = new FillLayout(); compositeLayout.marginWidth = 2; composite.setLayout(compositeLayout); final Label label = new Label(composite, SWT.NONE); if (this.image == null) { this.image = new Image(display, this.getClass().getClassLoader() .getResourceAsStream("images/light1.png")); shell.addListener(SWT.Close, new Listener() { @Override public void handleEvent(Event event) { image.dispose(); } }); } label.setImage(this.image); }
private Text addTextBoxInTable(TableViewer tableViewer, TableItem tableItem, String textBoxName, String valueTextPane, String editorName, int columnIndex, Listener listener) { final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE); buttonPane.setLayout(new FillLayout()); final Text text = new Text(buttonPane, SWT.NONE); text.addListener(SWT.Modify, listener); text.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem)); tableItem.setData(textBoxName, text); tableItem.setData(valueTextPane, buttonPane); //text.addModifyListener(FilterHelper.INSTANCE.getTextModifyListener()); final TableEditor editor = new TableEditor(tableViewer.getTable()); editor.grabHorizontal = true; editor.grabVertical = true; editor.setEditor(buttonPane, tableItem, columnIndex); editor.layout(); text.setData(editorName, editor); return text; }
private CCombo addComboInTable(TableViewer tableViewer, TableItem tableItem, String comboName, String comboPaneName, String editorName, int columnIndex, String[] relationalOperators, SelectionListener dropDownSelectionListener, ModifyListener modifyListener,FocusListener focusListener) { final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE); buttonPane.setLayout(new FillLayout()); final CCombo combo = new CCombo(buttonPane, SWT.NONE); combo.setItems(relationalOperators); combo.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem)); tableItem.setData(comboName, combo); tableItem.setData(comboPaneName, buttonPane); combo.addSelectionListener(dropDownSelectionListener); combo.addModifyListener(modifyListener); combo.addFocusListener(focusListener); new AutoCompleteField(combo, new CComboContentAdapter(), combo.getItems()); final TableEditor editor = new TableEditor(tableViewer.getTable()); editor.grabHorizontal = true; editor.grabVertical = true; editor.setEditor(buttonPane, tableItem, columnIndex); editor.layout(); combo.setData(editorName, editor); return combo; }
private void addButtonInTable(TableViewer tableViewer, TableItem tableItem, String columnName, String buttonPaneName, String editorName, int columnIndex, SelectionListener buttonSelectionListener, ImagePathConstant imagePath) { final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE); buttonPane.setLayout(new FillLayout()); final Button button = new Button(buttonPane, SWT.NONE); //button.setText(columnName); button.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem)); tableItem.setData(columnName, button); tableItem.setData(buttonPaneName, buttonPane); button.addSelectionListener(buttonSelectionListener); button.setImage(imagePath.getImageFromRegistry()); final TableEditor editor = new TableEditor(tableViewer.getTable()); editor.grabHorizontal = true; editor.grabVertical = true; editor.setEditor(buttonPane, tableItem, columnIndex); editor.layout(); button.setData(editorName, editor); }
private void addCheckButtonInTable(TableViewer tableViewer, TableItem tableItem, String columnName, String groupPaneName, String editorName, int columnIndex, SelectionListener buttonSelectionListener) { final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE); buttonPane.setLayout(new FillLayout()); final Button button = new Button(buttonPane, SWT.CHECK); button.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem)); if(null != buttonSelectionListener){ button.addSelectionListener(buttonSelectionListener); } tableItem.setData(columnName, button); tableItem.setData(groupPaneName, buttonPane); final TableEditor editor = new TableEditor(tableViewer.getTable()); editor.grabHorizontal = true; editor.grabVertical = true; editor.setEditor(buttonPane, tableItem, columnIndex); editor.layout(); button.setData(editorName, editor); }
/** * Starting point for the demonstration application. * * @param args ignored. */ public static void main( String[] args ) { JFreeChart chart = createChart(createDataset()); Display display = new Display(); Shell shell = new Shell(display); shell.setSize(600, 300); shell.setLayout(new FillLayout()); shell.setText("Test for jfreechart running with SWT"); final ChartComposite frame = new ChartComposite(shell, SWT.NONE, chart, true); frame.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } }
/** * Starting point for the demonstration application. * * @param args ignored. */ public static void main( String[] args ) { final JFreeChart chart = createChart(); final Display display = new Display(); Shell shell = new Shell(display); shell.setSize(600, 300); shell.setLayout(new FillLayout()); shell.setText("Test for jfreechart running with SWT"); ChartComposite frame = new ChartComposite(shell, SWT.NONE, chart, true); frame.setDisplayToolTips(false); frame.setHorizontalAxisTrace(true); frame.setVerticalAxisTrace(true); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } }
/** * Starting point for the demonstration application. * * @param args ignored. */ public static void main(String[] args) { final JFreeChart chart = createChart(createDataset()); final Display display = new Display(); Shell shell = new Shell(display); shell.setSize(600, 300); shell.setLayout(new FillLayout()); shell.setText("Time series demo for jfreechart running with SWT"); ChartComposite frame = new ChartComposite(shell, SWT.NONE, chart, true); frame.setDisplayToolTips(true); frame.setHorizontalAxisTrace(false); frame.setVerticalAxisTrace(false); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } }
@Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); setControl(container); container.setLayout(new FillLayout(SWT.HORIZONTAL)); treeViewer = new TreeViewer(container, SWT.BORDER); treeViewer.setUseHashlookup(true); treeViewer.setLabelProvider(new SigTypeLabelProvider()); treeViewer.setContentProvider(new SigTypeContentProvider()); treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects()); treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { if (((TreeSelection) event.getSelection()).getFirstElement() instanceof IMarker) { selection = event.getSelection(); ContainerSelectionPage.this.setPageComplete(true); } else { ContainerSelectionPage.this.setPageComplete(false); } } }); }
@Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); this.setControl(container); container.setLayout(new FillLayout(SWT.HORIZONTAL)); TreeViewer treeViewer = new TreeViewer(container, SWT.BORDER); treeViewer.setUseHashlookup(true); treeViewer.setLabelProvider(new CreatingAtomWizardLabelProvider()); treeViewer.setContentProvider(new CreatingAtomWizardContentProvider()); treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects()); treeViewer.setFilters(new ViewerFilter[] {new CreatingAtomWizardFilter()}); treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { if (((TreeSelection) event.getSelection()).getFirstElement() instanceof IMarker) { UntypedMarkerPage.this.selection = event.getSelection(); UntypedMarkerPage.this.setPageComplete(true); } else { UntypedMarkerPage.this.setPageComplete(false); } } }); }
private void createPieceDistPanel() { comp.setLayout(new FillLayout()); //pieceDistComposite = new Composite(parent, SWT.NONE); pieceDistCanvas = new Canvas(comp,SWT.NO_BACKGROUND); pieceDistCanvas.addListener(SWT.Paint, new Listener() { @Override public void handleEvent(Event event) { if ( pem==null || pem.isDestroyed()){ event.gc.fillRectangle(event.x, event.y, event.width, event.height); }else{ if (imgToPaint != null && !imgToPaint.isDisposed()) { event.gc.drawImage(imgToPaint, 0, 0); } } } }); }
public void initialize(Composite composite) { if ( autoDHT ){ CoreFactory.addCoreRunningListener(new CoreRunningListener() { @Override public void coreRunning(Core core) { DHTOpsView.this.core = core; init(core); } }); } panel = new Composite(composite,SWT.NULL); panel.setLayout(new FillLayout()); drawPanel = new DHTOpsPanel(panel); drawPanel.setAutoAlpha(autoAlpha); }
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setLayout(new FillLayout(SWT.VERTICAL)); final Label label = new Label(shell, SWT.BORDER); final Text text = new Text(shell, SWT.BORDER); text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { Image pathIcon = getPathIcon(text.getText(), false, false); label.setImage(pathIcon); } }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
public static void main(String[] args) { Display display = Display.getDefault(); Shell shell = new Shell(display, SWT.DIALOG_TRIM); shell.setLayout(new FillLayout()); Composite c = new Composite(shell, SWT.BORDER); c.setLayout(new FillLayout()); c.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.drawLine(0, 0, 100, 50); } }); Label lbl = new Label(c, SWT.NONE); lbl.setText("text"); shell.open(); while (!shell.isDisposed()) { if (display.readAndDispatch()) { display.sleep(); } } }
@Test public void test() { JTouchBar jTouchBar = JTouchBarTestUtils.constructTouchBar(); assertNotNull(jTouchBar); Display display = Display.getCurrent(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); shell.open(); jTouchBar.show( shell ); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); break; } } display.dispose(); }