org.eclipse.jdt.internal.ui.preferences.formatter.ProfileManager Java Examples

The following examples show how to use org.eclipse.jdt.internal.ui.preferences.formatter.ProfileManager. 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: FormatterConfigurationBlock.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void configurePreview(Composite composite, int numColumns, ProfileManager profileManager) {
	createLabel(composite, Messages.FormatterConfigurationBlock_XtendCodePreview, numColumns);
	XtendFormatterPreview xtendPreview = previewFactory.createNewPreview(composite,
			PreviewCode.defaultPreviewText());
	final GridData gd = new GridData(GridData.FILL_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL);
	gd.horizontalSpan = numColumns;
	gd.verticalSpan = 7;
	gd.widthHint = 0;
	gd.heightHint = 0;

	xtendPreview.getEditorViewer().getControl().setLayoutData(gd);
	profileManager.addObserver(xtendPreview.getObserver());
	xtendPreview.doUpdate(profileManager.getSelected().getSettings());
}
 
Example #2
Source File: XtendFormatterPreview.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void update(Observable o, Object arg) {
	final ProfileManager manager = (ProfileManager) o;
	final int value = ((Integer) arg).intValue();
	switch (value) {
		case ProfileManager.PROFILE_CREATED_EVENT:
		case ProfileManager.PROFILE_DELETED_EVENT:
		case ProfileManager.SELECTION_CHANGED_EVENT:
		case ProfileManager.SETTINGS_CHANGED_EVENT: {
			doUpdate(manager.getSelected().getSettings());
		}
	}
}
 
Example #3
Source File: FormatterModifyDialog.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
public FormatterModifyDialog create(Shell parentShell, Profile profile, ProfileManager profileManager, ProfileStore profileStore,
		boolean newProfile, String dialogPreferencesKey, String lastSavePathKey) {
	FormatterModifyDialog modifyDialog = new FormatterModifyDialog(parentShell, profile, profileManager, profileStore, newProfile,
			dialogPreferencesKey, lastSavePathKey);
	injector.injectMembers(modifyDialog);
	return modifyDialog;
}
 
Example #4
Source File: FormatterModifyDialog.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
public FormatterModifyDialog(Shell parentShell, Profile profile, ProfileManager profileManager, ProfileStore profileStore,
		boolean newProfile, String dialogPreferencesKey, String lastSavePathKey) {
	super(parentShell, profile, profileManager, profileStore, newProfile, dialogPreferencesKey, lastSavePathKey);
	this.fProfile = profile;
	this.fKeyLastFocus = JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_LAST_FOCUS;
	this.fDialogSettings = JavaPlugin.getDefault().getDialogSettings();
}
 
Example #5
Source File: CleanUpConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
    * {@inheritDoc}
    */
   @Override
protected void configurePreview(Composite composite, int numColumns, final ProfileManager profileManager) {
   	Map<String, String> settings= profileManager.getSelected().getSettings();
	final Map<String, String> sharedSettings= new Hashtable<String, String>();
	fill(settings, sharedSettings);

	final ICleanUp[] cleanUps= JavaPlugin.getDefault().getCleanUpRegistry().createCleanUps();
	CleanUpOptions options= new MapCleanUpOptions(sharedSettings);
	for (int i= 0; i < cleanUps.length; i++) {
		cleanUps[i].setOptions(options);
	}

	createLabel(composite, CleanUpMessages.CleanUpConfigurationBlock_SelectedCleanUps_label, numColumns);

	final BulletListBlock cleanUpListBlock= new BulletListBlock(composite, SWT.NONE);
	GridData gridData= new GridData(SWT.FILL, SWT.FILL, true, true);
	gridData.horizontalSpan= numColumns;
	cleanUpListBlock.setLayoutData(gridData);
	cleanUpListBlock.setText(getSelectedCleanUpsInfo(cleanUps));

	profileManager.addObserver(new Observer() {

		public void update(Observable o, Object arg) {
			final int value= ((Integer)arg).intValue();
			switch (value) {
			case ProfileManager.PROFILE_CREATED_EVENT:
			case ProfileManager.PROFILE_DELETED_EVENT:
			case ProfileManager.SELECTION_CHANGED_EVENT:
			case ProfileManager.SETTINGS_CHANGED_EVENT:
				fill(profileManager.getSelected().getSettings(), sharedSettings);
				cleanUpListBlock.setText(getSelectedCleanUpsInfo(cleanUps));
			}
           }

	});
   }
 
Example #6
Source File: FormatterConfigurationBlock.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected ModifyDialog createModifyDialog(Shell shell, ProfileManager.Profile profile,
		ProfileManager profileManager, ProfileStore profileStore, boolean newProfile) {
	return formatterModifyDialogFactory.create(shell, profile, profileManager, profileStore, newProfile, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
}
 
Example #7
Source File: CleanUpConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected ProfileManager createProfileManager(List<Profile> profiles, IScopeContext context, PreferencesAccess access, IProfileVersioner profileVersioner) {
	profiles.addAll(CleanUpPreferenceUtil.getBuiltInProfiles());
    fProfileManager= new CleanUpProfileManager(profiles, context, access, profileVersioner);
	return fProfileManager;
   }
 
Example #8
Source File: CleanUpConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected ModifyDialog createModifyDialog(Shell shell, Profile profile, ProfileManager profileManager, ProfileStore profileStore, boolean newProfile) {
       return new CleanUpModifyDialog(shell, profile, profileManager, profileStore, newProfile, CLEANUP_PAGE_SETTINGS_KEY, DIALOGSTORE_LASTSAVELOADPATH);
   }
 
Example #9
Source File: CleanUpModifyDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public CleanUpModifyDialog(Shell parentShell, Profile profile, ProfileManager profileManager, ProfileStore profileStore, boolean newProfile, String dialogPreferencesKey, String lastSavePathKey) {
 super(parentShell, profile, profileManager, profileStore, newProfile, dialogPreferencesKey, lastSavePathKey);
}