public ImageDescriptor getImage() {
return null;
}
private Control createContentsSingleSearch(Composite parent) {
ISearchMark mark = (ISearchMark) fEntities.get(0);
Pair<ISearchCondition, List<ISearchCondition>> conditions = CoreUtils.splitScope(mark.getSearchConditions());
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(LayoutUtils.createGridLayout(2, 10, 10));
/* Name */
Label nameLabel = new Label(container, SWT.None);
nameLabel.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
nameLabel.setText(Messages.SearchMarkPropertyPage_NAME);
Composite nameContainer = new Composite(container, Application.IS_MAC ? SWT.NONE : SWT.BORDER);
nameContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
nameContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0));
if (!Application.IS_MAC)
nameContainer.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
fNameInput = new Text(nameContainer, Application.IS_MAC ? SWT.BORDER : SWT.NONE);
OwlUI.makeAccessible(fNameInput, nameLabel);
fNameInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
fNameInput.setText(mark.getName());
ToolBar generateTitleBar = new ToolBar(nameContainer, SWT.FLAT);
OwlUI.makeAccessible(generateTitleBar, Messages.SearchMarkPropertyPage_NAME_FROM_CONDITION);
if (!Application.IS_MAC)
generateTitleBar.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
ToolItem generateTitleItem = new ToolItem(generateTitleBar, SWT.PUSH);
generateTitleItem.setImage(OwlUI.getImage(fSite.getResourceManager(), "icons/etool16/info.gif")); //$NON-NLS-1$
generateTitleItem.setToolTipText(Messages.SearchMarkPropertyPage_NAME_FROM_CONDITION);
generateTitleItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
onGenerateName();
}
});
/* Location */
Label locationLabel = new Label(container, SWT.None);
locationLabel.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
locationLabel.setText(Messages.SearchMarkPropertyPage_LOCATION);
fFolderChooser = new FolderChooser(container, mark.getParent(), SWT.BORDER, true);
fFolderChooser.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
fFolderChooser.setLayout(LayoutUtils.createGridLayout(1, 0, 0, 2, 5, false));
fFolderChooser.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
Composite topControlsContainer = new Composite(container, SWT.None);
topControlsContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1));
topControlsContainer.setLayout(LayoutUtils.createGridLayout(4, 5, 0));
((GridLayout) topControlsContainer.getLayout()).marginTop = 10;
fMatchAllRadio = new Button(topControlsContainer, SWT.RADIO);
fMatchAllRadio.setText(Messages.SearchMarkPropertyPage_MATCH_ALL);
fMatchAllRadio.setSelection(mark.matchAllConditions());
fMatchAnyRadio = new Button(topControlsContainer, SWT.RADIO);
fMatchAnyRadio.setText(Messages.SearchMarkPropertyPage_MATCH_ANY);
fMatchAnyRadio.setSelection(!mark.matchAllConditions());
/* Separator */
Label sep = new Label(topControlsContainer, SWT.SEPARATOR | SWT.VERTICAL);
sep.setLayoutData(new GridData(SWT.DEFAULT, 20));
/* Scope */
Composite scopeContainer = new Composite(topControlsContainer, SWT.None);
scopeContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
scopeContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0, 0, 5, false));
Label scopeLabel = new Label(scopeContainer, SWT.NONE);
scopeLabel.setText(Messages.SearchMarkPropertyPage_SEARCH_IN);
fLocationControl = new LocationControl(scopeContainer, SWT.WRAP) {
@Override
protected String getDefaultLabel() {
return Messages.SearchMarkPropertyPage_ALL_NEWS;
}
};
fLocationControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
((GridData) fLocationControl.getLayoutData()).widthHint = 100;
fLocationControl.setLayout(LayoutUtils.createGridLayout(1, 0, 0, 0, 0, false));
if (conditions.getFirst() != null && conditions.getFirst().getValue() instanceof Long[][])
fLocationControl.select((Long[][]) conditions.getFirst().getValue());
Composite conditionsContainer = new Composite(container, SWT.BORDER);
conditionsContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
conditionsContainer.setLayout(LayoutUtils.createGridLayout(1));
conditionsContainer.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
conditionsContainer.setBackgroundMode(SWT.INHERIT_FORCE);
/* Search Conditions List */
fSearchConditionList = new SearchConditionList(conditionsContainer, SWT.None, conditions.getSecond());
fSearchConditionList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
if (conditions.getSecond().size() <= 3)
fSearchConditionList.setVisibleItemCount(3);
else //Workaround for Bug 1544: State Condition not enough width in propertes when scrollbar showing
fSearchConditionList.setVisibleItemCount(Math.min(7, conditions.getSecond().size()));
if (CoreUtils.isLocationConflict(mark.getSearchConditions()))
fSite.setMessage(Messages.SearchMarkPropertyPage_LOCATION_WARNING, IPropertyDialogSite.MessageType.WARNING);
return container;
}