org.eclipse.ui.forms.widgets.ExpandableComposite Java Examples

The following examples show how to use org.eclipse.ui.forms.widgets.ExpandableComposite. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApplicationOverviewEditorPart.java    From codewind-eclipse with Eclipse Public License 2.0 7 votes vote down vote up
public ProjectInfoSection(Composite parent, FormToolkit toolkit, int hSpan, int vSpan) {
	Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
       section.setText(Messages.AppOverviewEditorProjectInfoSection);
       section.setLayoutData(new GridData(SWT.FILL,SWT.FILL, true, false, hSpan, vSpan));
       section.setExpanded(true);

       Composite composite = toolkit.createComposite(section);
       GridLayout layout = new GridLayout();
       layout.numColumns = 2;
       layout.marginHeight = 5;
       layout.marginWidth = 10;
       layout.verticalSpacing = 5;
       layout.horizontalSpacing = 10;
       composite.setLayout(layout);
       composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
       toolkit.paintBordersFor(composite);
       section.setClient(composite);
       
       typeEntry = new StringEntry(composite, Messages.AppOverviewEditorTypeEntry);
       languageEntry = new StringEntry(composite, Messages.AppOverviewEditorLanguageEntry);
       projectIdEntry = new StringEntry(composite, Messages.AppOverviewEditorProjectIdEntry);
       locationEntry = new StringEntry(composite, Messages.AppOverviewEditorLocationEntry);
}
 
Example #2
Source File: AbapGitStagingView.java    From ADT_Frontend with MIT License 6 votes vote down vote up
private void createStagedComposite(Composite parent) {
	this.stagedSection = this.toolkit.createSection(parent, ExpandableComposite.SHORT_TITLE_BAR);
	this.stagedSection.setText(Messages.AbapGitStaging_staged_changes_section_header + " (0)"); //$NON-NLS-1$
	this.stagedSection.clientVerticalSpacing = 0;

	//staged section toolbar
	this.createStagedSectionToolbar();

	Composite stagedComposite = this.toolkit.createComposite(this.stagedSection);
	this.toolkit.paintBordersFor(stagedComposite);
	GridLayoutFactory.fillDefaults().applyTo(stagedComposite);
	this.stagedSection.setClient(stagedComposite);

	//create the treeviewer
	this.stagedTreeViewer = this.createTreeViewer(stagedComposite, false);
	this.stagedTreeViewer.setInput(this.stagedTreeViewerInput);
	addDragAndDropSupport(this.stagedTreeViewer, false);

	//add context menu support to the tree viewer
	this.stagedMenuFactory = new AbapGitStagingObjectMenuFactory(this.stagedTreeViewer, false, this, this.stagingUtil);
}
 
Example #3
Source File: JavaEditorCodeMiningConfigurationBlock.java    From jdt-codemining with Eclipse Public License 1.0 6 votes vote down vote up
private void createDebuggingSection(int nColumns, Composite parent) {
	final int defaultIndent = 0;
	String label = MyPreferencesMessages.JavaEditorCodeMiningConfigurationBlock_section_debugging;
	Key twistieKey = OptionsConfigurationBlock.getLocalKey("JavaEditorCodeMiningPreferencePage_section_debugging"); //$NON-NLS-1$
	PreferenceTreeNode<?> section = fFilteredPrefTree.addExpandableComposite(parent, label, nColumns, twistieKey,
			null, false);
	ExpandableComposite excomposite = getExpandableComposite(twistieKey);

	Composite inner = createInnerComposite(excomposite, nColumns, parent.getFont());

	// - Show main run/debug
	fFilteredPrefTree.addCheckBox(inner,
			MyPreferencesMessages.JavaEditorCodeMiningConfigurationBlock_showMainRun_label, PREF_SHOW_MAIN_RUN,
			TRUE_FALSE, defaultIndent, section);
	fFilteredPrefTree.addCheckBox(inner,
			MyPreferencesMessages.JavaEditorCodeMiningConfigurationBlock_showMainDebug_label, PREF_SHOW_MAIN_DEBUG,
			TRUE_FALSE, defaultIndent, section);

	// - Show variable value while debugging
	fFilteredPrefTree.addCheckBox(inner,
			MyPreferencesMessages.JavaEditorCodeMiningConfigurationBlock_showVariableValueWhileDebugging_label,
			PREF_SHOW_VARIABLE_VALUE_WHILE_DEBUGGING, TRUE_FALSE, defaultIndent, section);
}
 
Example #4
Source File: UserSettings.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Set the state of an expandable Composite to the previously saved state.
 * 
 * @param ec
 *            the expandable Composite to expand or collapse
 * @param field
 *            the unique name
 * @since 3.0.0 extracted from UserSettings2
 */
public static void setExpandedState(final ExpandableComposite ec, final String field){
	String mode =
		CoreHub.userCfg.get(USERSETTINGS2_EXPANDABLE_COMPOSITES,
			USERSETTINGS2_EXPANDABLECOMPOSITE_STATE_REMEMBER_STATE);
	if (mode.equals(USERSETTINGS2_EXPANDABLECOMPOSITE_STATE_OPEN)) {
		ec.setExpanded(true);
	} else if (mode.equals(USERSETTINGS2_EXPANDABLECOMPOSITE_STATE_CLOSED)) {
		ec.setExpanded(false);
	} else {
		String state =
			CoreHub.userCfg.get(USERSETTINGS2_EXPANDABLE_COMPOSITES_STATES + field,
				USERSETTINGS2_EXPANDABLECOMPOSITE_STATE_CLOSED);
		if (state.equals(USERSETTINGS2_EXPANDABLECOMPOSITE_STATE_CLOSED)) {
			ec.setExpanded(false);
		} else {
			ec.setExpanded(true);
		}
	}
}
 
Example #5
Source File: AbapGitStagingView.java    From ADT_Frontend with MIT License 6 votes vote down vote up
private void createUnstagedComposite(Composite parent) {
	this.unstagedSection = this.toolkit.createSection(parent, ExpandableComposite.SHORT_TITLE_BAR);
	this.unstagedSection.setText(Messages.AbapGitStaging_unstaged_changes_section_header + " (0)"); //$NON-NLS-1$
	this.unstagedSection.clientVerticalSpacing = 0;

	//unstaged section toolbar
	this.createUnstagedSectionToolbar();

	Composite unstagedComposite = this.toolkit.createComposite(this.unstagedSection);
	this.toolkit.paintBordersFor(unstagedComposite);
	GridLayoutFactory.fillDefaults().applyTo(unstagedComposite);
	this.unstagedSection.setClient(unstagedComposite);

	//create the treeviewer
	this.unstagedTreeViewer = this.createTreeViewer(unstagedComposite, true);
	this.unstagedTreeViewer.setInput(this.unstagedTreeViewerInput);
	addDragAndDropSupport(this.unstagedTreeViewer, true);

	//add context menu support to the tree viewer
	this.unstagedMenuFactory = new AbapGitStagingObjectMenuFactory(this.unstagedTreeViewer, true, this, this.stagingUtil);
}
 
Example #6
Source File: SankeyMiniViewAction.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private Composite createForm(Composite parent) {
	FormToolkit toolkit = new FormToolkit(Display.getCurrent());
	ScrolledForm form = toolkit.createScrolledForm(parent);
	Composite body = form.getBody();
	body.setLayout(new FillLayout());
	toolkit.paintBordersFor(body);
	SashForm sash = new SashForm(body, SWT.VERTICAL);
	toolkit.adapt(sash, true, true);
	Section section = toolkit.createSection(sash,
			ExpandableComposite.NO_TITLE | ExpandableComposite.EXPANDED);
	section.setText("");
	Composite composite = toolkit.createComposite(section, SWT.NONE);
	composite.setLayout(new GridLayout());
	section.setClient(composite);
	toolkit.paintBordersFor(composite);
	return composite;
}
 
Example #7
Source File: JavaEditorCodeMiningConfigurationBlock.java    From jdt-codemining with Eclipse Public License 1.0 6 votes vote down vote up
private void createJUnitSection(int nColumns, Composite parent) {
	final int defaultIndent = 0;
	String label = MyPreferencesMessages.JavaEditorCodeMiningConfigurationBlock_section_junit;
	Key twistieKey = OptionsConfigurationBlock.getLocalKey("JavaEditorCodeMiningPreferencePage_section_junit"); //$NON-NLS-1$
	PreferenceTreeNode<?> section = fFilteredPrefTree.addExpandableComposite(parent, label, nColumns, twistieKey,
			null, false);
	ExpandableComposite excomposite = getExpandableComposite(twistieKey);

	Composite inner = createInnerComposite(excomposite, nColumns, parent.getFont());

	// - Show JUnit status
	fFilteredPrefTree.addCheckBox(inner,
			MyPreferencesMessages.JavaEditorCodeMiningConfigurationBlock_showJUnitStatus_label,
			PREF_SHOW_JUNIT_STATUS, TRUE_FALSE, defaultIndent, section);
	// - Show JUnit run
	fFilteredPrefTree.addCheckBox(inner,
			MyPreferencesMessages.JavaEditorCodeMiningConfigurationBlock_showJUnitRun_label, PREF_SHOW_JUNIT_RUN,
			TRUE_FALSE, defaultIndent, section);
	// - Show JUnit debug
	fFilteredPrefTree.addCheckBox(inner,
			MyPreferencesMessages.JavaEditorCodeMiningConfigurationBlock_showJUnitDebug_label,
			PREF_SHOW_JUNIT_DEBUG, TRUE_FALSE, defaultIndent, section);
}
 
Example #8
Source File: CogniCryptPreferencePage.java    From CogniCrypt with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	final Composite container = new Composite(parent, SWT.FILL);
	container.setLayout(new GridLayout(1, true));
	notifyBasicPreferenceListeners(container);

	new Label(container, SWT.NONE);
	final ExpandableComposite collap = new ExpandableComposite(container, SWT.Collapse);
	collap.setText("Advanced Options");

	final Composite advancedOptions = new Composite(collap, SWT.None);
	collap.setClient(advancedOptions);
	advancedOptions.setLayout(new RowLayout(SWT.VERTICAL));
	notifyAdvancedPreferenceListeners(advancedOptions);

	collap.setExpanded(true);
	return container;
}
 
Example #9
Source File: RechnungsBlatt.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
private void setExpandedState(ExpandableComposite ec, String field){
	String mode = CoreHub.userCfg.get(USERSETTINGS2_EXPANDABLE_COMPOSITES,
		USERSETTINGS2_EXPANDABLECOMPOSITE_STATE_REMEMBER_STATE);
	if (mode.equals(USERSETTINGS2_EXPANDABLECOMPOSITE_STATE_OPEN)) {
		ec.setExpanded(true);
	} else if (mode.equals(USERSETTINGS2_EXPANDABLECOMPOSITE_STATE_CLOSED)) {
		ec.setExpanded(false);
	} else {
		String state = CoreHub.userCfg.get(USERSETTINGS2_EXPANDABLE_COMPOSITES_STATES + field,
			USERSETTINGS2_EXPANDABLECOMPOSITE_STATE_CLOSED);
		if (state.equals(USERSETTINGS2_EXPANDABLECOMPOSITE_STATE_CLOSED)) {
			ec.setExpanded(false);
		} else {
			ec.setExpanded(true);
		}
	}
}
 
Example #10
Source File: OptionsConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
protected ExpandableComposite createStyleSection(Composite parent, String label, int nColumns) {
	ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE
			| ExpandableComposite.CLIENT_INDENT);
	excomposite.setText(label);
	excomposite.setExpanded(false);
	excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
	excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1));
	excomposite.addExpansionListener(new ExpansionAdapter() {
		@Override
		public void expansionStateChanged(ExpansionEvent e) {
			expandedStateChanged((ExpandableComposite) e.getSource());
		}
	});
	expandedComposites.add(excomposite);
	makeScrollableCompositeAware(excomposite);
	return excomposite;
}
 
Example #11
Source File: OptionsConfigurationBlock.java    From typescript.java with MIT License 6 votes vote down vote up
public void selectOption(Key key) {
	Control control = findControl(key);
	if (control != null) {
		if (!fExpandedComposites.isEmpty()) {
			ExpandableComposite expandable = getParentExpandableComposite(control);
			if (expandable != null) {
				for (int i = 0; i < fExpandedComposites.size(); i++) {
					ExpandableComposite curr = (ExpandableComposite) fExpandedComposites.get(i);
					curr.setExpanded(curr == expandable);
				}
				expandedStateChanged(expandable);
			}
		}
		control.setFocus();
	}
}
 
Example #12
Source File: Patientenblatt2.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void setUnlocked(boolean unlocked){
	bLocked = !unlocked;
	ipp.setUnlocked(unlocked);
	inpZusatzAdresse.setUnlocked(unlocked);
	hHA.setEnabled(unlocked);
	// delZA.setEnabled(!bLock);
	removeZAAction.setEnabled(unlocked);
	removeAdditionalAddressAction.setEnabled(unlocked);
	additionalAddresses.setUnlocked(unlocked);
	dmd.setUnlocked(unlocked);
	if (unlocked) {
		hHA.setForeground(UiDesk.getColor(UiDesk.COL_BLUE));
	} else {
		hHA.setForeground(UiDesk.getColor(UiDesk.COL_GREY));
		
	}
	for (ExpandableComposite ex : ec) {
		ex.getClient().setEnabled(unlocked);
	}
	detailComposites.forEach(dc -> dc.setUnlocked(unlocked));
}
 
Example #13
Source File: OptionsConfigurationBlock.java    From typescript.java with MIT License 6 votes vote down vote up
protected ExpandableComposite createStyleSection(Composite parent, String label, int nColumns) {
	ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE,
			ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
	excomposite.setText(label);
	excomposite.setExpanded(false);
	excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
	excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1));
	excomposite.addExpansionListener(new ExpansionAdapter() {
		public void expansionStateChanged(ExpansionEvent e) {
			expandedStateChanged((ExpandableComposite) e.getSource());
		}
	});
	fExpandedComposites.add(excomposite);
	makeScrollableCompositeAware(excomposite);
	return excomposite;
}
 
Example #14
Source File: ErrorsWarningsPage.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
private Composite createProblemCategory(Composite parent, String label) {
  // Expandable panel for each category of problems
  ExpandableComposite expandPanel = new ExpandableComposite(parent, SWT.NONE,
      ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
  expandPanel.setText(label);
  expandPanel.setExpanded(false);
  expandPanel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
  expandPanel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
  expandPanel.addExpansionListener(new ExpansionAdapter() {
    @Override
    public void expansionStateChanged(ExpansionEvent e) {
      topPanel.layout(true, true);
      scrollPanel.setMinSize(topPanel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    }
  });

  // Create panel to store the actual problems
  Composite categoryPanel = new Composite(expandPanel, SWT.NONE);
  categoryPanel.setLayout(new GridLayout(2, false));
  expandPanel.setClient(categoryPanel);

  return categoryPanel;
}
 
Example #15
Source File: AppraiseDiffViewerPart.java    From git-appraise-eclipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates an individual diff viewer in the given composite.
 */
private void createDiffViewer(final FormToolkit toolkit, Composite composite,
    final TaskAttribute diffTaskAttribute) {

  int style = ExpandableComposite.TREE_NODE | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT
      | ExpandableComposite.COMPACT;
  ExpandableComposite diffComposite = toolkit.createExpandableComposite(composite, style);
  diffComposite.clientVerticalSpacing = 0;
  diffComposite.setLayout(new GridLayout());
  diffComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  diffComposite.setTitleBarForeground(toolkit.getColors().getColor(IFormColors.TITLE));
  diffComposite.setText(calculateDiffChangeHeader(diffTaskAttribute));

  final Composite diffViewerComposite = toolkit.createComposite(diffComposite);
  diffComposite.setClient(diffViewerComposite);
  diffViewerComposite.setLayout(
      new FillWidthLayout(EditorUtil.getLayoutAdvisor(getTaskEditorPage()), 15, 0, 0, 3));

  diffComposite.addExpansionListener(new ExpansionAdapter() {
    @Override
    public void expansionStateChanged(ExpansionEvent event) {
      expandCollapseDiff(toolkit, diffViewerComposite, diffTaskAttribute, event.getState());
    }
  });
  GridDataFactory.fillDefaults().grab(true, false).applyTo(diffComposite);
}
 
Example #16
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public void selectOption(Key key) {
	Control control= findControl(key);
	if (control != null) {
		if (!fExpandableComposites.isEmpty()) {
			ExpandableComposite expandable= getParentExpandableComposite(control);
			if (expandable != null) {
				for (int i= 0; i < fExpandableComposites.size(); i++) {
					ExpandableComposite curr= fExpandableComposites.get(i);
					curr.setExpanded(curr == expandable);
				}
				expandedStateChanged(expandable);
			}
		}
		control.setFocus();
	}
}
 
Example #17
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
protected ExpandableComposite createStyleSection(Composite parent, String label, int nColumns, Key key) {
	ExpandableComposite excomposite= new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
	excomposite.setText(label);
	if (key != null) {
		excomposite.setData(key);
	}
	excomposite.setExpanded(false);
	excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
	excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1));
	excomposite.addExpansionListener(new ExpansionAdapter() {
		@Override
		public void expansionStateChanged(ExpansionEvent e) {
			expandedStateChanged((ExpandableComposite) e.getSource());
		}
	});
	fExpandableComposites.add(excomposite);
	makeScrollableCompositeAware(excomposite);
	return excomposite;
}
 
Example #18
Source File: WidgetFactory.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public static ExpandableComposite createExpandableComposite(final FormToolkit t,
	final ScrolledForm f, String text){
	ExpandableComposite ret =
		t.createExpandableComposite(f.getBody(), ExpandableComposite.TWISTIE);
	ret.setText(text);
	ret.addExpansionListener(new ExpansionAdapter() {
		public void expansionStateChanged(ExpansionEvent e){
			f.reflow(true);
		}
	});
	return ret;
}
 
Example #19
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void restoreSectionExpansionStates(IDialogSettings settings) {
	for (int i= 0; i < fExpandableComposites.size(); i++) {
		ExpandableComposite excomposite= fExpandableComposites.get(i);
		if (settings == null) {
			excomposite.setExpanded(i == 0); // only expand the first node by default
		} else {
			excomposite.setExpanded(settings.getBoolean(SETTINGS_EXPANDED + String.valueOf(i)));
		}
	}
}
 
Example #20
Source File: ICEMasterDetailsPage.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <p>
 * This operation overrides the default/abstract implementation of
 * FormPage.createFormContents to create the contents of the
 * ICEMasterDetailsPage.
 * </p>
 * 
 * @param managedForm
 *            <p>
 *            The Form widget on which the ICEMasterDetailsPage exists.
 *            </p>
 */
@Override
protected void createFormContent(IManagedForm managedForm) {

	// Set the Form
	final ScrolledForm scrolledForm = managedForm.getForm();

	FormToolkit toolkit = managedForm.getToolkit();
	Section section = toolkit.createSection(scrolledForm.getBody(),
			Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);

	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	section.setLayoutData(gd);

	// Set the MasterDetailsComponent's "header component" that contains
	// global data if it exists.
	ICEDataComponentSectionPart headerSectionPart = new ICEDataComponentSectionPart(
			section, ICEFormEditor, managedForm);
	DataComponent header = masterDetailsComponent.getGlobalsComponent();
	if (header != null) {
		headerSectionPart.setDataComponent(header);
		headerSectionPart.renderSection();
	}

	// Get the Provider
	ICEDetailsPageProvider pageProvider = new ICEDetailsPageProvider(
			masterDetailsComponent, ICEFormEditor);

	// Create a scrolledPropertiesBlock with given providers.
	block = new ICEScrolledPropertiesBlock(masterDetailsComponent,
			ICEFormEditor, pageProvider);
	block.createContent(managedForm);

}
 
Example #21
Source File: MOOSEFormEditor.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Provides a Plant View page with a single {@link PlantApplication} for use
 * with RELAP-7.
 */
private void addPlantPage() {
	// Do not add more than one plant page.
	if (findPage(PLANT_PAGE_ID) == null) {

		// Add a page with a plant view.
		try {
			addPage(new ICEFormPage(this, PLANT_PAGE_ID, "Plant View") {
				@Override
				protected void createFormContent(IManagedForm managedForm) {

					// The plant view should consume the whole page.
					Section section;
					FormToolkit toolkit = managedForm.getToolkit();

					// Set up the overall layout (FillLayout).
					Composite body = managedForm.getForm().getBody();
					body.setLayout(new FillLayout());

					// Create a Section for the plant view.
					section = toolkit.createSection(body,
							ExpandableComposite.NO_TITLE
									| ExpandableComposite.EXPANDED);
					populatePlantViewSection(section, toolkit);
					// No layout data to set for FillLayouts.

					return;
				}
			});
		} catch (PartInitException e) {
			logger.error(getClass().getName() + " Exception!", e);
		}
	}

	return;
}
 
Example #22
Source File: AbstractConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates an expandable section within the parent created previously by
 * calling <code>createSectionComposite</code>. Controls can be added
 * directly to the returned composite, which has no layout initially.
 *
 * @param label the display name of the section
 * @return a composite within the expandable section
 */
public Composite createSection(String label) {
	Assert.isNotNull(fBody);
	final ExpandableComposite excomposite= new ExpandableComposite(fBody, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.COMPACT);
	if (fFirstChild == null)
		fFirstChild= excomposite;
	excomposite.setText(label);
	String last= null;
	if (fLastOpenKey != null && fDialogSettingsStore != null)
		last= fDialogSettingsStore.getString(fLastOpenKey);

	if (fFirstChild == excomposite && !__NONE.equals(last) || label.equals(last)) {
		excomposite.setExpanded(true);
		if (fFirstChild != excomposite)
			fFirstChild.setExpanded(false);
	} else {
		excomposite.setExpanded(false);
	}
	excomposite.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));

	updateSectionStyle(excomposite);
	manage(excomposite);

	Composite contents= new Composite(excomposite, SWT.NONE);
	excomposite.setClient(contents);

	return contents;
}
 
Example #23
Source File: AbstractConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void manage(ExpandableComposite section) {
	if (section == null)
		throw new NullPointerException();
	if (fSections.add(section))
		section.addExpansionListener(fListener);
	makeScrollableCompositeAware(section);
}
 
Example #24
Source File: AbstractConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void expansionStateChanged(ExpansionEvent e) {
	ExpandableComposite source= (ExpandableComposite) e.getSource();
	updateSectionStyle(source);
	if (fIsBeingManaged)
		return;
	if (e.getState()) {
		try {
			fIsBeingManaged= true;
			for (Iterator<ExpandableComposite> iter= fSections.iterator(); iter.hasNext();) {
				ExpandableComposite composite= iter.next();
				if (composite != source)
					composite.setExpanded(false);
			}
		} finally {
			fIsBeingManaged= false;
		}
		if (fLastOpenKey != null && fDialogSettingsStore != null)
			fDialogSettingsStore.setValue(fLastOpenKey, source.getText());
	} else {
		if (!fIsBeingManaged && fLastOpenKey != null && fDialogSettingsStore != null)
			fDialogSettingsStore.setValue(fLastOpenKey, __NONE);
	}
	ExpandableComposite exComp= getParentExpandableComposite(source);
	if (exComp != null)
		exComp.layout(true, true);
	ScrolledPageContent parentScrolledComposite= getParentScrolledComposite(source);
	if (parentScrolledComposite != null) {
		parentScrolledComposite.reflow(true);
	}
}
 
Example #25
Source File: ProblemSeveritiesConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private Composite createInnerComposite(ExpandableComposite excomposite, int nColumns, Font font) {
	Composite inner= new Composite(excomposite, SWT.NONE);
	inner.setFont(font);
	inner.setLayout(new GridLayout(nColumns, false));
	excomposite.setClient(inner);
	return inner;
}
 
Example #26
Source File: HTMLTidyValidatorPreferenceCompositeFactory.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected final void expandedStateChanged(ExpandableComposite expandable)
{
	ScrolledPageContent parentScrolledComposite = getParentScrolledComposite(expandable);
	if (parentScrolledComposite != null)
	{
		parentScrolledComposite.reflow(true);
	}
}
 
Example #27
Source File: HTMLTidyValidatorPreferenceCompositeFactory.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected ExpandableComposite getParentExpandableComposite(Control control)
{
	Control parent = control.getParent();
	while (!(parent instanceof ExpandableComposite) && parent != null)
	{
		parent = parent.getParent();
	}
	if (parent instanceof ExpandableComposite)
	{
		return (ExpandableComposite) parent;
	}
	return null;
}
 
Example #28
Source File: CSSFormatterWhiteSpacesPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createOptions(IFormatterControlManager manager, Composite parent)
{
	Group wrappingGroup = SWTFactory.createGroup(parent, Messages.CSSFormatterWhiteSpacesPage_spacingSettings, 1,
			1, GridData.FILL_HORIZONTAL);

	// Punctuation Group (we only have one group, so we expand it by default)
	ExpandableComposite expandibleComposite = SWTFactory.createExpandibleComposite(wrappingGroup,
			Messages.CSSFormatterWhiteSpacesPage_punctuationGroupLabel, 3, true);
	Composite punctuationGroup = SWTFactory
			.createComposite(expandibleComposite, 3, 20, 1, GridData.FILL_HORIZONTAL);
	expandibleComposite.setClient(punctuationGroup);

	SWTFactory.createCenteredLabel(punctuationGroup, StringUtil.EMPTY);
	SWTFactory.createCenteredLabel(punctuationGroup, Messages.CSSFormatterWhiteSpacesPage_before);
	SWTFactory.createCenteredLabel(punctuationGroup, Messages.CSSFormatterWhiteSpacesPage_after);

	// Commas
	SWTFactory.createLabel(punctuationGroup, Messages.CSSFormatterWhiteSpacesPage_commasLabel);
	manager.createSpinner(punctuationGroup, CSSFormatterConstants.SPACES_BEFORE_COMMAS);
	manager.createSpinner(punctuationGroup, CSSFormatterConstants.SPACES_AFTER_COMMAS);

	// Colons
	SWTFactory.createLabel(punctuationGroup, Messages.CSSFormatterWhiteSpacesPage_colonLabel);
	manager.createSpinner(punctuationGroup, CSSFormatterConstants.SPACES_BEFORE_COLON);
	manager.createSpinner(punctuationGroup, CSSFormatterConstants.SPACES_AFTER_COLON);

	// Parenthesis in selectors
	SWTFactory.createLabel(punctuationGroup, Messages.CSSFormatterWhiteSpacesPage_parenthesisLabel);
	manager.createSpinner(punctuationGroup, CSSFormatterConstants.SPACES_BEFORE_PARENTHESES);
	manager.createSpinner(punctuationGroup, CSSFormatterConstants.SPACES_AFTER_PARENTHESES);
}
 
Example #29
Source File: AppraiseDiffViewerPart.java    From git-appraise-eclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createControl(Composite parent, final FormToolkit toolkit) {
  final List<TaskAttribute> diffTaskAttributes = getDiffTaskAttributes();

  if (diffTaskAttributes == null || diffTaskAttributes.isEmpty()) {
    return;
  }
  int style = ExpandableComposite.TWISTIE | ExpandableComposite.SHORT_TITLE_BAR;
  final Section groupSection = toolkit.createSection(parent, style);
  groupSection.setText("Changes (" + diffTaskAttributes.size() + ')');
  groupSection.clientVerticalSpacing = 0;
  groupSection.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));

  if (groupSection.isExpanded()) {
    addDiffViewersToSection(toolkit, diffTaskAttributes, groupSection);
  } else {
    groupSection.addExpansionListener(new ExpansionAdapter() {
      @Override
      public void expansionStateChanged(ExpansionEvent e) {
        if (groupSection.getClient() == null) {
          try {
            getTaskEditorPage().setReflow(false);
            addDiffViewersToSection(toolkit, diffTaskAttributes, groupSection);
          } finally {
            getTaskEditorPage().setReflow(true);
          }
          getTaskEditorPage().reflow();
        }
      }
    });
  }
}
 
Example #30
Source File: ICESectionPage.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <p>
 * This operation creates ICETableComponentSectionParts for each
 * TableComponent in the list of TableComponents and figures out exactly how
 * they should be arranged and span across the page based on their
 * properties.
 * </p>
 *
 */
private void createTableComponentSections() {

	// Get the parent form and the ToolKit to create decorated Sections.
	final ScrolledForm scrolledForm = managedFormRef.getForm();
	final FormToolkit formToolkit = managedFormRef.getToolkit();

	// Each TableComponent will get is own Section that occupies a single
	// row in the parent GridLayout (that is, the Form's GridLayout). The
	// rows will grab all excess vertical and horizontal space available in
	// the Form.

	// Create the TableComponent Sections.
	Composite container = scrolledForm.getBody();
	for (int i = 0; i < tableComponents.size(); i++) {
		// Create a new Section for the current TableComponent.
		TableComponent tableComponent = tableComponents.get(i);
		Section section = formToolkit.createSection(container,
				ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
						| ExpandableComposite.TWISTIE
						| ExpandableComposite.EXPANDED);
		// Each Section should fill all available horizontal and vertical
		// space in the parent GridLayout, but it should only grab excess
		// horizontal space.
		section.setLayoutData(
				new GridData(SWT.FILL, SWT.FILL, true, false));

		// To populate the Section, use an ICETableComponentSectionPart.
		ICETableComponentSectionPart sectionPart;
		sectionPart = new ICETableComponentSectionPart(section, editor,
				managedFormRef);
		sectionPart.setTableComponent(tableComponent);
		sectionPart.renderSection();
		// Add the part to the ManagedForm's update lifecycle.
		managedFormRef.addPart(sectionPart);
	}

	return;
}