@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); }
@Override public void createPage() { super.createPage(); Composite parent = (Composite) getContent(); coolBar = new CoolBar(parent, SWT.FLAT); createControlsToolBar(coolBar); createConfigurationToolBar(coolBar); packCoolBar(); SashForm sashForm = new SashForm(parent, SWT.NONE); sashForm.setLayout(new GridLayout()); sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); sashForm.setOrientation(SWT.VERTICAL); sashForm.SASH_WIDTH = 3; createScriptTableSection(sashForm); createStatusWindow(sashForm); sashForm.setWeights(new int[] {8, 2}); setMinSize(0, 0); // TODO: Change to use OteHelpContext HelpUtil.setHelp(this, "test_manager_scripts_page", "org.eclipse.osee.framework.help.ui"); }
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); } }
@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(); }
@Override public void createPartControl(Composite parent) { Control[] childern = parent.getChildren(); for (Control control : childern) { control.setVisible(false); } form = new SashForm(parent, 512); form.setLayout(new FillLayout()); folder = new TabFolder(form, 128); // theConjectures = new ValidationTable(form, this); // form.setWeights(new int[] { 85, 15 }); theArch = new GenericTabItem("Architecture overview", folder, AllowedOverrunDirection.Both); theOverview = new GenericTabItem("Execution overview", folder, AllowedOverrunDirection.Vertical); cw.clear(); IFile file = null; try { file = ((FileEditorInput) getEditorInput()).getFile(); FileUtility.deleteMarker(file, null, TracefileViewerPlugin.PLUGIN_ID); theMarkers = new TracefileMarker(file); if (FileUtility.getContent(file).size() == 0) { ErrorDialog.openError( getSite().getShell(), "Editor open", "File is empty", Status.CANCEL_STATUS); return; } } catch (Exception e) { TracefileViewerPlugin.log(e); } catch (OutOfMemoryError m) { showMessage( "The trace file can not be visualized because the Java Virtual Machine ran out of heap space. Try to allow Overture more heap space using Virtual Machine custom arguments (e.g. -Xms40m -Xmx512m)."); return; } try { parseFile(selectedFile.getAbsolutePath()); } catch (Exception e) { TracefileViewerPlugin.log(e); } openValidationConjectures(file); }
@Override public void createControls(Composite parent) { AutotoolsConfigurationManager.getInstance().clearTmpConfigurations(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(); // layout.numColumns= 2; // PixelConverter pc= new PixelConverter(composite); // layout.verticalSpacing= pc.convertHeightInCharsToPixels(1) / 2; 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); // usercomp.addControlListener(new ControlAdapter() { // @Override // public void controlResized(ControlEvent e) { // specificResize(); // }}); }
public CompositeMainProtocolConfidence( Composite parent, int style, MinerResultsFP_Line minerresults) { super(parent, style); ip = minerresults.getIp(); this.setLayout(new FillLayout()); SashForm form = new SashForm(this, SWT.HORIZONTAL | SWT.BORDER); form.setLayout(new FillLayout()); Composite win1 = new Composite(form, SWT.NONE); win1.setLayout(new FillLayout()); CTabFolderChart tab = new CTabFolderChart(form, SWT.NONE, this); form.setWeights(new int[] {250, 800}); System.out.println("ip="); CompositeTable table = new CompositeTable( win1, SWT.BORDER | SWT.SINGLE, ip, minerresults.protocolPairList, tab, this); tableIndex = new int[table.getTableIndexCount()]; }
/** Initialisiert das Layout der View. */ private void init() { sash = new SashForm(parent, SWT.VERTICAL); sash.setLayoutData(new GridData(GridData.FILL_BOTH)); sash.setLayout(SWTUtil.createGrid(1, true)); view = new Composite(sash, SWT.BORDER); view.setLayoutData(new GridData(GridData.FILL_BOTH)); view.setLayout(SWTUtil.createGrid(1, true)); snapin = new Composite(sash, SWT.BORDER); snapin.setLayoutData(new GridData(GridData.FILL_BOTH)); snapin.setLayout(SWTUtil.createGrid(1, true)); sash.setMaximizedControl(view); if (!Customizing.SETTINGS.getBoolean("application.view.hidelogo", false)) { //////////////////////////////////////////////////////////////////////////// // final Image logo = SWTUtil.getImage(Customizing.SETTINGS.getString("application.view.logo", "panel.png")); final Rectangle imageSize = logo.getBounds(); logoBg = SWTUtil.getCanvas(view, logo, SWT.TOP | SWT.RIGHT); RGB bg = Customizing.SETTINGS.getRGB( "application.view.background", GUI.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB()); logoBg.setBackground(new org.eclipse.swt.graphics.Color(GUI.getDisplay(), bg)); logoBg.setLayout(SWTUtil.createGrid(1, false)); logoBg.addListener( SWT.Paint, new Listener() { public void handleEvent(Event event) { GC gc = event.gc; Rectangle size = logoBg.getBounds(); gc.fillRectangle(size); gc.drawImage(logo, size.width - imageSize.width, 0); gc.setFont(Font.SMALL.getSWTFont()); // kein Hintergrund hinter dem Text malen // Ist zumindest unter Linux nicht noetig. Windows und OSX muesste man mal noch testen gc.setBackground(GUI.getDisplay().getSystemColor(SWT.TRANSPARENT)); gc.setForeground(GUI.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND)); gc.setAlpha(150); gc.drawText(logotext == null ? "" : logotext, 8, 10, true); } }); Label sep = new Label(view, SWT.SEPARATOR | SWT.HORIZONTAL); sep.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); //////////////////////////////////////////////////////////////////////////// } if (!Customizing.SETTINGS.getBoolean("application.view.hidepanel", false)) { //////////////////////////////////////////////////////////////////////////// // Composite comp = new Composite(view, SWT.NONE); comp.setLayout(SWTUtil.createGrid(1, false)); comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.titlePart = new TitlePart(title, false); this.titlePart.paint(comp); } if (!Customizing.SETTINGS.getBoolean("application.view.hidemessages", false)) { //////////////////////////////////////////////////////////////////////////// // try { notifications = new NotificationPanel(); notifications.paint(view); } catch (Exception e) { Logger.error("unable to paint notification panel", e); } //////////////////////////////////////////////////////////////////////////// } }
private void createLiteratureWidgets(Composite parent) { // criando imagens String PLUGIN_ID = "br.ufpe.cin.reviewer.ui.rcp"; Bundle bundle = Platform.getBundle(PLUGIN_ID); Image addIcon = ImageDescriptor.createFromURL( FileLocator.find(bundle, new Path("images/Add-Green-Button-icon.png"), null)) .createImage(); Image minusIcon = ImageDescriptor.createFromURL( FileLocator.find(bundle, new Path("images/Minus-Green-Button-icon.png"), null)) .createImage(); Image AutomaticIcon = ImageDescriptor.createFromURL( FileLocator.find(bundle, new Path("images/A-Green-Button-icon.png"), null)) .createImage(); Image ManualIcon = ImageDescriptor.createFromURL( FileLocator.find(bundle, new Path("images/M-Green-Button-icon.png"), null)) .createImage(); Image DeleteIcon = ImageDescriptor.createFromURL( FileLocator.find(bundle, new Path("images/D-Green-Button-icon.png"), null)) .createImage(); sash = new SashForm(form.getBody(), SWT.HORIZONTAL); sash.setLayout(new GridLayout(4, false)); GridData sashLayout = new GridData(GridData.FILL_BOTH); sashLayout.grabExcessHorizontalSpace = true; sashLayout.grabExcessVerticalSpace = true; sash.setLayoutData(sashLayout); sash.getMaximizedControl(); // Section for List of reviews sectionList = toolkit.createSection(sash, Section.SHORT_TITLE_BAR); sectionList.setText("REVIEWS"); sectionList.setLayout(new GridLayout(1, false)); GridData sectionListLayout = new GridData(GridData.FILL_VERTICAL); sectionListLayout.horizontalSpan = 1; sectionList.setLayoutData(sectionListLayout); toolbarList = new ToolBar(sectionList, SWT.NONE); ToolItem itemAddReview = new ToolItem(toolbarList, SWT.BUTTON1); itemAddReview.setImage(addIcon); ToolItem itemDeleteReview = new ToolItem(toolbarList, SWT.BUTTON1); itemDeleteReview.setImage(minusIcon); sectionList.setTextClient(toolbarList); listComposite = toolkit.createComposite(sectionList, SWT.BORDER); listComposite.setLayout(new GridLayout(2, false)); listComposite.setLayoutData(new GridData()); list = new List(listComposite, SWT.V_SCROLL); GridData listLayoutData = new GridData(GridData.FILL_BOTH); listLayoutData.horizontalSpan = 1; list.setLayoutData(listLayoutData); list.addSelectionListener(new LiteratureReviewsListHandler()); refreshLiteratureView(); itemAddReview.addSelectionListener(new LiteratureReviewAddReviewHandler()); itemDeleteReview.addSelectionListener(new LiteratureReviewRemoveReviewHandler()); // Section for review information sectionInfo = toolkit.createSection(sash, Section.SHORT_TITLE_BAR); sectionInfo.setText("REVIEW INFO"); sectionInfo.setLayout(new GridLayout(1, false)); sectionInfo.setLayoutData(new GridData(GridData.FILL_BOTH)); reviewInfoComposite = toolkit.createComposite(sectionInfo, SWT.BORDER); GridData reviewCompositeData = new GridData(GridData.FILL_BOTH); reviewCompositeData.horizontalSpan = 1; reviewInfoComposite.setLayoutData(reviewCompositeData); reviewInfoComposite.setLayout(new GridLayout(3, false)); reviewInfoComposite.setVisible(true); // Review Title titleLabel = toolkit.createLabel(reviewInfoComposite, "TITLE: "); titleLabel.setFont( new Font(UIConstants.APP_DISPLAY, UIConstants.SYSTEM_FONT_NAME, 10, SWT.BOLD)); titleLabel.setLayoutData(new GridData()); // Review Title titleInfoLabel = toolkit.createLabel(reviewInfoComposite, "Pesquisa 1"); titleInfoLabel.setFont( new Font(UIConstants.APP_DISPLAY, UIConstants.SYSTEM_FONT_NAME, 10, SWT.NONE)); GridData titleInfoLabelData = new GridData(GridData.FILL_HORIZONTAL); titleInfoLabelData.horizontalSpan = 2; titleInfoLabel.setLayoutData(titleInfoLabelData); // Criteria List sectionCriteria = toolkit.createSection(reviewInfoComposite, Section.SHORT_TITLE_BAR); sectionCriteria.setText("CRITERIONS"); sectionCriteria.setLayout(new GridLayout(2, false)); GridData sectionCriteriaLayout = new GridData(GridData.FILL_HORIZONTAL); sectionCriteriaLayout.horizontalSpan = 3; sectionCriteria.setLayoutData(sectionCriteriaLayout); toolbarCriteria = new ToolBar(sectionCriteria, SWT.NONE); ToolItem itemAddCriteria = new ToolItem(toolbarCriteria, SWT.BUTTON1); itemAddCriteria.setImage(addIcon); ToolItem itemDeleteCriteria = new ToolItem(toolbarCriteria, SWT.BUTTON1); itemDeleteCriteria.setImage(minusIcon); sectionCriteria.setTextClient(toolbarCriteria); criteriaListComposite = toolkit.createComposite(sectionCriteria, SWT.BORDER); criteriaListComposite.setLayout(new GridLayout(1, false)); criteriaListComposite.setLayoutData(new GridData()); criteriaList = new List(criteriaListComposite, SWT.V_SCROLL); GridData criterialistLayout = new GridData(GridData.FILL_BOTH); criterialistLayout.horizontalSpan = 1; criteriaList.setLayoutData(criterialistLayout); criteriaList.addSelectionListener(new CriteriaListHandler()); refreshCriteriaList(); itemAddCriteria.addSelectionListener(new LiteratureReviewAddCriteriaHandler()); itemDeleteCriteria.addSelectionListener(new LiteratureReviewRemoveCriteriaHandler()); // Studies section sectionStudies = toolkit.createSection(reviewInfoComposite, Section.SHORT_TITLE_BAR); sectionStudies.setText("STUDIES"); sectionStudies.setLayout(new GridLayout(2, false)); GridData sectionStudiesLayout = new GridData(GridData.FILL_BOTH); sectionStudiesLayout.horizontalSpan = 3; sectionStudies.setLayoutData(sectionStudiesLayout); toolbarStudies = new ToolBar(sectionStudies, SWT.NONE); final ToolItem itemAutomatic = new ToolItem(toolbarStudies, SWT.DROP_DOWN); itemAutomatic.setImage(AutomaticIcon); itemAutomatic.addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { // super.widgetSelected(e); Menu menu = new Menu(form.getShell(), SWT.POP_UP); MenuItem item1 = new MenuItem(menu, SWT.PUSH); item1.setText("New search"); item1.addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { IPerspectiveRegistry perspectiveRegistry = PlatformUI.getWorkbench().getPerspectiveRegistry(); IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); activePage.setPerspective( perspectiveRegistry.findPerspectiveWithId(SearchPerspective.ID)); } @Override public void widgetDefaultSelected(SelectionEvent e) { // TODO Auto-generated method stub } }); MenuItem item2 = new MenuItem(menu, SWT.PUSH); item2.setText("import BibText"); Point loc = itemAutomatic.getParent().getLocation(); Rectangle rect = itemAutomatic.getBounds(); Point mLoc = new Point(loc.x - 1, loc.y + rect.height); menu.setLocation( form.getShell() .getDisplay() .map(itemAutomatic.getParent().getParent(), null, mLoc)); menu.setVisible(true); } @Override public void widgetDefaultSelected(SelectionEvent e) { // TODO Auto-generated method stub } }); final ToolItem itemManual = new ToolItem(toolbarStudies, SWT.DROP_DOWN); itemManual.setImage(ManualIcon); itemManual.addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { // super.widgetSelected(e); Menu menu = new Menu(form.getShell(), SWT.POP_UP); MenuItem item1 = new MenuItem(menu, SWT.PUSH); item1.setText("Add Study"); item1.addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { MessageBox manualDialog = new MessageBox(form.getShell(), SWT.ICON_ERROR); manualDialog.setText("Reviewer"); manualDialog.setMessage("Teste"); int returnCode = manualDialog.open(); } @Override public void widgetDefaultSelected(SelectionEvent e) { // TODO Auto-generated method stub } }); MenuItem item2 = new MenuItem(menu, SWT.PUSH); item2.setText("Import BibText"); Point loc = itemManual.getParent().getLocation(); Rectangle rect = itemManual.getBounds(); Point mLoc = new Point(loc.x + 38, loc.y + rect.height); menu.setLocation( form.getShell().getDisplay().map(itemManual.getParent().getParent(), null, mLoc)); menu.setVisible(true); } @Override public void widgetDefaultSelected(SelectionEvent e) { // TODO Auto-generated method stub } }); final ToolItem itemDeleteStudies = new ToolItem(toolbarStudies, SWT.DROP_DOWN); itemDeleteStudies.setImage(DeleteIcon); itemDeleteStudies.addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { // super.widgetSelected(e); Menu menu = new Menu(form.getShell(), SWT.POP_UP); MenuItem item1 = new MenuItem(menu, SWT.PUSH); item1.setText("Remove by title"); MenuItem item2 = new MenuItem(menu, SWT.PUSH); item2.setText("Remove by abstract"); Point loc = itemDeleteStudies.getParent().getLocation(); Rectangle rect = itemDeleteStudies.getBounds(); Point mLoc = new Point(loc.x + 76, loc.y + rect.height); menu.setLocation( form.getShell() .getDisplay() .map(itemDeleteStudies.getParent().getParent(), null, mLoc)); menu.setVisible(true); } @Override public void widgetDefaultSelected(SelectionEvent e) { // TODO Auto-generated method stub } }); sectionStudies.setTextClient(toolbarStudies); studiesComposite = toolkit.createComposite(sectionStudies, SWT.BORDER); studiesComposite.setLayout(new GridLayout(1, false)); studiesComposite.setLayoutData(new GridData()); // Manual Studies section sectionManual = toolkit.createSection(studiesComposite, Section.SHORT_TITLE_BAR); sectionManual.setText("MANUAL STUDIES"); sectionManual.setLayout(new GridLayout(2, false)); GridData sectionManualLayout = new GridData(GridData.FILL_BOTH); sectionManualLayout.horizontalSpan = 2; sectionManual.setLayoutData(sectionManualLayout); toolbarManual = new ToolBar(sectionManual, SWT.NONE); ToolItem itemDeleteManual = new ToolItem(toolbarManual, SWT.BUTTON1); itemDeleteManual.setImage(minusIcon); sectionManual.setTextClient(toolbarManual); manualComposite = toolkit.createComposite(sectionManual, SWT.BORDER); manualComposite.setLayout(new GridLayout(1, false)); manualComposite.setLayoutData(new GridData()); // Info Table infoTable = toolkit.createTable(manualComposite, SWT.BORDER | SWT.FULL_SELECTION); infoTable.setLinesVisible(true); infoTable.setHeaderVisible(true); GridData infoTableLayoutData = new GridData(GridData.FILL_BOTH); infoTable.setLayoutData(infoTableLayoutData); // insert columns and set their names String[] titles = {"info 1", "info 2", "info 3", "info 4"}; for (int i = 0; i < titles.length; i++) { TableColumn column = new TableColumn(infoTable, SWT.NONE); column.setText(titles[i]); } for (int i = 0; i < titles.length; i++) { infoTable.getColumn(i).pack(); } // Automatic Studies section sectionAutomatic = toolkit.createSection(studiesComposite, Section.SHORT_TITLE_BAR); sectionAutomatic.setText("AUTOMATIC STUDIES"); sectionAutomatic.setLayout(new GridLayout(2, false)); GridData sectionAutomaticLayout = new GridData(GridData.FILL_BOTH); sectionAutomaticLayout.horizontalSpan = 2; sectionAutomatic.setLayoutData(sectionAutomaticLayout); toolbarAutomatic = new ToolBar(sectionAutomatic, SWT.NONE); ToolItem itemDeleteAutomatic = new ToolItem(toolbarAutomatic, SWT.BUTTON1); itemDeleteAutomatic.setImage(minusIcon); sectionAutomatic.setTextClient(toolbarAutomatic); automaticComposite = toolkit.createComposite(sectionAutomatic, SWT.BORDER); automaticComposite.setLayout(new GridLayout(2, false)); automaticComposite.setLayoutData(new GridData()); // Query String Label QueryStringLabel = toolkit.createLabel(automaticComposite, "QUERY STRING: "); QueryStringLabel.setFont( new Font(UIConstants.APP_DISPLAY, UIConstants.SYSTEM_FONT_NAME, 10, SWT.BOLD)); QueryStringLabel.setLayoutData(new GridData()); // Query String Label QueryLabel = toolkit.createLabel(automaticComposite, ""); QueryLabel.setFont( new Font(UIConstants.APP_DISPLAY, UIConstants.SYSTEM_FONT_NAME, 10, SWT.NONE)); QueryLabel.setLayoutData(new GridData()); // Source Label SourceLabel = toolkit.createLabel(automaticComposite, "SOURCE"); SourceLabel.setFont( new Font(UIConstants.APP_DISPLAY, UIConstants.SYSTEM_FONT_NAME, 10, SWT.BOLD)); GridData sourceLabelData = new GridData(); sourceLabelData.horizontalSpan = 2; SourceLabel.setLayoutData(sourceLabelData); // Source Table sourceTable = toolkit.createTable(automaticComposite, SWT.BORDER | SWT.FULL_SELECTION); sourceTable.setLinesVisible(true); sourceTable.setHeaderVisible(true); GridData sourceTableLayoutData = new GridData(GridData.FILL_BOTH); sourceTableLayoutData.horizontalSpan = 2; sourceTable.setLayoutData(sourceTableLayoutData); // insert columns and set their names String[] titles2 = {"Source", "Total Founded", "Total Fetched"}; for (int i = 0; i < titles2.length; i++) { TableColumn column = new TableColumn(sourceTable, SWT.NONE); column.setText(titles2[i]); } for (int i = 0; i < titles2.length; i++) { sourceTable.getColumn(i).pack(); } buttonInfoComposite = toolkit.createComposite(reviewInfoComposite); buttonInfoComposite.setLayout(new GridLayout(2, false)); GridData buttonInfoData = new GridData(GridData.FILL_HORIZONTAL); buttonInfoData.horizontalSpan = 3; buttonInfoData.grabExcessHorizontalSpace = true; buttonInfoComposite.setLayoutData(buttonInfoData); exportButton = toolkit.createButton(buttonInfoComposite, "Export review", SWT.PUSH); GridData exportButtonLayoutData = new GridData(GridData.FILL_HORIZONTAL); exportButtonLayoutData.horizontalAlignment = SWT.RIGHT; // exportButtonLayoutData.grabExcessHorizontalSpace = true; exportButtonLayoutData.horizontalSpan = 1; exportButton.setLayoutData(exportButtonLayoutData); evaluateButton = toolkit.createButton(buttonInfoComposite, "evaluate studies", SWT.PUSH); GridData evaluateButtonLayoutData = new GridData(); evaluateButtonLayoutData.horizontalAlignment = SWT.RIGHT; // evaluateButtonLayoutData.grabExcessHorizontalSpace = true; evaluateButtonLayoutData.horizontalSpan = 1; evaluateButton.setLayoutData(evaluateButtonLayoutData); evaluateButton.addSelectionListener(new LiteratureReviewPhasesButtonHandler()); sash.setWeights(new int[] {1, 3}); sectionList.setClient(listComposite); sectionInfo.setClient(reviewInfoComposite); sectionCriteria.setClient(criteriaListComposite); sectionStudies.setClient(studiesComposite); sectionManual.setClient(manualComposite); sectionAutomatic.setClient(automaticComposite); }
void createContents(Composite parent) { prefs = frame.getPreferences(); prefs.setDefault(PREFS_TARGET_FILES_KEY, ""); // $NON-NLS-1$ prefs.setDefault(PREFS_SOURCE_FILES_KEY, ""); // $NON-NLS-1$ prefs.setDefault(PREFS_SAME_TARGET_KEY, true); prefs.setDefault(PREFS_USE_EXTENSION_FILTER_KEY, false); prefs.setDefault(PREFS_EXTENSION_FILTER_KEY, DEFAULT_EXTENSION_FILTER); prefs.setDefault(PREFS_TARGET_FILES_KEY + ".save", true); // $NON-NLS-1$ prefs.setDefault(PREFS_SOURCE_FILES_KEY + ".save", true); // $NON-NLS-1$ rootComp = new SashForm(parent, SWT.HORIZONTAL); rootComp.setSashWidth(8); rootComp.setLayout(new FillLayout()); Group targetComp = new Group(rootComp, SWT.NONE); targetComp.setText(messages.getString("FileEntrySelectPage.TARGET_TABLE_CAPTION")); { FillLayout l = new FillLayout(); l.marginWidth = l.marginHeight = 8; targetComp.setLayout(l); } targetFileListViewer = new FileDropListViewer(frame, targetComp); Composite rightComp = new Composite(rootComp, SWT.NONE); { FormLayout l = new FormLayout(); l.spacing = 8; rightComp.setLayout(l); } Group storageComp = new Group(rightComp, SWT.NONE); storageComp.setText(messages.getString("FileEntrySelectPage.SOURCE_TABLE_CAPTION")); { FormLayout l = new FormLayout(); l.marginWidth = l.marginHeight = 8; l.spacing = 8; storageComp.setLayout(l); } storageFileListViewer = new FileDropListViewer(frame, storageComp); sameTargetCheck = new Button(storageComp, SWT.CHECK); sameTargetCheck.setText(messages.getString("FileEntrySelectPage.TARGET_AS_SOURCE_BUTTON_TEXT")); sameTargetCheck.addSelectionListener(UPDATE_CONTENTS_ENABLED); storageFileListViewer .getControl() .setLayoutData( new FormDataBuilder().left(0).right(100).top(0).bottom(sameTargetCheck).build()); sameTargetCheck.setLayoutData(new FormDataBuilder().left(0).right(100).bottom(100).build()); Composite extFilterComp = new Composite(rightComp, SWT.NONE); { FormLayout l = new FormLayout(); l.marginWidth = l.marginHeight = 8; l.spacing = 8; extFilterComp.setLayout(l); } extFilterCheck = new Button(extFilterComp, SWT.CHECK); extFilterCheck.setText(messages.getString("FileEntrySelectPage.TARGET_EXTENSION_LABEL_TEXT")); extFilterCheck.addSelectionListener(UPDATE_CONTENTS_ENABLED); extFilterText = new Text(extFilterComp, SWT.BORDER); extFilterCheck.setLayoutData(new FormDataBuilder().left(0).top(0).build()); extFilterText.setLayoutData( new FormDataBuilder().left(extFilterCheck).right(100).top(0).build()); storageComp.setLayoutData( new FormDataBuilder().left(0).right(100).top(0).bottom(extFilterComp).build()); extFilterComp.setLayoutData(new FormDataBuilder().left(0).right(100).bottom(100).build()); sameTargetCheck.setSelection(prefs.getBoolean(PREFS_SAME_TARGET_KEY)); extFilterCheck.setSelection(prefs.getBoolean(PREFS_USE_EXTENSION_FILTER_KEY)); extFilterText.setText(prefs.getString(PREFS_EXTENSION_FILTER_KEY)); if (!prefs.getString(PREFS_TARGET_FILES_KEY).isEmpty()) { for (String path : prefs.getString(PREFS_TARGET_FILES_KEY).split(File.pathSeparator)) { // $NON-NLS-1$ targetFileListViewer.addFile(path); } } if (!prefs.getString(PREFS_SOURCE_FILES_KEY).isEmpty()) { for (String path : prefs.getString(PREFS_SOURCE_FILES_KEY).split(File.pathSeparator)) { // $NON-NLS-1$ storageFileListViewer.addFile(path); } } updateContentsEnabled(); }
/** {@inheritDoc} */ @Override public void createPartControl(Composite parent) { createViewToolbar(); toolkit = new FormToolkit(parent.getDisplay()); mainComposite = new SashForm(parent, SWT.VERTICAL); GridLayout mainLayout = new GridLayout(1, true); mainLayout.marginWidth = 0; mainLayout.marginHeight = 0; mainComposite.setLayout(mainLayout); mainForm = toolkit.createForm(mainComposite); mainForm.getBody().setLayout(new GridLayout(1, true)); mainForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); createHeadClient(); toolkit.decorateFormHeading(mainForm); int borderStyle = toolkit.getBorderStyle(); toolkit.setBorderStyle(SWT.NULL); Table table = toolkit.createTable(mainForm.getBody(), SWT.V_SCROLL | SWT.H_SCROLL); toolkit.setBorderStyle(borderStyle); tableViewer = new TableViewer(table); // create tree content provider tableViewer.setContentProvider(getContentProvider()); tableViewer.setLabelProvider(getLabelProvider()); ViewerComparator comparator = getViewerComparator(); if (null != comparator) { tableViewer.setComparator(comparator); } ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE); // double-click listener IDoubleClickListener doubleClickListener = getTreeDoubleClickListener(); if (null != doubleClickListener) { tableViewer.addDoubleClickListener(doubleClickListener); } // menu String menuId = getMenuId(); if (null != menuId) { MenuManager menuManager = new MenuManager(); menuManager.setRemoveAllWhenShown(true); getSite().registerContextMenu(menuId, menuManager, tableViewer); Control control = tableViewer.getControl(); Menu menu = menuManager.createContextMenu(control); control.setMenu(menu); } // resizing listener mainComposite.addControlListener( new ControlAdapter() { private boolean verticaLayout; @Override public void controlResized(ControlEvent e) { int width = mainComposite.getBounds().width; int height = mainComposite.getBounds().height; if (width > height && verticaLayout) { verticaLayout = false; mainComposite.setOrientation(SWT.HORIZONTAL); } else if (width < height && !verticaLayout) { verticaLayout = true; mainComposite.setOrientation(SWT.VERTICAL); } mainComposite.layout(); } }); // update all updateFormTitle(); updateFormMenuManager(); updateFormBody(); tableViewer.addSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { StructuredSelection ss = (StructuredSelection) tableViewer.getSelection(); if (ss.getFirstElement() instanceof IProfileProvider || ss.getFirstElement() instanceof IEnvironmentProvider) { selectionProviderAdapter.setSelection(ss); } else { // setting selection to the CMR so that we can perform all the necessary // operations selectionProviderAdapter.setSelection( new StructuredSelection(displayedCmrRepositoryDefinition)); } } }); getSite().setSelectionProvider(selectionProviderAdapter); selectionProviderAdapter.setSelection( new StructuredSelection(displayedCmrRepositoryDefinition)); // TODO: This needs to be removed as soon as the configuration interface is fully // functional. UnfinishedWarningUtils.inform( "The configuration interface is not yet connected with the agent instrumentation. You can play around with this preview, but the instrumentations will not be effective.", "UNFINISHED_WARNING_CONFIGURATION_INTERFACE"); }
/* * (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl(Composite parent) { display = parent.getDisplay(); sashForm = new SashForm(parent, SWT.VERTICAL); FillLayout layout = new FillLayout(); sashForm.setLayout(layout); GridData data = new GridData(GridData.FILL_BOTH); sashForm.setLayoutData(data); initializeDialogUnits(sashForm); Composite composite = new Composite(sashForm, SWT.NONE); GridLayout gridLayout = new GridLayout(); gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; composite.setLayout(gridLayout); treeViewer = createTreeViewer(composite); data = new GridData(GridData.FILL_BOTH); data.heightHint = convertHeightInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_HEIGHT); data.widthHint = convertWidthInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_WIDTH); Tree tree = treeViewer.getTree(); tree.setLayoutData(data); tree.setHeaderVisible(true); activateCopy(tree); TreeViewerColumn nameColumn = new TreeViewerColumn(treeViewer, SWT.LEFT); nameColumn.getColumn().setText(ProvUIMessages.ProvUI_NameColumnTitle); nameColumn.getColumn().setWidth(400); nameColumn.getColumn().setMoveable(true); nameColumn.setLabelProvider( new ColumnLabelProvider() { public String getText(Object element) { IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class); String label = iu.getProperty(IInstallableUnit.PROP_NAME, null); if (label == null) label = iu.getId(); return label; } public Image getImage(Object element) { if (element instanceof ProvElement) return ((ProvElement) element).getImage(element); if (ProvUI.getAdapter(element, IInstallableUnit.class) != null) return ProvUIImages.getImage(ProvUIImages.IMG_IU); return null; } public String getToolTipText(Object element) { if (element instanceof AvailableIUElement && ((AvailableIUElement) element).getImageOverlayId(null) == ProvUIImages.IMG_INFO) return ProvUIMessages.RemedyElementNotHighestVersion; return super.getToolTipText(element); } }); TreeViewerColumn versionColumn = new TreeViewerColumn(treeViewer, SWT.LEFT); versionColumn.getColumn().setText(ProvUIMessages.ProvUI_VersionColumnTitle); versionColumn.getColumn().setWidth(200); versionColumn.setLabelProvider( new ColumnLabelProvider() { public String getText(Object element) { IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class); if (element instanceof IIUElement) { if (((IIUElement) element).shouldShowVersion()) return iu.getVersion().toString(); return ""; //$NON-NLS-1$ } return iu.getVersion().toString(); } }); TreeViewerColumn idColumn = new TreeViewerColumn(treeViewer, SWT.LEFT); idColumn.getColumn().setText(ProvUIMessages.ProvUI_IdColumnTitle); idColumn.getColumn().setWidth(200); idColumn.setLabelProvider( new ColumnLabelProvider() { public String getText(Object element) { IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class); return iu.getId(); } }); // Filters and sorters before establishing content, so we don't refresh unnecessarily. IUComparator comparator = new IUComparator(IUComparator.IU_NAME); comparator.useColumnConfig(getColumnConfig()); treeViewer.setComparator(comparator); treeViewer.setComparer(new ProvElementComparer()); ColumnViewerToolTipSupport.enableFor(treeViewer); contentProvider = new ProvElementContentProvider(); treeViewer.setContentProvider(contentProvider); // labelProvider = new IUDetailsLabelProvider(null, getColumnConfig(), getShell()); // treeViewer.setLabelProvider(labelProvider); // Optional area to show the size createSizingInfo(composite); // The text area shows a description of the selected IU, or error detail if applicable. iuDetailsGroup = new IUDetailsGroup( sashForm, treeViewer, convertWidthInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_WIDTH), true); setControl(sashForm); sashForm.setWeights(getSashWeights()); Dialog.applyDialogFont(sashForm); // Controls for filtering/presentation/site selection Composite controlsComposite = new Composite(composite, SWT.NONE); gridLayout = new GridLayout(); gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; gridLayout.numColumns = 2; gridLayout.makeColumnsEqualWidth = true; gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); controlsComposite.setLayout(layout); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false); controlsComposite.setLayoutData(gd); final Runnable runnable = new Runnable() { public void run() { treeViewer.addSelectionChangedListener( new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { setDetailText(resolvedOperation); } }); setDrilldownElements(input, resolvedOperation); treeViewer.setInput(input); } }; if (resolvedOperation != null && !resolvedOperation.hasResolved()) { try { getContainer() .run( true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { resolvedOperation.resolveModal(monitor); display.asyncExec(runnable); } }); } catch (Exception e) { StatusManager.getManager() .handle(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e)); } } else { runnable.run(); } }