org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField Java Examples

The following examples show how to use org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField. 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: SetFilterWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void addMultipleEntries(ListDialogField<String> field) {
	String title, message;
	if (isExclusion(field)) {
		title= NewWizardMessages.ExclusionInclusionDialog_ChooseExclusionPattern_title;
		message= NewWizardMessages.ExclusionInclusionDialog_ChooseExclusionPattern_description;
	} else {
		title= NewWizardMessages.ExclusionInclusionDialog_ChooseInclusionPattern_title;
		message= NewWizardMessages.ExclusionInclusionDialog_ChooseInclusionPattern_description;
	}

	IPath[] res= ExclusionInclusionEntryDialog.chooseExclusionPattern(getShell(), fCurrSourceFolder, title, message, null, true);
	if (res != null) {
		for (int i= 0; i < res.length; i++) {
			field.addElement(res[i].toString());
		}
	}
}
 
Example #2
Source File: CodeAssistFavoritesConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createFavoriteList(Composite parent) {
	String[] buttonLabels= new String[] {
			PreferencesMessages.CodeAssistStaticMembersConfigurationBlock_newType_button,
			PreferencesMessages.CodeAssistStaticMembersConfigurationBlock_newMember_button,
			PreferencesMessages.CodeAssistStaticMembersConfigurationBlock_edit_button,
			PreferencesMessages.CodeAssistStaticMembersConfigurationBlock_remove_button
	};

	ListAdapter adapter= new ListAdapter();

	fList= new ListDialogField<String>(adapter, buttonLabels, new ListLabelProvider());
	fList.setDialogFieldListener(adapter);
	fList.setLabelText(PreferencesMessages.CodeAssistStaticMembersConfigurationBlock_description);
	fList.setRemoveButtonIndex(IDX_REMOVE);
	fList.enableButton(IDX_EDIT, false);
	fList.setViewerComparator(new ViewerComparator());

	PixelConverter pixelConverter= new PixelConverter(parent);

	fList.doFillIntoGrid(parent, 3);
	LayoutUtil.setHorizontalSpan(fList.getLabelControl(null), 2);
	LayoutUtil.setWidthHint(fList.getLabelControl(null), pixelConverter.convertWidthInCharsToPixels(60));
	LayoutUtil.setHorizontalGrabbing(fList.getListControl(null));
}
 
Example #3
Source File: ProjectsWorkbookPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public ProjectsWorkbookPage(ListDialogField<CPListElement> classPathList, IWorkbenchPreferenceContainer pageContainer) {
	fClassPathList= classPathList;
	fPageContainer= pageContainer;
	fSWTControl= null;

	String[] buttonLabels= new String[] {
		NewWizardMessages.ProjectsWorkbookPage_projects_add_button,
		null,
		NewWizardMessages.ProjectsWorkbookPage_projects_edit_button,
		NewWizardMessages.ProjectsWorkbookPage_projects_remove_button
	};

	ProjectsAdapter adapter= new ProjectsAdapter();

	fProjectsList= new TreeListDialogField<CPListElement>(adapter, buttonLabels, new CPListLabelProvider());
	fProjectsList.setDialogFieldListener(adapter);
	fProjectsList.setLabelText(NewWizardMessages.ProjectsWorkbookPage_projects_label);

	fProjectsList.enableButton(IDX_REMOVE, false);
	fProjectsList.enableButton(IDX_EDIT, false);

	fProjectsList.setViewerComparator(new CPListElementSorter());
}
 
Example #4
Source File: BundledResourcesSelectionBlock.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
public void customButtonPressed(ListDialogField<ClientBundleResource> field, int index) {
  List<ClientBundleResource> resourcesBefore = resourcesField.getElements();

  switch (index) {
    case IDX_ADD:
      addResource();
      break;
    case IDX_ADD_MULTIPLE:
      addMultipleResources();
      break;
    case IDX_EDIT:
      editSelectedResource();
      break;
    case IDX_REMOVE:
      removeSelectedResources();
      break;
  }

  // Notify the listener if our list of modules changes
  if (listener != null && !getResources().equals(resourcesBefore)) {
    listener.onResourcesChanged();
  }
}
 
Example #5
Source File: BundledResourcesSelectionBlock.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
private void createListField() {
  String[] buttons = new String[] {
      "Add...", "Add Multiple...", "Edit", null, "Remove", null};

  resourcesField =
      new ListDialogField<ClientBundleResource>(new SelectionAdapter(), buttons,
      new ColumnLabelProvider());
  resourcesField.setLabelText(labelText);

  String[] columnNames = {"File", "Type", "Method name"};
  ColumnLayoutData[] columnLayouts = {
      new ColumnPixelData(100), new ColumnPixelData(100),
      new ColumnPixelData(100)};

  resourcesField.setTableColumns(new ListDialogField.ColumnsDescription(
      columnLayouts, columnNames, false));

  // Edit and Remove buttons disabled by default
  resourcesField.enableButton(IDX_EDIT, false);
  resourcesField.enableButton(IDX_REMOVE, false);
}
 
Example #6
Source File: SetFilterWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private ListDialogField<String> createListContents(CPListElement entryToEdit, String key, String label, ImageDescriptor descriptor, String[] buttonLabels) {
	ExclusionPatternAdapter adapter= new ExclusionPatternAdapter();

	ListDialogField<String> patternList= new ListDialogField<String>(adapter, buttonLabels, new ExclusionInclusionLabelProvider(descriptor));
	patternList.setDialogFieldListener(adapter);
	patternList.setLabelText(label);
	patternList.enableButton(IDX_EDIT, false);

	IPath[] pattern= (IPath[]) entryToEdit.getAttribute(key);

	ArrayList<String> elements= new ArrayList<String>(pattern.length);
	for (int i= 0; i < pattern.length; i++) {
		String patternName= pattern[i].toString();
		if (patternName.length() > 0)
			elements.add(patternName);
	}
	patternList.setElements(elements);
	patternList.selectFirstElement();
	patternList.enableButton(IDX_ADD_MULTIPLE, fCurrSourceFolder != null);
	patternList.setViewerComparator(new ViewerComparator());
	return patternList;
}
 
Example #7
Source File: VariableBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void customButtonPressed(ListDialogField<CPVariableElement> field, int index) {
	switch (index) {
	case 0: /* add */
		editEntries(null);
		break;
	case 1: /* edit */
		List<CPVariableElement> selected= field.getSelectedElements();
		editEntries(selected.get(0));
		break;
	}
}
 
Example #8
Source File: BuildPathsBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void buildPathCustomButtonPressed(ListDialogField<CPListElement> field, int index) {
	List<CPListElement> elems= field.getSelectedElements();
	field.removeElements(elems);
	if (index == IDX_BOTTOM) {
		field.addElements(elems);
	} else if (index == IDX_TOP) {
		field.addElements(elems, 0);
	}
}
 
Example #9
Source File: EntryPointModulesSelectionBlock.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private void createListField() {
  String[] buttons = new String[] {"Add...", "Remove", null, "Restore Defaults"};

  modulesField = new ListDialogField<String>(new ModulesSelectionAdapter(), buttons, new ModulesLabelProvider());
  modulesField.setLabelText(labelText);
  modulesField.setTableColumns(new ListDialogField.ColumnsDescription(1, false));

  // Remove button disabled by default
  modulesField.enableButton(IDX_REMOVE, false);
}
 
Example #10
Source File: NewModuleWizardPage.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
public void customButtonPressed(ListDialogField<IModule> field, int index) {
  if (index == ADD_INHERITS_BUTTON_GROUP_INDEX) {
    moduleAddInheritsButtonPressed();
  } else {
    moduleRemoveInheritsButtonPressed();
  }
}
 
Example #11
Source File: NewSourceContainerWorkbookPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
   * Constructor of the <code>NewSourceContainerWorkbookPage</code> which consists of
   * a tree representing the project, a toolbar with the available actions, an area
   * containing hyperlinks that perform the same actions as those in the toolbar but
   * additionally with some short description.
   *
   * @param classPathList
   * @param outputLocationField
   * @param context a runnable context, can be <code>null</code>
   * @param buildPathsBlock
   */
  public NewSourceContainerWorkbookPage(ListDialogField<CPListElement> classPathList, StringDialogField outputLocationField, IRunnableContext context, BuildPathsBlock buildPathsBlock) {
      fClassPathList= classPathList;
fOutputLocationField= outputLocationField;
fContext= context;
fBuildPathsBlock= buildPathsBlock;

      fUseFolderOutputs= new SelectionButtonDialogField(SWT.CHECK);
      fUseFolderOutputs.setSelection(false);
      fUseFolderOutputs.setLabelText(NewWizardMessages.SourceContainerWorkbookPage_folders_check);

fPackageExplorer= new DialogPackageExplorer();
fHintTextGroup= new HintTextGroup();
   }
 
Example #12
Source File: EntryPointModulesSelectionBlock.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void customButtonPressed(ListDialogField<String> field, int index) {
  List<String> beforeModules = modulesField.getElements();

  if (index == IDX_ADD) {
    addEntry();
  } else if (index == IDX_REMOVE) {
    removeSelectedEntries();
  } else if (index == IDX_SET_DEFAULTS) {
    setDefaults();
  }

  // Notify the listener if our list of modules changes
  notifyListenerIfChanged(beforeModules);
}
 
Example #13
Source File: SetFilterWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private IPath[] getPattern(ListDialogField<String> field) {
	Object[] arr= field.getElements().toArray();
	Arrays.sort(arr);
	IPath[] res= new IPath[arr.length];
	for (int i= 0; i < res.length; i++) {
		res[i]= new Path((String) arr[i]);
	}
	return res;
}
 
Example #14
Source File: SetFilterWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addEntry(ListDialogField<String> field) {
	List<String> existing= field.getElements();
	ExclusionInclusionEntryDialog dialog= new ExclusionInclusionEntryDialog(getShell(), isExclusion(field), null, existing, fCurrElement);
	if (dialog.open() == Window.OK) {
		field.addElement(dialog.getExclusionPattern());
	}
}
 
Example #15
Source File: UserLibraryWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void doDoubleClicked(ListDialogField<CPUserLibraryElement> field) {
	if (field == fLibrarySelector) {
		List<CPUserLibraryElement> list= fLibrarySelector.getSelectedElements();
		if (list.size() == 1) {
			CPUserLibraryElement elem= list.get(0);
			boolean state= fLibrarySelector.isChecked(elem);
			if (!state || !fIsEditMode) {
				fLibrarySelector.setChecked(elem, !state);
			}
		}
	}
}
 
Example #16
Source File: SetFilterWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void doCustomButtonPressed(ListDialogField<String> field, int index) {
	if (index == IDX_ADD) {
		addEntry(field);
	} else if (index == IDX_EDIT) {
		editEntry(field);
	} else if (index == IDX_ADD_MULTIPLE) {
		addMultipleEntries(field);
	} else if (index == IDX_REMOVE) {
		field.removeElements(field.getSelectedElements());
	}
	updateStatus();
}
 
Example #17
Source File: AccessRulesDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private ListDialogField<IAccessRule> createListContents(CPListElement entryToEdit) {
	String label= NewWizardMessages.AccessRulesDialog_rules_label;
	String[] buttonLabels= new String[] {
			NewWizardMessages.AccessRulesDialog_rules_add,
			NewWizardMessages.AccessRulesDialog_rules_edit,
			null,
			NewWizardMessages.AccessRulesDialog_rules_up,
			NewWizardMessages.AccessRulesDialog_rules_down,
			null,
			NewWizardMessages.AccessRulesDialog_rules_remove
	};

	TypeRestrictionAdapter adapter= new TypeRestrictionAdapter();
	AccessRulesLabelProvider labelProvider= new AccessRulesLabelProvider();

	ListDialogField<IAccessRule> patternList= new ListDialogField<IAccessRule>(adapter, buttonLabels, labelProvider);
	patternList.setDialogFieldListener(adapter);

	patternList.setLabelText(label);
	patternList.setRemoveButtonIndex(IDX_REMOVE);
	patternList.setUpButtonIndex(IDX_UP);
	patternList.setDownButtonIndex(IDX_DOWN);
	patternList.enableButton(IDX_EDIT, false);

	IAccessRule[] rules= (IAccessRule[]) entryToEdit.getAttribute(CPListElement.ACCESSRULES);
	ArrayList<IAccessRule> elements= new ArrayList<IAccessRule>(rules.length);
	for (int i= 0; i < rules.length; i++) {
		elements.add(rules[i]);
	}
	patternList.setElements(elements);
	patternList.selectFirstElement();
	return patternList;
}
 
Example #18
Source File: CleanUpRefactoringWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void updateEnableState(boolean isCustom, final ListDialogField<IJavaProject> settingsField, Button configureCustom, BulletListBlock bulletListBlock) {
	settingsField.getListControl(null).setEnabled(!isCustom);
	if (isCustom) {
		fEnableState= ControlEnableState.disable(settingsField.getButtonBox(null));
	} else if (fEnableState != null) {
		fEnableState.restore();
		fEnableState= null;
	}
	bulletListBlock.setEnabled(isCustom);
	configureCustom.setEnabled(isCustom);
}
 
Example #19
Source File: UserLibraryPreferencePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void doubleClicked(ListDialogField<CPUserLibraryElement> field) {
	List<CPUserLibraryElement> selectedElements= fExportImportList.getSelectedElements();
	if (selectedElements.size() == 1) {
		CPUserLibraryElement elem= selectedElements.get(0);
		fExportImportList.setChecked(elem, !fExportImportList.isChecked(elem));
	}
}
 
Example #20
Source File: NewVariableEntryDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void customButtonPressed(ListDialogField<CPVariableElement> field, int index) {
	switch (index) {
	case IDX_EXTEND: /* extend */
		extendButtonPressed();
		break;
	}
}
 
Example #21
Source File: ExclusionInclusionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void doCustomButtonPressed(ListDialogField<String> field, int index) {
	if (index == IDX_ADD) {
		addEntry(field);
	} else if (index == IDX_EDIT) {
		editEntry(field);
	} else if (index == IDX_ADD_MULTIPLE) {
		addMultipleEntries(field);
	}
}
 
Example #22
Source File: CleanUpRefactoringWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void openPropertyDialog(ListDialogField<IJavaProject> field) {
   IJavaProject project= field.getSelectedElements().get(0);
PreferencesUtil.createPropertyDialogOn(fShell, project, CleanUpPreferencePage.PROP_ID, null, null).open();
List<?> selectedElements= field.getSelectedElements();
fProvider.reset();
field.refresh();
field.selectElements(new StructuredSelection(selectedElements));
  }
 
Example #23
Source File: VariableBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public VariableBlock(boolean inPreferencePage, String initSelection) {

		fSelectedElements= new ArrayList<CPVariableElement>(0);
		fEditOnDoubleclick= inPreferencePage;
		fAskToBuild= true;

		String[] buttonLabels= new String[] {
			NewWizardMessages.VariableBlock_vars_add_button,
			NewWizardMessages.VariableBlock_vars_edit_button,
			NewWizardMessages.VariableBlock_vars_remove_button
		};

		VariablesAdapter adapter= new VariablesAdapter();

		CPVariableElementLabelProvider labelProvider= new CPVariableElementLabelProvider(inPreferencePage);

		fVariablesList= new ListDialogField<CPVariableElement>(adapter, buttonLabels, labelProvider);
		fVariablesList.setDialogFieldListener(adapter);
		fVariablesList.setLabelText(NewWizardMessages.VariableBlock_vars_label);
		fVariablesList.setRemoveButtonIndex(2);

		fVariablesList.enableButton(1, false);

		fVariablesList.setViewerComparator(new ViewerComparator() {
			@Override
			public int compare(Viewer viewer, Object e1, Object e2) {
				if (e1 instanceof CPVariableElement && e2 instanceof CPVariableElement) {
					return getComparator().compare(((CPVariableElement)e1).getName(), ((CPVariableElement)e2).getName());
				}
				return super.compare(viewer, e1, e2);
			}
		});
		refresh(initSelection);
	}
 
Example #24
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 #25
Source File: VariableBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void doubleClicked(ListDialogField<CPVariableElement> field) {
	if (fEditOnDoubleclick) {
		List<CPVariableElement> selected= field.getSelectedElements();
		if (canEdit(selected, containsReadOnly(selected))) {
			editEntries(selected.get(0));
		}
	}
}
 
Example #26
Source File: AccessRulesDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void doCustomButtonPressed(ListDialogField<IAccessRule> field, int index) {
	if (index == IDX_ADD) {
		addEntry(field);
	} else if (index == IDX_EDIT) {
		editEntry(field);
	}
}
 
Example #27
Source File: CodeAssistFavoritesConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void customButtonPressed(ListDialogField<String> field, int index) {
	doButtonPressed(index);
}
 
Example #28
Source File: CodeAssistFavoritesConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void selectionChanged(ListDialogField<String> field) {
fList.enableButton(IDX_EDIT, canEdit(field));
     }
 
Example #29
Source File: CodeAssistFavoritesConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private boolean canEdit(ListDialogField<String> field) {
	List<String> selected= field.getSelectedElements();
	return selected.size() == 1;
}
 
Example #30
Source File: TypeFilterPreferencePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void customButtonPressed(ListDialogField<String> field, int index) {
	doButtonPressed(index);
}