org.eclipse.jface.preference.DirectoryFieldEditor Java Examples

The following examples show how to use org.eclipse.jface.preference.DirectoryFieldEditor. 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: MoosePreferencePage.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void createFieldEditors() {
	addField(new DirectoryFieldEditor("PATH", "&Directory preference:",
			getFieldEditorParent()));
	addField(new BooleanFieldEditor("BOOLEAN_VALUE",
			"&An example of a boolean preference", getFieldEditorParent()));

	addField(new RadioGroupFieldEditor("CHOICE",
			"An example of a multiple-choice preference", 1,
			new String[][] { { "&Choice 1", "choice1" },
					{ "C&hoice 2", "choice2" } }, getFieldEditorParent()));
	addField(new StringFieldEditor("MySTRING1", "A &text preference:",
			getFieldEditorParent()));
	addField(new StringFieldEditor("MySTRING2", "A &text preference:",
			getFieldEditorParent()));
}
 
Example #2
Source File: GitRepositoriesPreferencePage.java    From MergeProcessor with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void createFieldEditors() {
	/*
	 * The following field may be required if GIT repositories should not be created
	 * automatically, as they are provided by a central shared directory, where many
	 * developers use these repositories for GIT merge.
	 */
	final Path gitRepositories = Paths
			.get(Activator.getDefault().getPreferenceStore().getString(GIT_REPOSITORIES_FOLDER));
	if (!gitRepositories.toFile().exists()) {
		try {
			Files.createDirectories(gitRepositories);
		} catch (IOException e) {
			Logger.getLogger(GitRepositoriesPreferencePage.class.getName()).log(Level.SEVERE, e.getMessage(), e);
		}
	}
	final DirectoryFieldEditor repositoryFolderEditor = new DirectoryFieldEditor(GIT_REPOSITORIES_FOLDER,
			Messages.GitRepositoriesPreferencePage_title, getFieldEditorParent()) {

		/**
		 * {@inheritDoc}
		 */
		@Override
		protected void fireValueChanged(String property, Object oldValue, Object newValue) {
			super.fireValueChanged(property, oldValue, newValue);
			if (FieldEditor.VALUE.equals(property) && !Objects.equals(oldValue, newValue)) {
				tableViewer.setInput(getGitRepositoryPaths(newValue.toString()));
			}
		}

	};
	addField(repositoryFolderEditor);
}
 
Example #3
Source File: CloudSdkPreferenceArea.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent event) {
  if (event.getProperty() == DirectoryFieldEditor.IS_VALID) {
    fireValueChanged(IS_VALID, event.getOldValue(), event.getNewValue());
  } else if (event.getProperty() == DirectoryFieldEditor.VALUE) {
    fireValueChanged(VALUE, event.getOldValue(), event.getNewValue());
  }
  updateSelectedVersion();
}
 
Example #4
Source File: NewExtensionWizardPage.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Creates {@link DirectoryFieldEditor} element for page container
 * 
 * @param container
 *            container for which element is set
 * @param label
 *            label for the GUI element
 * @return {@link DirectoryFieldEditor}
 */
private DirectoryFieldEditor prepareDirectoryFieldEditorGUI(Composite container, String label) {
	DirectoryFieldEditor field = new DirectoryFieldEditor("fileSelect", label, container);
	field.getTextControl(container).addModifyListener(e -> {
			setPageComplete(true);
			getWizard().getContainer().updateButtons();
			setErrorMessage(null);
	});
	return field;
}
 
Example #5
Source File: ExtClassPathPreferencePage.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
@Override
protected Control createContents(final Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);

    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 3;

    composite.setLayout(gridLayout);

    extDir = new DirectoryFieldEditor("", ResourceString.getResourceString("label.ext.classpath"), composite);

    CompositeFactory.filler(composite, 2);
    downloadButton = createButton(composite, "Download");

    downloadButton.addSelectionListener(new SelectionAdapter() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void widgetSelected(final SelectionEvent e) {
            download();
        }
    });

    extDir.setFocus();

    setData();

    return composite;
}
 
Example #6
Source File: AnalysisPreferencesPage.java    From depan with Apache License 2.0 5 votes vote down vote up
@Override
protected void createFieldEditors() {
  Composite parent = getFieldEditorParent();

  FileFieldEditor executable = new FileFieldEditor(
      AnalysisPreferenceIds.MVN_ANALYSIS_EXECUTABLE,
      "Maven Executable", 
      true, parent);
  executable.setEmptyStringAllowed(false);

  BooleanFieldEditor systemjava = new BooleanFieldEditor(
      AnalysisPreferenceIds.MVN_ANALYSIS_SYSTEMJAVA,
      "Use System JAVA_HOME",
      BooleanFieldEditor.SEPARATE_LABEL, parent);

  final DirectoryFieldEditor javahome = new DirectoryFieldEditor(
      AnalysisPreferenceIds.MVN_ANALYSIS_JAVAHOME,
      "JAVA_HOME", parent);

  StringFieldEditor effectivepom = new StringFieldEditor(
      AnalysisPreferenceIds.MVN_ANALYSIS_EFFECTIVEPOM,
      "Maven Effective POM command", parent);
  effectivepom.setEmptyStringAllowed(false);

  addField(executable);
  addField(systemjava);
  addField(javahome);
  addField(effectivepom);
}
 
Example #7
Source File: AnalysisPreferencesPage.java    From depan with Apache License 2.0 5 votes vote down vote up
@Override
protected void createFieldEditors() {
  Composite parent = getFieldEditorParent();

  FileFieldEditor executable = new FileFieldEditor(
      AnalysisPreferenceIds.MVN_ANALYSIS_EXECUTABLE,
      "Maven Executable", 
      true, parent);
  executable.setEmptyStringAllowed(false);

  BooleanFieldEditor systemjava = new BooleanFieldEditor(
      AnalysisPreferenceIds.MVN_ANALYSIS_SYSTEMJAVA,
      "Use System JAVA_HOME",
      BooleanFieldEditor.SEPARATE_LABEL, parent);

  final DirectoryFieldEditor javahome = new DirectoryFieldEditor(
      AnalysisPreferenceIds.MVN_ANALYSIS_JAVAHOME,
      "JAVA_HOME", parent);

  StringFieldEditor effectivepom = new StringFieldEditor(
      AnalysisPreferenceIds.MVN_ANALYSIS_EFFECTIVEPOM,
      "Maven Effective POM command", parent);
  effectivepom.setEmptyStringAllowed(false);

  addField(executable);
  addField(systemjava);
  addField(javahome);
  addField(effectivepom);
}
 
Example #8
Source File: MapReducePreferencePage.java    From RDFS with Apache License 2.0 5 votes vote down vote up
/**
 * Creates the field editors. Field editors are abstractions of the common
 * GUI blocks needed to manipulate various types of preferences. Each field
 * editor knows how to save and restore itself.
 */
@Override
public void createFieldEditors() {
  addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH,
      "&Hadoop installation directory:", getFieldEditorParent()));

}
 
Example #9
Source File: JyScriptingPreferencesPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createFieldEditors() {
    Composite p = getFieldEditorParent();
    addField(new BooleanFieldEditor(SHOW_SCRIPTING_OUTPUT,
            "Show the output given from the scripting to some console?", p));
    addField(new BooleanFieldEditor(LOG_SCRIPTING_ERRORS, "Show errors from scripting in the Error Log?", p));
    DirectoryFieldEditor fileField = new DirectoryFieldEditor(ADDITIONAL_SCRIPTING_LOCATION,
            "Location of additional jython scripts:", p);
    addField(fileField);
}
 
Example #10
Source File: MapReducePreferencePage.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
/**
 * Creates the field editors. Field editors are abstractions of the common
 * GUI blocks needed to manipulate various types of preferences. Each field
 * editor knows how to save and restore itself.
 */
@Override
public void createFieldEditors() {
  addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH,
      "&Hadoop installation directory:", getFieldEditorParent()));

}
 
Example #11
Source File: CppStylePropertyPage.java    From CppStyle with MIT License 4 votes vote down vote up
private void constructPage(Composite parent) {
	Composite composite = createComposite(parent, 2);

	projectSpecificButton = new Button(composite, SWT.CHECK);
	projectSpecificButton.setText(PROJECTS_PECIFIC_TEXT);
	projectSpecificButton.addSelectionListener(this);

	Button perfSetting = new Button(composite, SWT.PUSH);
	perfSetting.setText("Configure Workspace Settings...");
	perfSetting.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			configureWorkspaceSettings();
		}
	});

	createSepeerater(parent);

	composite = createComposite(parent, 1);

	enableCpplintOnSaveButton = new Button(composite, SWT.CHECK);
	enableCpplintOnSaveButton
			.setText(CppStyleConstants.ENABLE_CPPLINT_TEXT);
	enableCpplintOnSaveButton.addSelectionListener(this);

	enableClangFormatOnSaveButton = new Button(composite, SWT.CHECK);
	enableClangFormatOnSaveButton
			.setText(CppStyleConstants.ENABLE_CLANGFORMAT_TEXT);
	enableClangFormatOnSaveButton.addSelectionListener(this);

	createSepeerater(parent);

	composite = createComposite(parent, 1);

	Label laber = new Label(composite, SWT.NONE);
	laber.setText(CppStyleConstants.PROJECT_ROOT_TEXT);

	composite = createComposite(composite, 1);

	projectPath = getCurrentProject();

	projectRoot = new DirectoryFieldEditor(CppStyleConstants.CPPLINT_PATH,
			"Root:", composite) {
		String errorMsg = super.getErrorMessage();

		@Override
		protected boolean doCheckState() {
			this.setErrorMessage(errorMsg);

			String fileName = getTextControl().getText();
			fileName = fileName.trim();
			if (fileName.length() == 0 && isEmptyStringAllowed()) {
				return true;
			}

			File file = new File(fileName);
			if (false == file.isDirectory()) {
				return false;
			}

			this.setErrorMessage("Directory or its up level directories should contain .git, .hg, or .svn.");

			String path = CpplintCheckSettings.getVersionControlRoot(file);

			if (path == null) {
				return false;
			}

			if (!path.startsWith(projectPath)) {
				this.setErrorMessage("Should be a subdirectory of project's root.");
				return false;
			}

			return true;
		}

	};

	projectRoot.setPage(this);
	projectRoot.setFilterPath(new File(projectPath));
	projectRoot.setPropertyChangeListener(this);
	projectRootText = projectRoot.getTextControl(composite);
	projectRootText.addModifyListener(this);
	projectRoot.setEnabled(true, composite);

	if (!getPropertyValue(CppStyleConstants.PROJECTS_PECIFIC_PROPERTY)) {
		projectSpecificButton.setSelection(false);
		enableCpplintOnSaveButton.setEnabled(false);
		enableClangFormatOnSaveButton.setEnabled(false);
	} else {
		projectSpecificButton.setSelection(true);
		enableCpplintOnSaveButton.setEnabled(true);
		enableCpplintOnSaveButton
				.setSelection(getPropertyValue(CppStyleConstants.ENABLE_CPPLINT_PROPERTY));
		enableClangFormatOnSaveButton.setEnabled(true);
		enableClangFormatOnSaveButton
				.setSelection(getPropertyValue(CppStyleConstants.ENABLE_CLANGFORMAT_PROPERTY));
	}

	String root = getPropertyValueString(CppStyleConstants.CPPLINT_PROJECT_ROOT);
	projectRoot.setStringValue(root);
}
 
Example #12
Source File: KbdMacroPreferencePage.java    From e4macs with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
 */
@Override
protected void createFieldEditors() {
	Composite parent = getFieldEditorParent();
	addField(
		new LabelFieldEditor(
			EmacsPlusActivator.getString("EmacsPlusPref_KbdMacroDir"),  											 //$NON-NLS-1$
			parent));
	
	parent = getFieldEditorParent();
	directoryEditor = new DirectoryFieldEditor(
			EmacsPlusPreferenceConstants.P_KBD_MACRO_DIRECTORY,
			EmacsPlusUtils.EMPTY_STR,
			parent);
	addField(directoryEditor);
	addSpace();
	
	parent = getFieldEditorParent();
	radioEditor = new RadioGroupFieldEditor(EmacsPlusPreferenceConstants.P_KBD_MACRO_AUTO_LOAD,
			EmacsPlusActivator.getString("EmacsPlusPref_KbdMacroLoad"), 1, new String[][] { 						 //$NON-NLS-1 
					{ EmacsPlusActivator.getString("EmacsPlusPref_KbdMacroAll"), LoadState.ALL.toString() },		 //$NON-NLS-1 
					{ EmacsPlusActivator.getString("EmacsPlusPref_KbdMacroNone"), LoadState.NONE.toString() },  	 //$NON-NLS-1 
					{ EmacsPlusActivator.getString("EmacsPlusPref_KbdMacroSelected"), LoadState.SOME.toString() } }, //$NON-NLS-1 
					parent, true);
	addField(radioEditor);
	
	parent = getFieldEditorParent();
	loadParent = parent;
	loadButton = new ButtonFieldEditor(loadParent, EmacsPlusActivator.getString("EmacsPlusPref_KbdMacroLoadButton"), //$NON-NLS-1$
			new SelectionAdapter() {
               public void widgetSelected(SelectionEvent evt) {
               	// save the current state
               	KbdMacroPreferencePage.this.performApply();
               	// load the kbd macros
               	KbdMacroSupport.getInstance().autoLoadMacros();
               }
           });
	addField(loadButton);
	
	parent = getFieldEditorParent();
	someListParent = parent;
	someListEditor = new KbdMacroListEditor(
			EmacsPlusPreferenceConstants.P_KBD_MACRO_NAME_LOAD,
			EmacsPlusActivator.getString("EmacsPlusPref_KbdMacroLoadName"), 										 //$NON-NLS-1$
			EmacsPlusActivator.getString("EmacsPlusPref_KbdMacroAddTitle"), 										 //$NON-NLS-1$
			someListParent, directoryEditor);
	addField(someListEditor);
	
	// enable/disable the list editor based on the auto load state preference
	String currentValue = (getPreferenceStore().getString(EmacsPlusPreferenceConstants.P_KBD_MACRO_AUTO_LOAD)); 
	setSomeListEnabled(currentValue);
	setLoadButtonEnabled(currentValue);
}
 
Example #13
Source File: JythonInterpreterPreferencesPage.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void createFieldEditors() {
    super.createFieldEditors();
    addField(new DirectoryFieldEditor(IInterpreterManager.JYTHON_CACHE_DIR, "-Dpython.cachedir",
            getFieldEditorParent()));
}
 
Example #14
Source File: DirectoryFieldEditorExt.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void setValidateStrategy(int value) {
	super.setValidateStrategy(DirectoryFieldEditor.VALIDATE_ON_KEY_STROKE);
}
 
Example #15
Source File: KbdMacroListEditor.java    From e4macs with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * @param name
 * @param labelText
 * @param chooserLabel
 * @param parent
 */
KbdMacroListEditor(String name, String labelText, String chooserLabel, Composite parent, DirectoryFieldEditor directoryEditor) {
       super(name,labelText,parent);
       this.chooserLabel = chooserLabel;
	this.directoryEditor = directoryEditor;
   }