Search in sources :

Example 1 with ConfigurationEditorComponent

use of org.eclipse.egit.ui.internal.preferences.ConfigurationEditorComponent in project egit by eclipse.

the class RepositoryPropertyPage method createContents.

@Override
protected Control createContents(Composite parent) {
    Composite displayArea = new Composite(parent, SWT.NONE);
    GridLayoutFactory.fillDefaults().applyTo(displayArea);
    GridDataFactory.fillDefaults().applyTo(displayArea);
    final Repository repo = AdapterUtils.adapt(getElement(), Repository.class);
    if (repo == null)
        return displayArea;
    StoredConfig config = repo.getConfig();
    if (config instanceof FileBasedConfig) {
        File configFile = ((FileBasedConfig) config).getFile();
        config = new FileBasedConfig(configFile, repo.getFS());
        config.addChangeListener(new ConfigChangedListener() {

            @Override
            public void onConfigChanged(ConfigChangedEvent event) {
                repo.fireEvent(new ConfigChangedEvent());
            }
        });
    }
    editor = new ConfigurationEditorComponent(displayArea, config, true) {

        @Override
        protected void setErrorMessage(String message) {
            RepositoryPropertyPage.this.setErrorMessage(message);
        }
    };
    editor.createContents();
    return displayArea;
}
Also used : StoredConfig(org.eclipse.jgit.lib.StoredConfig) ConfigChangedListener(org.eclipse.jgit.events.ConfigChangedListener) Repository(org.eclipse.jgit.lib.Repository) Composite(org.eclipse.swt.widgets.Composite) ConfigurationEditorComponent(org.eclipse.egit.ui.internal.preferences.ConfigurationEditorComponent) FileBasedConfig(org.eclipse.jgit.storage.file.FileBasedConfig) File(java.io.File) ConfigChangedEvent(org.eclipse.jgit.events.ConfigChangedEvent)

Aggregations

File (java.io.File)1 ConfigurationEditorComponent (org.eclipse.egit.ui.internal.preferences.ConfigurationEditorComponent)1 ConfigChangedEvent (org.eclipse.jgit.events.ConfigChangedEvent)1 ConfigChangedListener (org.eclipse.jgit.events.ConfigChangedListener)1 Repository (org.eclipse.jgit.lib.Repository)1 StoredConfig (org.eclipse.jgit.lib.StoredConfig)1 FileBasedConfig (org.eclipse.jgit.storage.file.FileBasedConfig)1 Composite (org.eclipse.swt.widgets.Composite)1