@Override protected void buttonPressed(int buttonId) { if (buttonId == APPLAY_BUTTON_ID) { applyPressed(); setTitle(Messages.format(FormatterMessages.ModifyDialog_dialog_title, fProfile.getName())); } else if (buttonId == SAVE_BUTTON_ID) { saveButtonPressed(); } else { super.buttonPressed(buttonId); } }
protected void createButtonsForButtonBar(Composite parent) { fApplyButton= createButton(parent, APPLAY_BUTTON_ID, FormatterMessages.ModifyDialog_apply_button, false); fApplyButton.setEnabled(false); GridLayout layout= (GridLayout) parent.getLayout(); layout.numColumns++; layout.makeColumnsEqualWidth= false; Label label= new Label(parent, SWT.NONE); GridData data= new GridData(); data.widthHint= layout.horizontalSpacing; label.setLayoutData(data); super.createButtonsForButtonBar(parent); }
@Override protected Control createDialogArea(Composite parent) { final Composite composite= (Composite) super.createDialogArea(parent); createNameArea(composite); createMainArea(composite); doValidate(); PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, getHelpContextId()); fFocusManager.restoreFocus(); return composite; }
private void doValidate() { IStatus status= validateProfileName(); if (status.matches(IStatus.ERROR)) { updateStatus(status); return; } String name= fProfileNameField.getText().trim(); if (!name.equals(fProfile.getName()) && fProfileManager.containsName(name)) { updateStatus(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, FormatterMessages.ModifyDialog_Duplicate_Status)); return; } if (fProfile.isBuiltInProfile() || fProfile.isSharedProfile()) { updateStatus(new Status(IStatus.INFO, JavaUI.ID_PLUGIN, FormatterMessages.ModifyDialog_NewCreated_Status)); return; } updateStatus(StatusInfo.OK_STATUS); }
fSaveButton= createButton(nameComposite, SAVE_BUTTON_ID, FormatterMessages.ModifyDialog_Export_Button, false); fTabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); addPages(fWorkingValues); applyDialogFont(composite); doValidate();
public ModifyDialog(Shell parentShell, Profile profile, ProfileManager profileManager, ProfileStore profileStore, boolean newProfile, String dialogPreferencesKey, String lastSavePathKey) { super(parentShell); fProfileStore= profileStore; fLastSaveLoadPathKey= lastSavePathKey; fKeyPreferredWidth= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_PREFERRED_WIDTH; fKeyPreferredHight= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_PREFERRED_HEIGHT; fKeyPreferredX= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_PREFERRED_X; fKeyPreferredY= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_PREFERRED_Y; fKeyLastFocus= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_LAST_FOCUS; fProfileManager= profileManager; fNewProfile= newProfile; setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX ); fProfile= profile; setTitle(Messages.format(FormatterMessages.ModifyDialog_dialog_title, profile.getName())); fWorkingValues= new HashMap(fProfile.getSettings()); setStatusLineAboveButtons(false); fTabPages= new ArrayList(); fDialogSettings= JavaPlugin.getDefault().getDialogSettings(); }
protected void updateButtonsEnableState(IStatus status) { super.updateButtonsEnableState(status); if (fApplyButton != null && !fApplyButton.isDisposed()) { fApplyButton.setEnabled(hasChanges() && !status.matches(IStatus.ERROR)); } if (fSaveButton != null && !fSaveButton.isDisposed()) { fSaveButton.setEnabled(!validateProfileName().matches(IStatus.ERROR)); } }
@Override public void valuesModified() { doValidate(); }
public ModifyDialog(Shell parentShell, Profile profile, ProfileManager profileManager, ProfileStore profileStore, boolean newProfile, String dialogPreferencesKey, String lastSavePathKey) { super(parentShell); fProfileStore= profileStore; fLastSaveLoadPathKey= lastSavePathKey; fKeyPreferredWidth= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_PREFERRED_WIDTH; fKeyPreferredHight= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_PREFERRED_HEIGHT; fKeyPreferredX= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_PREFERRED_X; fKeyPreferredY= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_PREFERRED_Y; fKeyLastFocus= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_LAST_FOCUS; fProfileManager= profileManager; fNewProfile= newProfile; fProfile= profile; setTitle(Messages.format(FormatterMessages.ModifyDialog_dialog_title, profile.getName())); fWorkingValues= new HashMap<>(fProfile.getSettings()); setStatusLineAboveButtons(false); fTabPages= new ArrayList<>(); fDialogSettings= JavaPlugin.getDefault().getDialogSettings(); }
public boolean close() { final Rectangle shell= getShell().getBounds(); fDialogSettings.put(fKeyPreferredWidth, shell.width); fDialogSettings.put(fKeyPreferredHight, shell.height); fDialogSettings.put(fKeyPreferredX, shell.x); fDialogSettings.put(fKeyPreferredY, shell.y); return super.close(); }
protected Control createDialogArea(Composite parent) { Composite control= (Composite)super.createDialogArea(parent); fCountLabel= new Label(control, SWT.NONE); fCountLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); fCountLabel.setFont(parent.getFont()); updateCountLabel(); return control; }
@Override protected void okPressed() { applyPressed(); super.okPressed(); }
@Override public void updateStatus(IStatus status) { int count= 0; for (int i= 0; i < fPages.length; i++) { count+= fPages[i].getSelectedCleanUpCount(); } if (count == 0) { super.updateStatus(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, CleanUpMessages.CleanUpModifyDialog_SelectOne_Error)); } else { super.updateStatus(status); } }
fSaveButton= createButton(nameComposite, SAVE_BUTTON_ID, FormatterMessages.ModifyDialog_Export_Button, false); fTabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); addPages(fWorkingValues); applyDialogFont(composite); doValidate(); PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, getHelpContextId());
@Override protected void updateButtonsEnableState(IStatus status) { super.updateButtonsEnableState(status); if (fApplyButton != null && !fApplyButton.isDisposed()) { fApplyButton.setEnabled(hasChanges() && !status.matches(IStatus.ERROR)); } if (fSaveButton != null && !fSaveButton.isDisposed()) { fSaveButton.setEnabled(!validateProfileName().matches(IStatus.ERROR)); } }
private void doValidate() { String name= fProfileNameField.getText().trim(); if (name.equals(fProfile.getName()) && fProfile.hasEqualSettings(fWorkingValues, fWorkingValues.keySet())) { updateStatus(StatusInfo.OK_STATUS); return; } IStatus status= validateProfileName(); if (status.matches(IStatus.ERROR)) { updateStatus(status); return; } if (!name.equals(fProfile.getName()) && fProfileManager.containsName(name)) { updateStatus(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, FormatterMessages.ModifyDialog_Duplicate_Status)); return; } if (fProfile.isBuiltInProfile() || fProfile.isSharedProfile()) { updateStatus(new Status(IStatus.INFO, JavaUI.ID_PLUGIN, FormatterMessages.ModifyDialog_NewCreated_Status)); return; } updateStatus(StatusInfo.OK_STATUS); }
public void valuesModified() { doValidate(); }
public ModifyDialog(Shell parentShell, Profile profile, ProfileManager profileManager, ProfileStore profileStore, boolean newProfile, String dialogPreferencesKey, String lastSavePathKey) { super(parentShell); fProfileStore= profileStore; fLastSaveLoadPathKey= lastSavePathKey; fKeyPreferredWidth= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_PREFERRED_WIDTH; fKeyPreferredHight= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_PREFERRED_HEIGHT; fKeyPreferredX= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_PREFERRED_X; fKeyPreferredY= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_PREFERRED_Y; fKeySashFormLeftWidth= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_SASH_FORM_LEFT_WIDTH; fKeySashFormRightWidth= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_SASH_FORM_RIGHT_WIDTH; fKeyPreferenceTreeExpansion= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_PREFERENCE_TREE_EXPANSION; fKeyPreferenceScrollPosition= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_PREFERENCE_SCROLL_POSITION; fKeyLastFocusIndex= JavaUI.ID_PLUGIN + dialogPreferencesKey + DS_KEY_LAST_FOCUS_INDEX; fProfileManager= profileManager; fNewProfile= newProfile; fProfile= profile; setTitle(Messages.format(FormatterMessages.ModifyDialog_dialog_title, profile.getName())); fWorkingValues= new HashMap<>(fProfile.getSettings()); setStatusLineAboveButtons(false); fDialogSettings= JavaPlugin.getDefault().getDialogSettings(); fImages= new Images(parentShell); }
@Override public boolean close() { final Rectangle shell= getShell().getBounds(); fDialogSettings.put(fKeyPreferredWidth, shell.width); fDialogSettings.put(fKeyPreferredHight, shell.height); fDialogSettings.put(fKeyPreferredX, shell.x); fDialogSettings.put(fKeyPreferredY, shell.y); return super.close(); }
@Override protected Control createDialogArea(Composite parent) { Composite control= (Composite)super.createDialogArea(parent); fCountLabel= new Label(control, SWT.NONE); fCountLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); fCountLabel.setFont(parent.getFont()); updateCountLabel(); return control; }