org.eclipse.jdt.internal.ui.dialogs.StatusInfo Java Examples

The following examples show how to use org.eclipse.jdt.internal.ui.dialogs.StatusInfo. 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: AbstractSuperTypeSelectionDialog.java    From sarl with Apache License 2.0 6 votes vote down vote up
/** Adds selected interfaces to the list.
 */
private void fillWizardPageWithSelectedTypes() {
	final StructuredSelection selection = getSelectedItems();
	if (selection == null) {
		return;
	}
	for (final Iterator<?> iter = selection.iterator(); iter.hasNext();) {
		final Object obj = iter.next();
		if (obj instanceof TypeNameMatch) {
			accessedHistoryItem(obj);
			final TypeNameMatch type = (TypeNameMatch) obj;
			final String qualifiedName = Utilities.getNameWithTypeParameters(type.getType());
			final String message;

			if (addTypeToWizardPage(this.typeWizardPage, qualifiedName)) {
				message = MessageFormat.format(Messages.AbstractSuperTypeSelectionDialog_2,
						TextProcessor.process(qualifiedName, JAVA_ELEMENT_DELIMITERS));
			} else {
				message = MessageFormat.format(Messages.AbstractSuperTypeSelectionDialog_3,
						TextProcessor.process(qualifiedName, JAVA_ELEMENT_DELIMITERS));
			}
			updateStatus(new StatusInfo(IStatus.INFO, message));
		}
	}
}
 
Example #2
Source File: SpellingConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Validates that the specified number is positive.
 *
 * @param number the number to validate
 * @return The status of the validation
 */
protected static IStatus validatePositiveNumber(final String number) {
	final StatusInfo status= new StatusInfo();
	if (number.length() == 0) {
		status.setError(PreferencesMessages.SpellingPreferencePage_empty_threshold);
	} else {
		try {
			final int value= Integer.parseInt(number);
			if (value < 0) {
				status.setError(Messages.format(PreferencesMessages.SpellingPreferencePage_invalid_threshold, number));
			}
		} catch (NumberFormatException exception) {
			status.setError(Messages.format(PreferencesMessages.SpellingPreferencePage_invalid_threshold, number));
		}
	}
	return status;
}
 
Example #3
Source File: AddDelegateMethodsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public IStatus validate(Object[] selection) {
	int selectedCount= 0;
	int duplicateCount= 0;
	if (selection != null && selection.length > 0) {

		HashSet<String> signatures= new HashSet<String>(selection.length);
		for (int index= 0; index < selection.length; index++) {
			if (selection[index] instanceof DelegateEntry) {
				DelegateEntry delegateEntry= (DelegateEntry) selection[index];
				if (!signatures.add(getSignature(delegateEntry.delegateMethod)))
					duplicateCount++;
				selectedCount++;
			}
		}
	}
	if (duplicateCount > 0) {
		return new StatusInfo(IStatus.ERROR, duplicateCount == 1
				? ActionMessages.AddDelegateMethodsAction_duplicate_methods_singular
				: Messages.format(ActionMessages.AddDelegateMethodsAction_duplicate_methods_plural, String.valueOf(duplicateCount)));
	}
	return new StatusInfo(IStatus.INFO, Messages.format(ActionMessages.AddDelegateMethodsAction_selectioninfo_more, new Object[] { String.valueOf(selectedCount), String.valueOf(fEntries) }));
}
 
Example #4
Source File: CleanUpSelectionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@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, getEmptySelectionMessage()));
	} else {
		if (status == null) {
			super.updateStatus(StatusInfo.OK_STATUS);
		} else {
			super.updateStatus(status);
		}
	}
}
 
Example #5
Source File: VariableCreationDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private StatusInfo nameUpdated() {
	StatusInfo status= new StatusInfo();
	String name= fNameField.getText();
	if (name.length() == 0) {
		status.setError(NewWizardMessages.VariableCreationDialog_error_entername);
		return status;
	}
	if (name.trim().length() != name.length()) {
		status.setError(NewWizardMessages.VariableCreationDialog_error_whitespace);
	} else if (!Path.ROOT.isValidSegment(name)) {
		status.setError(NewWizardMessages.VariableCreationDialog_error_invalidname);
	} else if (nameConflict(name)) {
		status.setError(NewWizardMessages.VariableCreationDialog_error_nameexists);
	}
	return status;
}
 
Example #6
Source File: JARFileSelectionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public IStatus validate(Object[] selection) {
	int nSelected= selection.length;
	if (nSelected == 0 || (nSelected > 1 && !fMultiSelect)) {
		return new StatusInfo(IStatus.ERROR, "");  //$NON-NLS-1$
	}
	for (int i= 0; i < selection.length; i++) {
		Object curr= selection[i];
		if (curr instanceof File) {
			File file= (File) curr;
			if (!fAcceptFolders && !file.isFile()) {
				return new StatusInfo(IStatus.ERROR, "");  //$NON-NLS-1$
			}
		}
	}
	return new StatusInfo();
}
 
Example #7
Source File: BuildSettingWizardPage.java    From sarl with Apache License 2.0 6 votes vote down vote up
/** Update the status of this page according to the given exception.
 *
 * @param event the exception.
 */
private void updateStatus(Throwable event) {
	Throwable cause = event;
	while (cause != null
			&& (!(cause instanceof CoreException))
			&& cause.getCause() != null
			&& cause.getCause() != cause) {
		cause = cause.getCause();
	}
	if (cause instanceof CoreException) {
		updateStatus(((CoreException) cause).getStatus());
	} else {
		final String message;
		if (cause != null) {
			message = cause.getLocalizedMessage();
		} else {
			message = event.getLocalizedMessage();
		}
		final IStatus status = new StatusInfo(IStatus.ERROR, message);
		updateStatus(status);
	}
}
 
Example #8
Source File: NewPackageWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new <code>NewPackageWizardPage</code>
 */
public NewPackageWizardPage() {
	super(PAGE_NAME);

	setTitle(NewWizardMessages.NewPackageWizardPage_title);
	setDescription(NewWizardMessages.NewPackageWizardPage_description);

	fCreatedPackageFragment= null;

	PackageFieldAdapter adapter= new PackageFieldAdapter();

	fPackageDialogField= new StringDialogField();
	fPackageDialogField.setDialogFieldListener(adapter);
	fPackageDialogField.setLabelText(NewWizardMessages.NewPackageWizardPage_package_label);

	fCreatePackageInfoJavaDialogField= new SelectionButtonDialogField(SWT.CHECK);
	fCreatePackageInfoJavaDialogField.setDialogFieldListener(adapter);
	fCreatePackageInfoJavaDialogField.setLabelText(NewWizardMessages.NewPackageWizardPage_package_CreatePackageInfoJava);

	fPackageStatus= new StatusInfo();
}
 
Example #9
Source File: ClasspathContainerDefaultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void validatePath() {
	StatusInfo status= new StatusInfo();
	String str= fEntryField.getText();
	if (str.length() == 0) {
		status.setError(NewWizardMessages.ClasspathContainerDefaultPage_path_error_enterpath);
	} else if (!Path.ROOT.isValidPath(str)) {
		status.setError(NewWizardMessages.ClasspathContainerDefaultPage_path_error_invalidpath);
	} else {
		IPath path= new Path(str);
		if (path.segmentCount() == 0) {
			status.setError(NewWizardMessages.ClasspathContainerDefaultPage_path_error_needssegment);
		} else if (fUsedPaths.contains(path)) {
			status.setError(NewWizardMessages.ClasspathContainerDefaultPage_path_error_alreadyexists);
		}
	}
	updateStatus(status);
}
 
Example #10
Source File: UserLibraryPreferencePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private IStatus updateShownLibraries(IStatus status) {
	if (!status.isOK()) {
		fExportImportList.removeAllElements();
		fExportImportList.setEnabled(false);
		fLastFile= null;
	} else {
		File file= new File(fLocationField.getText());
		if (!file.equals(fLastFile)) {
			fLastFile= file;
			try {
				List<CPUserLibraryElement> elements= loadLibraries(file);
				fExportImportList.setElements(elements);
				fExportImportList.checkAll(true);
				fExportImportList.setEnabled(true);
				if (elements.isEmpty()) {
					return new StatusInfo(IStatus.ERROR, PreferencesMessages.UserLibraryPreferencePage_LoadSaveDialog_error_empty);
				}
			} catch (IOException e) {
				fExportImportList.removeAllElements();
				fExportImportList.setEnabled(false);
				return new StatusInfo(IStatus.ERROR, PreferencesMessages.UserLibraryPreferencePage_LoadSaveDialog_error_invalidfile);
			}
		}
	}
	return status;
}
 
Example #11
Source File: NameConventionConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private IStatus validateIdentifiers(String[] values, boolean prefix) {
	for (int i= 0; i < values.length; i++) {
		String val= values[i];
		if (val.length() == 0) {
			if (prefix) {
				return new StatusInfo(IStatus.ERROR, PreferencesMessages.NameConventionConfigurationBlock_error_emptyprefix);
			} else {
				return new StatusInfo(IStatus.ERROR, PreferencesMessages.NameConventionConfigurationBlock_error_emptysuffix);
			}
		}
		String name= prefix ? val + "x" : "x" + val; //$NON-NLS-2$ //$NON-NLS-1$
		IStatus status= JavaConventions.validateIdentifier(name, JavaCore.VERSION_1_3, JavaCore.VERSION_1_3);
		if (status.matches(IStatus.ERROR)) {
			if (prefix) {
				return new StatusInfo(IStatus.ERROR, Messages.format(PreferencesMessages.NameConventionConfigurationBlock_error_invalidprefix, val));
			} else {
				return new StatusInfo(IStatus.ERROR, Messages.format(PreferencesMessages.NameConventionConfigurationBlock_error_invalidsuffix, val));
			}
		}
	}
	return new StatusInfo();
}
 
Example #12
Source File: NewXtxtUMLFileWizardPage.java    From txtUML with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected IStatus typeNameChanged() {
	StatusInfo status = (StatusInfo) super.typeNameChanged();
	String message = status.getMessage();

	if (message != null && message.equals(NewWizardMessages.NewTypeWizardPage_error_EnterTypeName)) {
		status.setError("Filename is empty.");
	}

	if (getPackageFragment() != null && getTypeName() != null) {
		IFolder folder = (IFolder) getPackageFragment().getResource();
		IFile file = folder.getFile(getTypeName() + getSelectedExtension());
		if (file.exists()) {
			status.setError("File already exists.");
		}
	}

	return status;
}
 
Example #13
Source File: NewTxtUMLFileElementWizardPage.java    From txtUML with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected IStatus typeNameChanged() {
	StatusInfo status = (StatusInfo) super.typeNameChanged();
	String message = status.getMessage();

	if (message != null) {
		if (message.startsWith(Messages.format(NewWizardMessages.NewTypeWizardPage_warning_TypeNameDiscouraged, ""))
				|| message.equals(NewWizardMessages.NewTypeWizardPage_error_TypeNameExists)) {
			status.setOK();
		} else if (message
				.startsWith(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidTypeName, ""))
				|| message.equals(NewWizardMessages.NewTypeWizardPage_error_QualifiedName)) {
			status.setError(message.replace("Type name", "Name").replace("Java type name", "name")
					.replace("type name", "name"));
			// errors about *type* names would be confusing here
		}
	}

	return status;
}
 
Example #14
Source File: NewHostPageWizardPage.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void setVisible(boolean visible) {
  super.setVisible(visible);
  pageVisible = visible;

  // Wizards are not allowed to start up with an error message
  if (visible) {
    setFocus();

    if (pageStatus.matches(IStatus.ERROR)) {
      StatusInfo status = new StatusInfo();
      status.setError("");
      pageStatus = status;
    }
  }
}
 
Example #15
Source File: NewUiBinderWizardPage.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected IStatus typeNameChanged() {
  IStatus ownerClassNameStatus = super.typeNameChanged();
  if (ownerClassNameStatus.getSeverity() == IStatus.ERROR) {
    return ownerClassNameStatus;
  }

  StatusInfo uiXmlNameStatus = new StatusInfo();
  IPath uiXmlFilePath = getUiXmlFilePath();
  if (uiXmlFilePath != null) {
    // Make sure there's not already a ui.xml file with the same name
    if (ResourcesPlugin.getWorkspace().getRoot().exists(uiXmlFilePath)) {
      uiXmlNameStatus.setError(MessageFormat.format("{0} already exists.",
          uiXmlFilePath.lastSegment()));
    }
  } else {
    // Don't need to worry about this case since the ui.xml path should only
    // be null if the package fragment is invalid, in which case that error
    // will supersede ours.
  }

  return StatusUtil.getMostSevere(new IStatus[] {
      ownerClassNameStatus, uiXmlNameStatus});
}
 
Example #16
Source File: UserLibraryPreferencePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private IStatus validateSettings() {
	String name= fNameField.getText();
	if (name.length() == 0) {
		return new StatusInfo(IStatus.ERROR, PreferencesMessages.UserLibraryPreferencePage_LibraryNameDialog_name_error_entername);
	}
	for (int i= 0; i < fExistingLibraries.size(); i++) {
		CPUserLibraryElement curr= fExistingLibraries.get(i);
		if (curr != fElementToEdit && name.equals(curr.getName())) {
			return new StatusInfo(IStatus.ERROR, Messages.format(PreferencesMessages.UserLibraryPreferencePage_LibraryNameDialog_name_error_exists, name));
		}
	}
	IStatus status= ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE);
	if (status.matches(IStatus.ERROR)) {
		return new StatusInfo(IStatus.ERROR, "Name contains invalid characters."); //$NON-NLS-1$
	}
	return StatusInfo.OK_STATUS;
}
 
Example #17
Source File: ModifyDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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);
  }
 
Example #18
Source File: NewEntryPointWizardPage.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
private IStatus moduleChanged() {
  StatusInfo status = new StatusInfo();
  module = null;

  moduleField.enableButton(getPackageFragmentRoot() != null
      && getPackageFragmentRoot().exists()
      && JavaProjectUtilities.isJavaProjectNonNullAndExists(getJavaProject())
      && GWTNature.isGWTProject(getJavaProject().getProject()));

  IStatus fieldStatus = moduleField.getStatus();
  if (!fieldStatus.isOK()) {
    status.setError(fieldStatus.getMessage());
    return status;
  }

  // TODO: verify that package is in client source path of module

  module = moduleField.getModule();
  return status;
}
 
Example #19
Source File: NewTypeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected IStatus containerChanged() {
	IStatus status= super.containerChanged();
    IPackageFragmentRoot root= getPackageFragmentRoot();
	if ((fTypeKind == ANNOTATION_TYPE || fTypeKind == ENUM_TYPE) && !status.matches(IStatus.ERROR)) {
    	if (root != null && !JavaModelUtil.is50OrHigher(root.getJavaProject())) {
    		// error as createType will fail otherwise (bug 96928)
			return new StatusInfo(IStatus.ERROR, Messages.format(NewWizardMessages.NewTypeWizardPage_warning_NotJDKCompliant, BasicElementLabels.getJavaElementName(root.getJavaProject().getElementName())));
    	}
    	if (fTypeKind == ENUM_TYPE) {
	    	try {
	    	    // if findType(...) == null then Enum is unavailable
	    	    if (findType(root.getJavaProject(), "java.lang.Enum") == null) //$NON-NLS-1$
	    	        return new StatusInfo(IStatus.WARNING, NewWizardMessages.NewTypeWizardPage_warning_EnumClassNotFound);
	    	} catch (JavaModelException e) {
	    	    JavaPlugin.log(e);
	    	}
    	}
    }

	fCurrPackageCompletionProcessor.setPackageFragmentRoot(root);
	if (root != null) {
		fEnclosingTypeCompletionProcessor.setPackageFragment(root.getPackageFragment("")); //$NON-NLS-1$
	}
	return status;
}
 
Example #20
Source File: SuperInterfaceSelectionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void addSelectedInterfaces() {
	StructuredSelection selection= getSelectedItems();
	if (selection == null)
		return;
	for (Iterator<?> iter= selection.iterator(); iter.hasNext();) {
		Object obj= iter.next();
		if (obj instanceof TypeNameMatch) {
			accessedHistoryItem(obj);
			TypeNameMatch type= (TypeNameMatch) obj;
			String qualifiedName= getNameWithTypeParameters(type.getType());
			String message;

			if (fTypeWizardPage.addSuperInterface(qualifiedName)) {
				message= Messages.format(NewWizardMessages.SuperInterfaceSelectionDialog_interfaceadded_info, BasicElementLabels.getJavaElementName(qualifiedName));
			} else {
				message= Messages.format(NewWizardMessages.SuperInterfaceSelectionDialog_interfacealreadyadded_info, BasicElementLabels.getJavaElementName(qualifiedName));
			}
			updateStatus(new StatusInfo(IStatus.INFO, message));
		}
	}
}
 
Example #21
Source File: CodeAssistConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Validates that the specified number is positive.
 *
 * @param number
 *                   The number to validate
 * @return The status of the validation
 */
protected static IStatus validatePositiveNumber(final String number) {

	final StatusInfo status= new StatusInfo();
	if (number.length() == 0) {
		status.setError(PreferencesMessages.SpellingPreferencePage_empty_threshold);
	} else {
		try {
			final int value= Integer.parseInt(number);
			if (value < 0) {
				status.setError(Messages.format(PreferencesMessages.SpellingPreferencePage_invalid_threshold, number));
			}
		} catch (NumberFormatException exception) {
			status.setError(Messages.format(PreferencesMessages.SpellingPreferencePage_invalid_threshold, number));
		}
	}
	return status;
}
 
Example #22
Source File: JavadocProblemsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void validateSettings(Key changedKey, String oldValue, String newValue) {
	if (!areSettingsEnabled()) {
		return;
	}

	if (changedKey != null) {
		if (PREF_PB_INVALID_JAVADOC.equals(changedKey) ||
				PREF_PB_MISSING_JAVADOC_TAGS.equals(changedKey) ||
				PREF_PB_MISSING_JAVADOC_COMMENTS.equals(changedKey) ||
				PREF_JAVADOC_SUPPORT.equals(changedKey) ||
				PREF_PB_INVALID_JAVADOC_TAGS.equals(changedKey)) {
			updateEnableStates();
		} else {
			return;
		}
	} else {
		updateEnableStates();
	}
	fContext.statusChanged(new StatusInfo());
}
 
Example #23
Source File: AbstractNewXtendElementWizardPage.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected IStatus typeNameChanged() {
	IPackageFragment packageFragment = getPackageFragment();
	if (packageFragment != null) {
		IResource resource = packageFragment.getResource();
		if (resource instanceof IFolder) {
			IFolder folder = (IFolder) resource;
			if (folder.getFile(getTypeName() + ".xtend").exists()) { //$NON-NLS-1$
				String packageName = ""; //$NON-NLS-1$
				if (!packageFragment.isDefaultPackage()) {
					packageName = packageFragment.getElementName() + "."; //$NON-NLS-1$
				}
				return new StatusInfo(IStatus.ERROR, Messages.TYPE_EXISTS_0 + packageName + getTypeName()
						+ Messages.TYPE_EXISTS_1);
			}
		}
	}
	return super.typeNameChanged();
}
 
Example #24
Source File: JavadocConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private IStatus updateURLStatus() {
	StatusInfo status= new StatusInfo();
	fURLResult= null;
	try {
		String jdocLocation= fURLField.getText();
		if (jdocLocation.length() == 0) {
			return status;
		}
		URL url= new URL(jdocLocation);
		if ("file".equals(url.getProtocol())) { //$NON-NLS-1$
			if (url.getFile() == null) {
				status.setError(PreferencesMessages.JavadocConfigurationBlock_error_notafolder);
				return status;
			}
		}
		fURLResult= url;
	} catch (MalformedURLException e) {
		status.setError(PreferencesMessages.JavadocConfigurationBlock_MalformedURL_error);
		return status;
	}

	return status;
}
 
Example #25
Source File: AppearancePreferencePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private IStatus getValidationStatus() {
	if (fAbbreviatePackageNames.isSelected()
			&& JavaElementLabelComposer.parseAbbreviationPattern(fAbbreviatePackageNamePattern.getText()) == null) {
		return new StatusInfo(IStatus.ERROR, PreferencesMessages.AppearancePreferencePage_packageNameAbbreviationPattern_error_isInvalid);
	}

	if (fCompressPackageNames.isSelected() && fPackageNamePattern.getText().equals("")) //$NON-NLS-1$
		return new StatusInfo(IStatus.ERROR, PreferencesMessages.AppearancePreferencePage_packageNameCompressionPattern_error_isEmpty);

	return new StatusInfo();
}
 
Example #26
Source File: ProblemSeveritiesConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private NullAnnotationsConfigurationDialog() {
	super(ProblemSeveritiesConfigurationBlock.this.getShell());
	
	setTitle(PreferencesMessages.NullAnnotationsConfigurationDialog_title);
	
	fNullableStatus= new StatusInfo();
	fNonNullStatus= new StatusInfo();
	fNonNullByDefaultStatus= new StatusInfo();
	
	StringButtonAdapter adapter= new StringButtonAdapter();

	fNullableAnnotationDialogField= new StringButtonDialogField(adapter);
	fNullableAnnotationDialogField.setLabelText(PreferencesMessages.NullAnnotationsConfigurationDialog_nullable_annotation_label);
	fNullableAnnotationDialogField.setButtonLabel(PreferencesMessages.NullAnnotationsConfigurationDialog_browse1);
	fNullableAnnotationDialogField.setDialogFieldListener(adapter);
	fNullableAnnotationDialogField.setText(getValue(PREF_NULLABLE_ANNOTATION_NAME));
	
	fNonNullAnnotationDialogField= new StringButtonDialogField(adapter);
	fNonNullAnnotationDialogField.setLabelText(PreferencesMessages.NullAnnotationsConfigurationDialog_nonnull_annotation_label);
	fNonNullAnnotationDialogField.setButtonLabel(PreferencesMessages.NullAnnotationsConfigurationDialog_browse2);
	fNonNullAnnotationDialogField.setDialogFieldListener(adapter);
	fNonNullAnnotationDialogField.setText(getValue(PREF_NONNULL_ANNOTATION_NAME));
	
	fNonNullByDefaultAnnotationDialogField= new StringButtonDialogField(adapter);
	fNonNullByDefaultAnnotationDialogField.setLabelText(PreferencesMessages.NullAnnotationsConfigurationDialog_nonnullbydefault_annotation_label);
	fNonNullByDefaultAnnotationDialogField.setButtonLabel(PreferencesMessages.NullAnnotationsConfigurationDialog_browse3);
	fNonNullByDefaultAnnotationDialogField.setDialogFieldListener(adapter);
	fNonNullByDefaultAnnotationDialogField.setText(getValue(PREF_NONNULL_BY_DEFAULT_ANNOTATION_NAME));
}
 
Example #27
Source File: TodoTaskConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public TodoTaskConfigurationBlock(IStatusChangeListener context, IProject project, IWorkbenchPreferenceContainer container) {
	super(context, project, getKeys(), container);

	TaskTagAdapter adapter=  new TaskTagAdapter();
	String[] buttons= new String[] {
		PreferencesMessages.TodoTaskConfigurationBlock_markers_tasks_add_button,
		PreferencesMessages.TodoTaskConfigurationBlock_markers_tasks_edit_button,
		PreferencesMessages.TodoTaskConfigurationBlock_markers_tasks_remove_button,
		null,
		PreferencesMessages.TodoTaskConfigurationBlock_markers_tasks_setdefault_button,
	};
	fTodoTasksList= new ListDialogField<TodoTask>(adapter, buttons, new TodoTaskLabelProvider());
	fTodoTasksList.setDialogFieldListener(adapter);
	fTodoTasksList.setRemoveButtonIndex(IDX_REMOVE);

	String[] columnsHeaders= new String[] {
		PreferencesMessages.TodoTaskConfigurationBlock_markers_tasks_name_column,
		PreferencesMessages.TodoTaskConfigurationBlock_markers_tasks_priority_column,
	};

	fTodoTasksList.setTableColumns(new ListDialogField.ColumnsDescription(columnsHeaders, true));
	fTodoTasksList.setViewerComparator(new TodoTaskSorter());


	fCaseSensitiveCheckBox= new SelectionButtonDialogField(SWT.CHECK);
	fCaseSensitiveCheckBox.setLabelText(PreferencesMessages.TodoTaskConfigurationBlock_casesensitive_label);
	fCaseSensitiveCheckBox.setDialogFieldListener(adapter);

	unpackTodoTasks();
	if (fTodoTasksList.getSize() > 0) {
		fTodoTasksList.selectFirstElement();
	} else {
		fTodoTasksList.enableButton(IDX_EDIT, false);
		fTodoTasksList.enableButton(IDX_DEFAULT, false);
	}

	fTaskTagsStatus= new StatusInfo();
}
 
Example #28
Source File: JavadocStandardWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
final void doValidation(int VALIDATE) {
	switch (VALIDATE) {
		case STYLESHEETSTATUS :
			fStyleSheetStatus= new StatusInfo();
			if (fStyleSheetButton.getSelection()) {
				String filename= fStyleSheetText.getText();
				if (filename.length() == 0) {
					fStyleSheetStatus.setError(JavadocExportMessages.JavadocSpecificsWizardPage_overviewnotfound_error);
				} else {
					File file= new File(filename);
					String ext= filename.substring(filename.lastIndexOf('.') + 1);
					if (!file.isFile()) {
						fStyleSheetStatus.setError(JavadocExportMessages.JavadocStandardWizardPage_stylesheetnopath_error);
					} else if (!ext.equalsIgnoreCase("css")) { //$NON-NLS-1$
						fStyleSheetStatus.setError(JavadocExportMessages.JavadocStandardWizardPage_stylesheetnotcss_error);
					}
				}
			}
			break;
		case LINK_REFERENCES:
			fLinkRefStatus= new StatusInfo();
			List<JavadocLinkRef> list= fListDialogField.getCheckedElements();
			for (int i= 0; i < list.size(); i++) {
				JavadocLinkRef curr= list.get(i);
				URL url= curr.getURL();
				if (url == null) {
					fLinkRefStatus.setWarning(JavadocExportMessages.JavadocStandardWizardPage_nolinkref_error);
					break;
				} else if ("jar".equals(url.getProtocol())) { //$NON-NLS-1$
					fLinkRefStatus.setWarning(JavadocExportMessages.JavadocStandardWizardPage_nojarlinkref_error);
					break;
				}
			}
			break;
	}

	updateStatus(findMostSevereStatus());

}
 
Example #29
Source File: HistoryListAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void doSelectionChanged() {
	StatusInfo status= new StatusInfo();
	List<IMember[]> selected= fHistoryList.getSelectedElements();
	if (selected.size() != 1) {
		status.setError(""); //$NON-NLS-1$
		fResult= null;
	} else {
		fResult= selected.get(0);
	}
	fHistoryList.enableButton(0, fHistoryList.getSize() > selected.size() && selected.size() != 0);
	fHistoryStatus= status;
	updateStatus(status);
}
 
Example #30
Source File: JavadocStandardWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public JavadocStandardWizardPage(String pageName, JavadocTreeWizardPage firstPage, JavadocOptionsManager store) {
	super(pageName);
	fFirstPage= firstPage;
	setDescription(JavadocExportMessages.JavadocStandardWizardPage_description);

	fStore= store;
	fButtonsList= new ArrayList<FlaggedButton>();
	fStyleSheetStatus= new StatusInfo();
	fLinkRefStatus= new StatusInfo();
}