void setData(final Repository localDb, final PushOperationResult result) { reader = localDb.newObjectReader(); repo = localDb; // Set empty result for a while. treeViewer.setInput(null); if (result == null) { root.layout(); return; } final List<RefUpdateElement> results = new ArrayList<RefUpdateElement>(); for (URIish uri : result.getURIs()) if (result.isSuccessfulConnection(uri)) for (RemoteRefUpdate update : result.getPushResult(uri).getRemoteUpdates()) results.add(new RefUpdateElement(result, update, uri, reader, repo)); treeViewer.setInput(results.toArray()); // select the first row of table to get the details of the first // push result shown in the Text control Tree table = treeViewer.getTree(); if (table.getItemCount() > 0) treeViewer.setSelection(new StructuredSelection(table.getItem(0).getData())); root.layout(); }
@Override protected Control createContents(Composite parent) { ColorController.assignMethodColors(parent.getDisplay(), mReader.getMethods()); SelectionController selectionController = new SelectionController(); GridLayout gridLayout = new GridLayout(1, false); gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; gridLayout.horizontalSpacing = 0; gridLayout.verticalSpacing = 0; parent.setLayout(gridLayout); Display display = parent.getDisplay(); Color darkGray = display.getSystemColor(SWT.COLOR_DARK_GRAY); // Create a sash form to separate the timeline view (on top) // and the profile view (on bottom) SashForm sashForm1 = new SashForm(parent, SWT.VERTICAL); sashForm1.setBackground(darkGray); sashForm1.SASH_WIDTH = 3; GridData data = new GridData(GridData.FILL_BOTH); sashForm1.setLayoutData(data); // Create the timeline view new TimeLineView(sashForm1, mReader, selectionController); // Create the profile view new ProfileView(sashForm1, mReader, selectionController); return sashForm1; }
/** * Maximize the child control of sashform passed. * * @param control - the child control of sashform to maximize or restore */ private void maximizeControl(Control control) { if (sashForm.getMaximizedControl() == control) { sashForm.setMaximizedControl(null); } else { sashForm.setMaximizedControl(control); } }
protected void disposeGui() { if (component != null) component.dispose(); component = null; if (sash != null && !sash.isDisposed()) sash.dispose(); sash = null; super.disposeGui(); }
/** * {@inheritDoc} * * @see * org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer#renderControl(org.eclipse.emfforms.spi.swt.core.layout.SWTGridCell, * org.eclipse.swt.widgets.Composite) */ @Override protected Control renderControl(SWTGridCell cell, Composite parent) throws NoRendererFoundException, NoPropertyDescriptorFoundExeption { /* The tree's composites */ final Composite form = createMasterDetailForm(parent); createHeader(form); final SashForm sash = createSash(form); final Composite masterPanel = createMasterPanel(sash); createRightPanelContent(sash); sash.setWeights(new int[] {1, 3}); createMasterTree(masterPanel); if (hasContextMenu()) { registerControlAsContextMenuReceiver(); } form.layout(true); return form; }
/* * The key listeners we add workaround a bug int Text that don't repaint * properly when they have background images. */ protected void createChatControl(Widget item) throws Exception { CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE); tabItem.setText("Chat with " + ((TreeItem) item).getText()); SashForm textForm = new SashForm(tabFolder, SWT.VERTICAL); final Text text1 = new Text(textForm, SWT.MULTI); text1.setData("id", "output"); text1.setText(OUTPUT_TEXT); text1.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent arg0) { text1.redraw(); } }); final Text text2 = new Text(textForm, SWT.MULTI); text2.setData("id", "input"); text2.setText(INPUT_TEXT); text2.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent arg0) { text2.redraw(); } }); tabItem.setControl(textForm); textForm.setWeights(new int[] {80, 20}); getCSSEngine().applyStyles(textForm, false); tabFolder.setSelection(tabItem); }
@Override public void createControls(Composite parent) { AutotoolsConfigurationManager.getInstance().clearTmpConfigurations(page.getProject()); syncClones(); super.createControls(parent); Composite composite = usercomp; settingsStore = AutotoolsConfigurePrefStore.getInstance(); configToPageListMap = new HashMap<>(); // assume parent page uses griddata GridData gd = new GridData( GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); composite.setLayoutData(gd); GridLayout layout = new GridLayout(); composite.setLayout(layout); // Create the sash form sashForm = new SashForm(usercomp, SWT.NONE); sashForm.setOrientation(SWT.HORIZONTAL); sashForm.setLayoutData(new GridData(GridData.FILL_BOTH)); layout = new GridLayout(2, true); layout.marginHeight = 5; sashForm.setLayout(layout); createSelectionArea(sashForm); createEditArea(sashForm); }
public static void main(final String[] args) { Display display = new Display(); shell = new Shell(display); shell.setText("StackOverflow"); shell.setLayout(new GridLayout(1, false)); // createToolbar(); scform = new ScrolledForm(shell); scform.setLayout(new GridLayout(1, false)); scform.getBody().setLayout(new GridLayout(1, false)); scform.setExpandHorizontal(true); scform.setExpandVertical(true); SashForm form = new SashForm(scform.getBody(), SWT.VERTICAL); form.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); createTablePart(form); createMessagesPart(form); form.setWeights(new int[] {3, 1}); shell.pack(); shell.open(); // shell.setSize(600, 450); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
public void setViewPanesOrientation(int orientation) { fViewOrientation = orientation; if (fViewOrientation == VERTICAL_VIEW_ORIENTATION) fSashForm.setOrientation(SWT.VERTICAL); else fSashForm.setOrientation(SWT.HORIZONTAL); saveOrientation(); updateOrientationActions(); }
public void run() { isVerticalSashing = !isVerticalSashing; if (isVerticalSashing) { container.setOrientation(SWT.VERTICAL); } else { container.setOrientation(SWT.HORIZONTAL); } setState(); }
/** * Takes the user preference to show or not show the demo panel. * * @param showDemo */ public void switchShowHideDemo(final boolean showDemo) { demoComposite.setVisible(true); if (showDemo) { sash.setMaximizedControl(null); } else { sash.setMaximizedControl(dataScrollComposite); } }
/* (non-Javadoc) * @see com.hundsun.ares.studio.jres.metadata.ui.editors.AbstractMetadataFormPage#createMetadataComposite(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit) */ @Override protected void createMetadataComposite(Composite body, FormToolkit toolkit) { EPackage epackage = null; try { epackage = BasicDataEpackageFactory.eINSTANCE.createEPackage(getEditor().getARESResource()); } catch (Exception e) { logger.error("编辑基础数据时,读取EPackage失败", e); return; } SashForm sashForm = new SashForm(body, SWT.VERTICAL); masterListViewerBlock = new SingleTableListViewerBlock( this, getEditingDomain(), getSite(), getEditor().getARESResource(), getProblemPool(), epackage, IBasicDataEpacakgeConstant.MasterItem); masterListViewerBlock.setEditableControl(getEditableControl()); masterListViewerBlock.createControl(sashForm, toolkit); getEditor().getActionBarContributor().addGlobalActionHandlerProvider(masterListViewerBlock); slaveDetailViewerBlock = new MasterSlaveDetailViewerBlock( getEditingDomain(), getEditor().getARESResource(), getProblemPool(), epackage); slaveDetailViewerBlock.setEditableControl(getEditableControl()); slaveDetailViewerBlock.createControl(sashForm, toolkit); getEditor().getActionBarContributor().addGlobalActionHandlerProvider(slaveDetailViewerBlock); sashForm.setWeights(new int[] {6, 4}); masterListViewerBlock.addSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection && !selection.isEmpty()) { Object element = ((IStructuredSelection) selection).getFirstElement(); if (!(element instanceof MetadataCategory)) { slaveDetailViewerBlock.setInput(element); } } } }); addPropertyListener(masterListViewerBlock); getEditingDomain().getCommandStack().addCommandStackListener(masterListViewerBlock); addPropertyListener(slaveDetailViewerBlock); getEditingDomain().getCommandStack().addCommandStackListener(slaveDetailViewerBlock); }
private Control createSashForm() { SashForm vertSashForm = new SashForm(folder, SWT.VERTICAL); SashForm horSashForm = new SashForm(vertSashForm, SWT.HORIZONTAL); Composite leftComp = new Composite(horSashForm, SWT.NONE); Composite rightComp = new Composite(horSashForm, SWT.NONE); Composite footComp = new Composite(vertSashForm, SWT.NONE); createLeft(leftComp); createRight(rightComp); createFoot(footComp); horSashForm.setWeights(new int[] {60, 40}); vertSashForm.setWeights(new int[] {95, 5}); return vertSashForm; }
private void toggleHideState() { if (hideState) { hideState = false; hideItem.setImage(imageCache.get(UP_ICON)); hideItem.setToolTipText("Hide Request Table"); parentForm.setMaximizedControl(null); } else { hideState = true; hideItem.setToolTipText("Show Request Table"); hideItem.setImage(imageCache.get(DOWN_ICON)); parentForm.setMaximizedControl(parentComposite); } }
@Override public Control createControl(Composite parent) { SashForm sash = new SashForm(parent, SWT.HORIZONTAL); sash.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); Composite container = new Composite(sash, SWT.NONE); container.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); treeMap = new TreeMap<TaxonomyNode>(container); treeMap.setTreeMapLayout(new SquarifiedLayout<TaxonomyNode>(10)); treeMap.setLabelProvider( new ILabelProvider<TaxonomyNode>() { @Override public String getLabel( ITreeModel<IRectangle<TaxonomyNode>> model, IRectangle<TaxonomyNode> rectangle) { return rectangle.getNode().getName(); } }); legend = new TreeMapLegend(container, treeMap, getModel(), getRenderer()); final SecurityDetailsViewer details = new SecurityDetailsViewer(sash, SWT.NONE, getModel().getClient(), true); treeMap.addSelectionChangeListener( new ISelectionChangeListener<TaxonomyNode>() { @Override public void selectionChanged( ITreeModel<IRectangle<TaxonomyNode>> model, IRectangle<TaxonomyNode> rectangle, String label) { TaxonomyNode node = rectangle.getNode(); details.setInput(node.getBackingSecurity()); } }); // layout tree map + legend GridLayoutFactory.fillDefaults().numColumns(1).margins(10, 10).applyTo(container); GridDataFactory.fillDefaults().grab(true, true).applyTo(treeMap); GridDataFactory.fillDefaults().grab(true, false).applyTo(legend); // layout sash details.getControl().pack(); int width = details.getControl().getBounds().width; sash.setWeights(new int[] {parent.getParent().getParent().getBounds().width - width, width}); treeMap.setRectangleRenderer(new ClassificationRectangleRenderer(getModel(), getRenderer())); treeMap.setTreeModel(new Model(getModel().getRootNode())); legend.setRootItem(getModel().getRootNode()); return sash; }
public void createControl(Composite parent, IActionBars actionbars) { this.content = new Composite(parent, SWT.NONE); content.setLayout(new GridLayout(1, false)); GridUtils.removeMargins(content); content.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); // Make some sashes final SashForm horiz = new SashForm(content, SWT.VERTICAL); horiz.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); horiz.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final SashForm top = new SashForm(horiz, SWT.HORIZONTAL); final SashForm bottom = new SashForm(horiz, SWT.HORIZONTAL); // Fill the sashes topSystem.createPlotPart(top, "Integration", null, PlotType.XY, getPart()); Label label = new Label(top, SWT.NONE); label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); super.createControl(bottom, actionbars); rightSystem.createPlotPart(bottom, "Integration", null, PlotType.XY, getPart()); horiz.setWeights(new int[] {30, 70}); top.setWeights(new int[] {70, 30}); bottom.setWeights(new int[] {70, 30}); topSystem.setShowLegend(false); rightSystem.setShowLegend(false); profilePlottingSystem.setShowIntensity(false); }
private void configureSashMode(int mode) { tabFolder = null; if (sashForm != null) { if (sashForm.getOrientation() != mode) sashForm.setOrientation(mode); return; } recreateRootComposite(); sashForm = new SashForm(rootComposite, mode); createMessageViewers(sashForm); sashForm.setWeights(new int[] {50, 50}); parentComposite.layout(); processCurrentTransaction(); }
public void createControl() { sashForm = new SashForm(this, SWT.VERTICAL); sashForm.setLayout(new FillLayout()); sashForm.setSashWidth(10); createInfoViewer(sashForm); createBundleTreeViewer(sashForm); showAll = createButtons(this); setLayout(new BundleTreeLayout()); sashForm.setWeights(new int[] {30, 70}); }
/** {@inheritDoc} */ @Override public void createPartControl(Composite parent, FormToolkit toolkit) { sashForm = new SashForm(parent, sashFormStyle); sashForm.setLayout(new GridLayout(1, false)); List<ISubView> subViews = getSubViews(); for (final ISubView subView : subViews) { subView.createPartControl(sashForm, toolkit); subView.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); subView .getControl() .addFocusListener( new FocusAdapter() { /** {@inheritDoc} */ @Override public void focusGained(FocusEvent e) { getRootEditor().setActiveSubView(subView); } }); if (null != subView.getSelectionProvider()) { ISelectionProvider prov = subView.getSelectionProvider(); prov.addSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { getRootEditor().setSelection(event.getSelection()); } }); prov.addSelectionChangedListener(getRootEditor().getSelectionChangedListener()); if (prov instanceof IPostSelectionProvider) { ((IPostSelectionProvider) prov) .addPostSelectionChangedListener(getRootEditor().getPostSelectionChangedListener()); } } } if (!weightMapping.isEmpty()) { int[] weights = new int[subViews.size()]; for (int i = 0; i < subViews.size(); i++) { if (weightMapping.containsKey(subViews.get(i))) { weights[i] = weightMapping.get(subViews.get(i)); } } sashForm.setWeights(weights); } }
public RequestResponseViewer(SashForm parentForm) { imageCache = new ImageCache(Activator.PLUGIN_ID); this.parentForm = parentForm; parentComposite = new Composite(parentForm, SWT.NONE); parentComposite.setLayout(new FormLayout()); optionsMenu = createOptionsMenu(parentForm.getShell()); toolbarComposite = createToolbarComposite(parentComposite); FormData fd = new FormData(); fd.left = new FormAttachment(0); fd.right = new FormAttachment(100); fd.top = new FormAttachment(0); toolbarComposite.setLayoutData(fd); setTabbedMode(); IModel model = Activator.getDefault().getModel(); model.addWorkspaceListener( new IEventHandler() { @Override public void handleEvent(IEvent event) { if (event instanceof WorkspaceCloseEvent || event instanceof WorkspaceResetEvent) { handleWorkspaceCloseOrReset(); } } }); }
private void loadViewPanesVisibility() { String visiblePanes = Platform.getPreferencesService() .getString(DebugUIPlugin.getUniqueIdentifier(), getVisibilityPrefId(), null, null); if (visiblePanes != null && visiblePanes.length() > 0) { StringTokenizer tokenizer = new StringTokenizer(visiblePanes, ","); // $NON-NLS-1$ while (tokenizer.hasMoreTokens()) { String paneId = tokenizer.nextToken(); fVisibleViewPanes.add(paneId); } } else { for (int i = 0; i < defaultVisiblePaneIds.length; i++) { fVisibleViewPanes.add(defaultVisiblePaneIds[i]); } } Enumeration<String> enumeration = fViewPaneControls.keys(); while (enumeration.hasMoreElements()) { String paneId = enumeration.nextElement(); boolean visible = false; if (fVisibleViewPanes.contains(paneId)) visible = true; Control control = fViewPaneControls.get(paneId); control.setVisible(visible); IMemoryViewPane viewPane = fViewPanes.get(paneId); viewPane.setVisible(visible); } fSashForm.layout(); }
private void createUiElements(final Composite parent) { sashForm = new SashForm(parent, SWT.SMOOTH); sashForm.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); overviewPart.createControl(sashForm); contentPart.createControl(sashForm); sashForm.setWeights(preferences.loadSashWeights()); sashForm.addDisposeListener( new DisposeListener() { @Override public void widgetDisposed(final DisposeEvent e) { preferences.storeSashWeights(sashForm.getWeights()); } }); }
/* * (non-Javadoc) * @see * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets * .Composite) */ @Override public void createPartControl(Composite parent) { fSashForm = new SashForm(parent, SWT.HORIZONTAL); fSelectionProvider = new MemoryViewSelectionProvider(); // set up selection provider and listeners getSite().setSelectionProvider(fSelectionProvider); createMemoryBlocksTreeViewPane(fSashForm); createRenderingViewPane(IDebugUIConstants.ID_RENDERING_VIEW_PANE_1); createRenderingViewPane(IDebugUIConstants.ID_RENDERING_VIEW_PANE_2); setVisible(true); // set up weights in sashform Integer[] weights = fWeights.toArray(new Integer[fWeights.size()]); int[] intWeights = new int[weights.length]; for (int i = 0; i < weights.length; i++) { intWeights[i] = weights[i].intValue(); } fSashForm.setWeights(intWeights); loadViewPanesVisibility(); createOrientationActions(); loadOrientation(); fPartListener = new MemoryViewPartListener(this); getSite().getPage().addPartListener(fPartListener); activateHandlers(); // restore view pane after finishing creating all the view panes restoreView(); }
@Override public void setCursor(Cursor cursor) { super.setCursor(cursor); final java.awt.Cursor awtPredefinedCursor; if (cursor != null && (cursor.equals(CursorFactory.getCursor(SWT.CURSOR_WAIT)) || cursor.equals(CursorFactory.getCursor(SWT.CURSOR_APPSTARTING)) || cursor.equals(CursorFactory.getCursor(SWT.CURSOR_SIZENS)))) { if (cursor.equals(CursorFactory.getCursor(SWT.CURSOR_APPSTARTING))) { awtPredefinedCursor = java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR); } else if (cursor.equals(CursorFactory.getCursor(SWT.CURSOR_SIZENS))) { awtPredefinedCursor = java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.HAND_CURSOR); } else { awtPredefinedCursor = java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR); } } else { awtPredefinedCursor = java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR); } final Frame frame = SWT_AWT.getFrame(mainChartComposite); Runnable runnable = new Runnable() { public void run() { frame.setCursor(awtPredefinedCursor); if (mainChartPanel.getComponents().length > 0) { mainChartPanel.getComponent(0).setCursor(awtPredefinedCursor); } } }; EventQueue.invokeLater(runnable); }
public Control createControl(Composite parent) { composite = new SashForm(parent, SWT.VERTICAL); properties.createControl(composite); editor.createControl(composite); composite.setWeights(new int[] {15, 30}); return composite; }
/** Create contents of the window. */ protected void createContents() { mAndroidSdkUpdater = new Shell(mParentShell, SWT.SHELL_TRIM); mAndroidSdkUpdater.addDisposeListener( new DisposeListener() { public void widgetDisposed(DisposeEvent e) { onAndroidSdkUpdaterDispose(); // $hide$ (hide from SWT designer) } }); FillLayout fl; mAndroidSdkUpdater.setLayout(fl = new FillLayout(SWT.HORIZONTAL)); fl.marginHeight = fl.marginWidth = 5; mAndroidSdkUpdater.setMinimumSize(new Point(200, 50)); mAndroidSdkUpdater.setSize(745, 433); mAndroidSdkUpdater.setText("Android SDK and AVD Manager"); mSashForm = new SashForm(mAndroidSdkUpdater, SWT.NONE); mPageList = new List(mSashForm, SWT.BORDER); mPageList.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onPageListSelected(); // $hide$ (hide from SWT designer) } }); mPagesRootComposite = new Composite(mSashForm, SWT.NONE); mStackLayout = new StackLayout(); mPagesRootComposite.setLayout(mStackLayout); createPages(); mSashForm.setWeights(new int[] {150, 576}); }
/** * Initializes the sash form weights from the preference store (using default values if no sash * weights were stored previously). */ protected void initSashWeights() { IDialogSettings settings = getDialogSettings(false); if (settings != null) { int tree = getIntSetting(settings, SASH_WEIGHT_TREE); if (tree > 0) { if (fDetailPane != null) { int details = getIntSetting(settings, SASH_WEIGHT_DETAILS); if (details <= 0) { details = tree / 2; } fSashForm.setWeights(new int[] {tree, details}); } else { fSashForm.setWeights(new int[] {tree}); } } } }
/** * Creates the contents of the dialog * * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ protected Control createDialogArea(Composite parent) { Composite dialogComp = (Composite) super.createDialogArea(parent); setDialogTitleInfo(); SashForm sash = new SashForm(dialogComp, SWT.HORIZONTAL); GridData gd = new GridData(GridData.FILL_BOTH); sash.setLayoutData(gd); createFileTreeArea(sash); infoPanel = new Composite(sash, SWT.BORDER); infoPanel.setLayout(new FillLayout()); sash.setWeights(DEFAULT_SASH_WEIGHTS); return dialogComp; }
/* * (non-Javadoc) * @see org.eclipse.swt.widgets.Widget * #dispose() */ @Override public void dispose() { if (this.labelProvider != null) this.labelProvider.dispose(); if (this.blueFont != null && !this.blueFont.isDisposed()) this.blueFont.dispose(); super.dispose(); }
@Override public void createPartControl(Composite parent) { parent.setLayout(new FillLayout(SWT.VERTICAL)); SashForm sashForm = new SashForm(parent, SWT.VERTICAL | SWT.SMOOTH); sashForm.setSashWidth(5); sashForm.setBackground(ColorConstants.white); sashForm.setLayout(new FillLayout()); Composite top = kit.createComposite(sashForm); top.setLayout(new FillLayout(SWT.VERTICAL)); Composite bottom = kit.createComposite(sashForm); bottom.setLayout(new FillLayout(SWT.VERTICAL)); sashForm.setWeights(new int[] {3, 2}); createViewer(top); createTimeScalingSection(bottom); hookActions(); setActiveSession(); }