org.eclipse.jface.preference.FileFieldEditor Java Examples

The following examples show how to use org.eclipse.jface.preference.FileFieldEditor. 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: EclipseWorkspaceStartPeferencePage.java    From MergeProcessor with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void createFieldEditors() {
	addField(new FileFieldEditor(ECLIPSE_APPLICATION_PATH,
			Messages.EclipseWorkspaceStartPeferencePage_applicationPath, getFieldEditorParent()));
	final StringFieldEditor parameters = new StringFieldEditor(ECLIPSE_APPLICATION_PARAMETERS,
			Messages.EclipseWorkspaceStartPeferencePage_parameters, 44, getFieldEditorParent());
	addField(parameters);
}
 
Example #2
Source File: SolidityCompilerPreferencePage.java    From solidity-ide with Eclipse Public License 1.0 5 votes vote down vote up
protected void createCompilerSettings(Composite parent) {
	Composite composite = createGroupComposite(parent, "Solc compiler");
	compilerPathFieldEditor = new FileFieldEditor(COMPILER_PATH, "Path to solc", composite);
	addField(compilerPathFieldEditor);
	addField(new BooleanFieldEditor(COMPILER_ENABLED, "Enable solidity compiler", composite));
	addField(new BooleanFieldEditor(COMPILER_OUTPUT_BIN, "Enable solidity bin output", composite));
	addField(new BooleanFieldEditor(COMPILER_OUTPUT_ASM, "Enable solidity asm output", composite));
	addField(new BooleanFieldEditor(COMPILER_OUTPUT_ABI, "Enable solidity abi output", composite));
	addField(new StringFieldEditor(COMPILER_OUTPUT_PATH, "Compiler output path", composite));
}
 
Example #3
Source File: AttachSourcesPage.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void createControl(Composite parent) 
{
	container = new Composite(parent, SWT.NONE);
	container.setLayout(new GridLayout(2, false));

	this.sourceFileField = new FileFieldEditor("fileSelect", "[y] Source Archive:", container);
	sourceFileField.setFileExtensions( new String[]{"*.zip"} );
	// Set the starting path to the downloads folder or home dir of the current user.
	sourceFileField.setFilterPath( new File(System.getProperty("user.home")) );

	sourceFileField.getTextControl( container ).addModifyListener( new ModifyListener() 
	{
		@Override
		public void modifyText( ModifyEvent e )
		{
			// no validation just yet, as this even gets triggered:
			// (1) copy and paste: once
			// (2) manual typing: once per character entered
			// (3) per change button - selection: once
			// so because of #2: need to do validation when submitting the wizard (in it's performFinish())
			// TODO: there must be a better way, but the FocusListener does not see when the selection is done via the browse button
			
			setErrorMessage(null);
			setPageComplete(true);
			// let the wizard update it's buttons
			getWizard().getContainer().updateButtons();
		}
	} );
			
	// required to avoid an error in the system
	setControl(container);
	// if this is an optional page, we set this page to complete right away.
	setPageComplete(isOptional);
}
 
Example #4
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 #5
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 #6
Source File: CppStylePerfPage.java    From CppStyle with MIT License 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.
 */
public void createFieldEditors() {
	clangFormatPath = new FileFieldEditor(CppStyleConstants.CLANG_FORMAT_PATH, "Clang-format path:",
			getFieldEditorParent());

	addField(clangFormatPath);

	cpplintPath = new FileFieldEditor(CppStyleConstants.CPPLINT_PATH, "Cpplint path:", getFieldEditorParent());

	addField(cpplintPath);

	enableCpplintOnSave = new BooleanFieldEditor(CppStyleConstants.ENABLE_CPPLINT_ON_SAVE,
			CppStyleConstants.ENABLE_CPPLINT_TEXT, getFieldEditorParent());

	if (!checkPathExist(CppStyle.getCpplintPath())) {
		enableCpplintOnSave.setEnabled(false, getFieldEditorParent());
	}

	addField(enableCpplintOnSave);

	enableClangFormatOnSave = new BooleanFieldEditor(CppStyleConstants.ENABLE_CLANGFORMAT_ON_SAVE,
			CppStyleConstants.ENABLE_CLANGFORMAT_TEXT, getFieldEditorParent());

	if (!checkPathExist(ClangFormatFormatter.getClangFormatPath())) {
		enableClangFormatOnSave.setEnabled(false, getFieldEditorParent());
	}

	addField(enableClangFormatOnSave);
}
 
Example #7
Source File: ClientTrustStorePreferencePage.java    From developer-studio with Apache License 2.0 4 votes vote down vote up
@Override
protected void createFieldEditors() {
	addField(new FileFieldEditor(TRUST_STORE_LOCATION, "&Trust Store Location:", getFieldEditorParent()));
	
	String[][] types = { { "JKS", "JKS" }, { "JCEKS", "JCEKS" }, { "PKCS12", "PKCS12" } };
	ComboFieldEditor editor = new ComboFieldEditor(TRUST_STORE_TYPE, "Trust &Store Type", types,
			getFieldEditorParent());

	addField(editor);
	stringField1 = new StringFieldEditor(TRUST_STORE_PASSWORD, "Trust Store &Password", getFieldEditorParent());
	addField(stringField1);
	BooleanFieldEditor booleanFieldEditor = new BooleanFieldEditor(SHOW_PLAIN_PASSWORD,
			"S&how Password in Plain Text", getFieldEditorParent());
	addField(booleanFieldEditor);
	if (!preferenceStore.getBoolean(SHOW_PLAIN_PASSWORD)) {
		stringField1.getTextControl(getFieldEditorParent()).setEchoChar('*');
	}
	preferenceStore.addPropertyChangeListener(new IPropertyChangeListener() {

		@Override
		public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent arg0) {

			if (SHOW_PLAIN_PASSWORD.equals(arg0.getProperty())) {
				boolean boolean1 = preferenceStore.getBoolean(SHOW_PLAIN_PASSWORD);
				if (boolean1) {
					stringField1.getTextControl(getFieldEditorParent()).setEchoChar('\0');
				} else {
					stringField1.getTextControl(getFieldEditorParent()).setEchoChar('*');
				}
			}

			if (TRUST_STORE_LOCATION.equals(arg0.getProperty())) {
				String string = preferenceStore.getString(TRUST_STORE_LOCATION);
				if (!string.equals("") && !string.endsWith(".jks")) {
					MessageDialog.openError(Display.getCurrent().getActiveShell(), "Developer Studio Error Dialog",
					                        "You cannot set non JKS trust stores from Developer Studio");
				}
			}

		}
	});

}