@Override public boolean performOk() { final boolean rebuild = rebuild(); final boolean reReconcile = needsReconcile(); Job buildJob = new ApplyChangesAndBuildJob(Messages.ValidationPreferencePage_RebuildJobTitle, rebuild, reReconcile); IPreferencePageContainer container = getContainer(); if (container instanceof IWorkbenchPreferenceContainer) { ((IWorkbenchPreferenceContainer) container).registerUpdateJob(buildJob); } else { buildJob.schedule(); } return true; }
/** * {@inheritDoc} */ public Control createControl(Composite parent, IPreferencePageContainer container) { Composite composite= new Composite(parent, SWT.NONE); GridData gridData= new GridData(SWT.FILL, SWT.FILL, true, true); composite.setLayoutData(gridData); GridLayout layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; composite.setLayout(layout); fEnableField= new SelectionButtonDialogField(SWT.CHECK); fEnableField.setLabelText(getPostSaveListenerName()); fEnableField.doFillIntoGrid(composite, 1); createConfigControl(composite, container); return composite; }
/** * This method has been copied from org.eclipse.xtext.builder.preferences.BuilderPreferencePage. */ private void scheduleCleanerJobIfNecessary(IPreferencePageContainer preferencePageContainer) { Map<String, ValueDifference<String>> changes = getPreferenceChanges(); for (String key : changes.keySet()) { if (key.matches("^" + CompilerProperties.OUTPUT_PREFERENCE_TAG + "\\.\\w+\\." + CompilerProperties.OUTPUT_PREFERENCE_TAG + "$")) { ValueDifference<String> difference = changes.get(key); scheduleCleanerJob(preferencePageContainer, difference.rightValue()); } } }
/** * This method has been copied from org.eclipse.xtext.builder.preferences.BuilderPreferencePage. */ private void scheduleCleanerJob(IPreferencePageContainer preferencePageContainer, String folderNameToClean) { DerivedResourceCleanerJob derivedResourceCleanerJob = cleanerProvider.get(); derivedResourceCleanerJob.setUser(true); derivedResourceCleanerJob.initialize(getProject(), folderNameToClean); if (preferencePageContainer != null) { IWorkbenchPreferenceContainer container = (IWorkbenchPreferenceContainer) getContainer(); container.registerUpdateJob(derivedResourceCleanerJob); } else { derivedResourceCleanerJob.schedule(); } }
/** * Builds a PreferenceLinkArea if the platform supports it. On platforms * that do not support a PreferenceLinkArea, you will be returned an empty * control which has no size and does nothing. * * @return A Control that can be used to link to the preference area, if * supported, or an empty control if the platform does not support * preference links */ public static Control createPreferenceLinkArea( final Composite parent, final int style, final String pageId, final String message, final IPreferencePageContainer container, final Object pageData) { try { final Class preferenceLinkClass = Class.forName("org.eclipse.ui.dialogs.PreferenceLinkArea"); //$NON-NLS-1$ final Class workbenchPrefContainerClass = Class.forName("org.eclipse.ui.preferences.IWorkbenchPreferenceContainer"); //$NON-NLS-1$ final Constructor preferenceLinkCtor = preferenceLinkClass.getConstructor(new Class[] { Composite.class, int.class, String.class, String.class, workbenchPrefContainerClass, Object.class }); final Object preferenceLinkArea = preferenceLinkCtor.newInstance(new Object[] { parent, new Integer(style), pageId, message, container, pageData }); final Method getControlMethod = preferenceLinkClass.getMethod("getControl", (Class[]) null); //$NON-NLS-1$ return (Control) getControlMethod.invoke(preferenceLinkArea, (Object[]) null); } catch (final Exception e) { return new EmptyControl(parent, style); } }
public Control createControl(Composite parent) { Composite composite= new Composite(parent, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); GridLayout gridLayout= new GridLayout(2, false); gridLayout.marginHeight= 0; gridLayout.marginWidth= 0; composite.setLayout(gridLayout); SaveParticipantRegistry registry= JavaPlugin.getDefault().getSaveParticipantRegistry(); SaveParticipantDescriptor[] descriptors= registry.getSaveParticipantDescriptors(); if (descriptors.length == 0) return composite; Arrays.sort(descriptors, new Comparator<SaveParticipantDescriptor>() { public int compare(SaveParticipantDescriptor d1, SaveParticipantDescriptor d2) { return Collator.getInstance().compare(d1.getPostSaveListener().getName(), d2.getPostSaveListener().getName()); } }); IPreferencePageContainer container= fPreferencePage.getContainer(); for (int i= 0; i < descriptors.length; i++) { final SaveParticipantDescriptor descriptor= descriptors[i]; ISaveParticipantPreferenceConfiguration configuration= descriptor.createPreferenceConfiguration(); configuration.createControl(composite, container); fConfigurations.add(configuration); } return composite; }
@Override protected Control createPreferenceContent(final Composite composite, final IPreferencePageContainer preferencePageContainer) { console.debug("BuilderPreferencePage createPreferenceContent "); return builderConfigurationBlock.createContents(composite); }
private void scheduleCleanerJobIfNecessary(final IPreferencePageContainer preferencePageContainer) { console.debug("BuilderPreferencePage scheduleCleanerJobIfNecessary"); Map<String, ValueDifference<String>> changes = builderConfigurationBlock.getPreferenceChanges(); for (String key : changes.keySet()) { if (key.matches("^" + EclipseOutputConfigurationProvider.OUTPUT_PREFERENCE_TAG + "\\.\\w+\\." + EclipseOutputConfigurationProvider.OUTPUT_DIRECTORY + "$")) { ValueDifference<String> difference = changes.get(key); scheduleCleanerJob(preferencePageContainer, difference.rightValue()); } } }
private void scheduleCleanerJob(final IPreferencePageContainer preferencePageContainer, final String folderNameToClean) { console.debug("BuilderPreferencePage scheduleCleanerJob"); DerivedResourceCleanerJob derivedResourceCleanerJob = cleanerProvider.get(); derivedResourceCleanerJob.setUser(true); derivedResourceCleanerJob.initialize(getProject(), folderNameToClean); if (preferencePageContainer != null) { IWorkbenchPreferenceContainer container = (IWorkbenchPreferenceContainer) getContainer(); container.registerUpdateJob(derivedResourceCleanerJob); } else { derivedResourceCleanerJob.schedule(); } }
public Control createPageControl( Composite parent ) { propertyPage.setContainer( (IPreferencePageContainer) getContainer( ) ); propertyPage.createControl( parent ); return propertyPage.getControl( ); }
public TFSGlobalProxiesControl( final Composite parent, final int style, final IPreferencePageContainer preferencePageContainer) { super(parent, style); final int verticalSectionSpacing = ControlSize.convertCharHeightToPixels(this, 1) * 2; final GridLayout layout = SWTUtil.gridLayout(this, 2); layout.verticalSpacing = verticalSectionSpacing; SWTUtil.createLabel(this, getDisplay().getSystemImage(SWT.ICON_INFORMATION)); final String messageFormat = Messages.getString("TFSGlobalProxiesControl.SummaryLabelTextFormat"); //$NON-NLS-1$ final String message = MessageFormat.format(messageFormat, ProductInformation.getCurrent().toString()); final Label label = SWTUtil.createLabel(this, SWT.WRAP, message); GridDataBuilder.newInstance().hGrab().hFill().wCHint(label, 80).applyTo(label); final boolean showHttpProxyControls = TFSCommonUIClientPlugin.getDefault().getProxyServiceTracker().getService() == null; if (showHttpProxyControls) { httpProxyControl = new HTTPProxyControl(this, SWT.NONE); AutomationIDHelper.setWidgetID(httpProxyControl, HTTP_PROXY_CONTROL); httpProxyControl.getGridLayout().marginHeight = 0; httpProxyControl.getGridLayout().marginWidth = 0; multiValidator.addValidatable(httpProxyControl); GridDataBuilder.newInstance().hGrab().hFill().hSpan(layout).applyTo(httpProxyControl); } else { httpProxyControl = null; } tfProxyControl = new TFSProxyControl(this, SWT.NONE); AutomationIDHelper.setWidgetID(tfProxyControl, TFS_PROXY_CONTROL); tfProxyControl.getGridLayout().marginHeight = 0; tfProxyControl.getGridLayout().marginWidth = 0; multiValidator.addValidatable(tfProxyControl); GridDataBuilder.newInstance().hGrab().hFill().hSpan(layout).applyTo(tfProxyControl); if (httpProxyControl != null) { ControlSize.align(new Alignable[] { httpProxyControl, tfProxyControl }); } if (!showHttpProxyControls) { final Control linkControl = PreferenceLinkAreaHelper.createPreferenceLinkArea( this, SWT.NONE, "org.eclipse.ui.net.NetPreferences", //$NON-NLS-1$ Messages.getString("TFSGlobalProxiesControl.ClickHereToConfigureHttp"), //$NON-NLS-1$ preferencePageContainer, null); GridDataBuilder.newInstance().hGrab().hFill().hSpan(layout).applyTo(linkControl); } }
@Override public IPreferencePageContainer getContainer() { return super.getContainer(); }
@Override public void setContainer(IPreferencePageContainer container) { super.setContainer(container); }
@Override protected Control createPreferenceContent(Composite composite, IPreferencePageContainer preferencePageContainer) { return validatorConfigurationBlock.createContents(composite); }
protected abstract Control createPreferenceContent(Composite composite, IPreferencePageContainer preferencePageContainer);
@Override public void setContainer(IPreferencePageContainer preferencePageContainer) { // do nothing }
@Override public void setContainer(IPreferencePageContainer container) { super.setContainer(container); updateStatus(); }
public ProjectUpdateOperation(ProjectController projectController, IPreferencePageContainer container) { super(projectController); }
/** * Creates a control that will be displayed on the Java > Editor > Save Participants * preference page to edit the details of a save participant. * * @param parent the parent composite to which to add the preferences control * @param container the container in which this preference configuration is displayed * @return the control that was added to the <code>parent</code> */ Control createControl(Composite parent, IPreferencePageContainer container);
/** * Subclasses can add specific controls * * @param parent the parent to use to add the control to * @param container the container showing the preferences */ protected void createConfigControl(Composite parent, IPreferencePageContainer container) { //Default has no specific controls }