private void showCurrent() { currentSelection = selection.getChoice(); if (currentSelection == null) currentSelection = NULL_SELECTION; EnvironmentVariable[] variables = selections.get(currentSelection); if (variables == null) variables = new EnvironmentVariable[] {}; this.variables.show(variables, new Information()); }
@Override protected Control createContents(Composite parent) { Composite base = new Composite(parent, SWT.NONE); base.setLayout(new GridLayout(1, false)); Composite top = new Composite(base, SWT.NONE); top.setLayout(new GridLayout(2, false)); top.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false)); Label selectionLabel = new Label(top, SWT.NONE); selectionLabel.setText("Platform: "); selectionLabel.setToolTipText("The platform whose environment variables should be displayed"); selectionLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); selection = new PlatformSelection() { @Override protected void changed(IPlatform newChoice) { storeCurrent(); showCurrent(); } }; selection.createControl(top); selection.getControl().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); variables = new EnvironmentVariablesPage(false); variables.createControl(base); variables.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); IPlatform[] platforms = getPlatforms(); selections.put(NULL_SELECTION, getVariables(null)); for (IPlatform platform : platforms) { selections.put(platform, getVariables(platform)); } selection.setChoices(platforms); showCurrent(); return base; }