Rework the query property page.
This commit is contained in:
parent
25db1103ec
commit
f734495fd4
|
@ -5,23 +5,33 @@
|
||||||
package io.gitea.mylyn.ui;
|
package io.gitea.mylyn.ui;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||||
import org.eclipse.jface.layout.GridDataFactory;
|
import org.eclipse.jface.layout.GridDataFactory;
|
||||||
import org.eclipse.jface.layout.GridLayoutFactory;
|
import org.eclipse.jface.layout.GridLayoutFactory;
|
||||||
|
import org.eclipse.jface.operation.IRunnableContext;
|
||||||
import org.eclipse.jface.viewers.ArrayContentProvider;
|
import org.eclipse.jface.viewers.ArrayContentProvider;
|
||||||
|
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
||||||
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||||
import org.eclipse.jface.viewers.TableViewer;
|
|
||||||
import org.eclipse.jface.wizard.IWizardPage;
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
|
import org.eclipse.mylyn.commons.core.ICoreRunnable;
|
||||||
|
import org.eclipse.mylyn.commons.net.Policy;
|
||||||
|
import org.eclipse.mylyn.commons.ui.CommonUiUtil;
|
||||||
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
|
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
|
||||||
import org.eclipse.mylyn.tasks.core.TaskRepository;
|
import org.eclipse.mylyn.tasks.core.TaskRepository;
|
||||||
|
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
|
||||||
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage;
|
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.FocusEvent;
|
import org.eclipse.swt.events.DisposeEvent;
|
||||||
import org.eclipse.swt.events.FocusListener;
|
import org.eclipse.swt.events.DisposeListener;
|
||||||
import org.eclipse.swt.events.KeyEvent;
|
|
||||||
import org.eclipse.swt.events.KeyListener;
|
|
||||||
import org.eclipse.swt.events.ModifyEvent;
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
import org.eclipse.swt.events.ModifyListener;
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
@ -33,9 +43,13 @@ import org.eclipse.swt.widgets.Combo;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Group;
|
import org.eclipse.swt.widgets.Group;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.TableItem;
|
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
import org.eclipse.swt.widgets.ToolBar;
|
||||||
|
import org.eclipse.swt.widgets.ToolItem;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
|
import io.gitea.ApiException;
|
||||||
|
import io.gitea.model.GiteaUser;
|
||||||
import io.gitea.model.IssueState;
|
import io.gitea.model.IssueState;
|
||||||
import io.gitea.model.Milestone;
|
import io.gitea.model.Milestone;
|
||||||
import io.gitea.mylyn.core.ConnectionManager;
|
import io.gitea.mylyn.core.ConnectionManager;
|
||||||
|
@ -43,247 +57,645 @@ import io.gitea.mylyn.core.GiteaConnection;
|
||||||
|
|
||||||
public class GiteaQueryPage extends AbstractRepositoryQueryPage implements IWizardPage {
|
public class GiteaQueryPage extends AbstractRepositoryQueryPage implements IWizardPage {
|
||||||
|
|
||||||
private Button openButton;
|
private SelectionListener completeListener = new SelectionAdapter() {
|
||||||
private Button closedButton;
|
public void widgetSelected(SelectionEvent e) {
|
||||||
private Text titleText;
|
setPageComplete(isPageComplete());
|
||||||
private Text assigneeText;
|
}
|
||||||
private Text newLabel;
|
};
|
||||||
private Combo milestoneCombo;
|
|
||||||
private TableViewer labelsViewer;
|
|
||||||
|
|
||||||
private SelectionListener completeListener = new SelectionAdapter() {
|
/**
|
||||||
public void widgetSelected(SelectionEvent e) {
|
* @param pageName
|
||||||
setPageComplete(isPageComplete());
|
* @param taskRepository
|
||||||
}
|
* @param query
|
||||||
};
|
*/
|
||||||
|
public GiteaQueryPage(String pageName, TaskRepository taskRepository, IRepositoryQuery query) {
|
||||||
|
super(pageName, taskRepository, query);
|
||||||
|
setDescription("Specify your query");
|
||||||
|
setPageComplete(false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
// ---------------------------------------------------------------------
|
||||||
* @param pageName
|
// DEFINE QUERY TITLE AREA
|
||||||
* @param taskRepository
|
// ---------------------------------------------------------------------
|
||||||
* @param query
|
private Text titleText;
|
||||||
*/
|
|
||||||
public GiteaQueryPage(String pageName, TaskRepository taskRepository, IRepositoryQuery query) {
|
|
||||||
super(pageName, taskRepository, query);
|
|
||||||
setDescription("Specify your query");
|
|
||||||
setPageComplete(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createLabelsArea(Composite parent) {
|
/**
|
||||||
Group labelsArea = new Group(parent, SWT.NONE);
|
* Create Query title area . Query title is 2 columns based (not same size)
|
||||||
labelsArea.setText(Labels.QUERY_GROUP_LABELS);
|
*
|
||||||
GridDataFactory.fillDefaults().grab(true, true).applyTo(labelsArea);
|
* @implNote allocate {@titleText} private Text widget.
|
||||||
GridLayoutFactory.swtDefaults().applyTo(labelsArea);
|
*/
|
||||||
|
private void createQueryTitleArea(Composite parent) {
|
||||||
|
Composite titleArea = new Composite(parent, SWT.NONE);
|
||||||
|
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(titleArea);
|
||||||
|
GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(titleArea);
|
||||||
|
|
||||||
labelsViewer = new TableViewer(labelsArea, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
|
new Label(titleArea, SWT.NONE).setText(Labels.QUERY_TITLE);
|
||||||
|
titleText = new Text(titleArea, SWT.SINGLE | SWT.BORDER);
|
||||||
|
GridDataFactory.fillDefaults().grab(true, false).applyTo(titleText);
|
||||||
|
titleText.addModifyListener(new ModifyListener() {
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
setPageComplete(isPageComplete());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
GridDataFactory.fillDefaults().grab(true, true).hint(100, 80).applyTo(labelsViewer.getControl());
|
}
|
||||||
labelsViewer.setContentProvider(ArrayContentProvider.getInstance());
|
|
||||||
labelsViewer.setLabelProvider(new LabelProvider() {
|
|
||||||
public Image getImage(Object element) {
|
|
||||||
return GiteaImages.LABEL;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
newLabel = new Text(labelsArea, SWT.BORDER);
|
// ---------------------------------------------------------------------
|
||||||
GridDataFactory.fillDefaults().grab(true, false).applyTo(newLabel);
|
// FILTER BY ISSUE STATE AREA
|
||||||
|
// ---------------------------------------------------------------------
|
||||||
|
private Button openButton;
|
||||||
|
private Button closedButton;
|
||||||
|
|
||||||
Composite btnArea = new Composite(labelsArea, SWT.NONE);
|
/**
|
||||||
GridDataFactory.fillDefaults().grab(true, true).applyTo(btnArea);
|
* Create issue state filter area.
|
||||||
GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).applyTo(btnArea);
|
*
|
||||||
|
* @param parent Composite the state filter area is attached to.
|
||||||
|
* @implNote allocate {@openButton} and @{closedButton} private buttons.
|
||||||
|
*/
|
||||||
|
private void createIssueStateArea(Composite parent) {
|
||||||
|
Composite statusArea = new Composite(parent, SWT.NONE);
|
||||||
|
GridLayoutFactory.fillDefaults().numColumns(4).equalWidth(false).applyTo(statusArea);
|
||||||
|
GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(statusArea);
|
||||||
|
|
||||||
final Button btnAdd = new Button(btnArea, SWT.BORDER);
|
new Label(statusArea, SWT.NONE).setText(Labels.QUERY_STATE);
|
||||||
btnAdd.setText(Labels.QUERY_NEW_LABEL_REGEX);
|
|
||||||
GridDataFactory.fillDefaults().grab(true, false).applyTo(btnAdd);
|
|
||||||
|
|
||||||
Button btnRemove = new Button(btnArea, SWT.BORDER);
|
openButton = new Button(statusArea, SWT.CHECK);
|
||||||
btnRemove.setText(Labels.QUERY_REMOVE_LABEL_REGEX);
|
openButton.setSelection(true);
|
||||||
GridDataFactory.fillDefaults().grab(true, false).applyTo(btnRemove);
|
openButton.setText(IssueState.STATE_OPENED.toString());
|
||||||
|
openButton.addSelectionListener(completeListener);
|
||||||
|
|
||||||
btnAdd.addSelectionListener(new SelectionListener() {
|
closedButton = new Button(statusArea, SWT.CHECK);
|
||||||
@Override
|
closedButton.setSelection(true);
|
||||||
public void widgetSelected(SelectionEvent e) {
|
closedButton.setText(IssueState.STATE_CLOSED.toString());
|
||||||
String[] split = newLabel.getText().split(",");
|
closedButton.addSelectionListener(completeListener);
|
||||||
for (String s : split) {
|
|
||||||
if (s.trim().length() > 0) {
|
|
||||||
labelsViewer.add(s.trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
newLabel.setText("");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
createRefreshButton(statusArea);
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnRemove.addSelectionListener(new SelectionListener() {
|
}
|
||||||
@Override
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
removeSelection();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
// ---------------------------------------------------------------------
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
// REFRESH BUTTON
|
||||||
}
|
// ---------------------------------------------------------------------
|
||||||
});
|
private void createRefreshButton(Composite parent) {
|
||||||
|
ToolBar toolbar = new ToolBar(parent, SWT.FLAT);
|
||||||
|
ToolItem updateItem = new ToolItem(toolbar, SWT.PUSH);
|
||||||
|
final Image updateImage = TasksUiImages.REPOSITORY_UPDATE_CONFIGURATION.createImage();
|
||||||
|
toolbar.addDisposeListener(new DisposeListener() {
|
||||||
|
|
||||||
newLabel.addFocusListener(new FocusListener() {
|
@Override
|
||||||
|
public void widgetDisposed(DisposeEvent e) {
|
||||||
|
updateImage.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
updateItem.setImage(updateImage);
|
||||||
|
updateItem.setToolTipText(Messages.MylynGiteaUIQueryPage_TooltipUpdateRepository);
|
||||||
|
GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).grab(true, false).applyTo(toolbar);
|
||||||
|
updateItem.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void focusLost(FocusEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
getShell().setDefaultButton(null);
|
refreshRepository();
|
||||||
setPageComplete(isPageComplete());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
});
|
||||||
public void focusGained(FocusEvent e) {
|
|
||||||
getShell().setDefaultButton(btnAdd);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
labelsViewer.getTable().addKeyListener(new KeyListener() {
|
}
|
||||||
|
|
||||||
@Override
|
// ---------------------------------------------------------------------
|
||||||
public void keyReleased(KeyEvent e) {
|
// FILTER BY MILESTONE AREA
|
||||||
if (e.keyCode == SWT.DEL) {
|
// ---------------------------------------------------------------------
|
||||||
removeSelection();
|
private Combo milestoneCombo;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public void keyPressed(KeyEvent e) {
|
* Create milestones selection area.
|
||||||
}
|
*
|
||||||
});
|
* @param parent Composite the milestone selection area is attached to.
|
||||||
}
|
* @implNote Allocate {@literal milestoneCombo} private Combo.
|
||||||
|
*/
|
||||||
|
private void createFilterByMilestoneArea(Composite parent) {
|
||||||
|
Composite milestonesArea = new Composite(parent, SWT.NONE);
|
||||||
|
GridLayoutFactory.fillDefaults().numColumns(4).equalWidth(false).applyTo(milestonesArea);
|
||||||
|
GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(milestonesArea);
|
||||||
|
|
||||||
private void removeSelection() {
|
Label milestonesLabel = new Label(milestonesArea, SWT.NONE);
|
||||||
StructuredSelection selection = (StructuredSelection) labelsViewer.getSelection();
|
milestonesLabel.setText(Labels.QUERY_MILESTONE);
|
||||||
if (!selection.isEmpty()) {
|
|
||||||
labelsViewer.remove(selection.toArray());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createOptionsArea(Composite parent) {
|
milestoneCombo = new Combo(milestonesArea, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||||
Composite optionsArea = new Composite(parent, SWT.NONE);
|
GridDataFactory.fillDefaults().grab(true, false).applyTo(milestoneCombo);
|
||||||
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(optionsArea);
|
updateMilestones();
|
||||||
GridDataFactory.fillDefaults().grab(true, true).applyTo(optionsArea);
|
|
||||||
|
|
||||||
Composite statusArea = new Composite(optionsArea, SWT.NONE);
|
}
|
||||||
GridLayoutFactory.fillDefaults().numColumns(4).equalWidth(false).applyTo(statusArea);
|
|
||||||
GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(statusArea);
|
|
||||||
|
|
||||||
new Label(statusArea, SWT.NONE).setText(Labels.QUERY_STATE);
|
// ---------------------------------------------------------------------
|
||||||
|
// FILTER BY ASSIGNED MEMBER AREA
|
||||||
|
// ---------------------------------------------------------------------
|
||||||
|
private Text assigneeText;
|
||||||
|
private CheckboxTableViewer assignedViewer;
|
||||||
|
private void refreshAssignedText() {
|
||||||
|
if ((assigneeText != null) && (assignedViewer != null)) {
|
||||||
|
List<String> checkedItemsList = new ArrayList<String>();
|
||||||
|
for (Object o : assignedViewer.getCheckedElements()) {
|
||||||
|
checkedItemsList.add(((String) o));
|
||||||
|
}
|
||||||
|
assigneeText.setText(StringUtils.join(checkedItemsList, ",")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
openButton = new Button(statusArea, SWT.CHECK);
|
|
||||||
openButton.setSelection(true);
|
/**
|
||||||
openButton.setText(IssueState.STATE_OPENED.toString());
|
* Create filter by assigned member area.
|
||||||
openButton.addSelectionListener(completeListener);
|
*
|
||||||
|
* @param parent Composite the filter by assigned member area is attached to.
|
||||||
|
* @implNote Allocate {@literal assignedViewer} private attribute.
|
||||||
|
*/
|
||||||
|
private void createFilterByAssignedMembersArea(Composite parent) {
|
||||||
|
Group assignedArea = new Group(parent, SWT.NONE);
|
||||||
|
assignedArea.setText(Labels.QUERY_ASSIGNEE);
|
||||||
|
GridDataFactory.fillDefaults().grab(true, true).applyTo(assignedArea);
|
||||||
|
GridLayoutFactory.swtDefaults().applyTo(assignedArea);
|
||||||
|
|
||||||
closedButton = new Button(statusArea, SWT.CHECK);
|
assigneeText = new Text(assignedArea, SWT.BORDER | SWT.SINGLE);
|
||||||
closedButton.setSelection(true);
|
GridDataFactory.fillDefaults().grab(true, false).applyTo(assigneeText);
|
||||||
closedButton.setText(IssueState.STATE_CLOSED.toString());
|
|
||||||
closedButton.addSelectionListener(completeListener);
|
|
||||||
|
|
||||||
Label milestonesLabel = new Label(optionsArea, SWT.NONE);
|
assignedViewer = CheckboxTableViewer.newCheckList(assignedArea, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
|
||||||
milestonesLabel.setText(Labels.QUERY_MILESTONE);
|
|
||||||
|
|
||||||
milestoneCombo = new Combo(optionsArea, SWT.DROP_DOWN | SWT.READ_ONLY);
|
GridDataFactory.fillDefaults().grab(true, true).hint(100, 80).applyTo(assignedViewer.getControl());
|
||||||
GridDataFactory.fillDefaults().grab(true, false).applyTo(milestoneCombo);
|
assignedViewer.setContentProvider(ArrayContentProvider.getInstance());
|
||||||
GiteaConnection connection = ConnectionManager.getSafe(getTaskRepository());
|
assignedViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||||
if (connection != null) {
|
@Override
|
||||||
milestoneCombo.add("");
|
public void selectionChanged(SelectionChangedEvent event) {
|
||||||
for (Milestone s : connection.getMilestones()) {
|
setPageComplete(isPageComplete());
|
||||||
milestoneCombo.add(s.getTitle());
|
refreshAssignedText();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
Composite buttonsArea = new Composite(assignedArea, SWT.BORDER | SWT.NONE);
|
||||||
|
GridDataFactory.fillDefaults().grab(true, false).applyTo(buttonsArea);
|
||||||
|
GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).applyTo(buttonsArea);
|
||||||
|
|
||||||
Label assigneeLabel = new Label(optionsArea, SWT.NONE);
|
final Button selectAllButton = new Button(buttonsArea, SWT.BORDER);
|
||||||
assigneeLabel.setText(Labels.QUERY_ASSIGNEE);
|
selectAllButton.setText(Labels.QUERY_SELECT_ALL_BUTTON);
|
||||||
|
GridDataFactory.fillDefaults().grab(true, false).applyTo(selectAllButton);
|
||||||
|
|
||||||
assigneeText = new Text(optionsArea, SWT.BORDER | SWT.SINGLE);
|
selectAllButton.addSelectionListener(new SelectionListener() {
|
||||||
GridDataFactory.fillDefaults().grab(true, false).applyTo(assigneeText);
|
@Override
|
||||||
}
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
assignedViewer.setAllChecked(true);
|
||||||
|
refreshAssignedText();
|
||||||
|
}
|
||||||
|
|
||||||
public void createControl(Composite parent) {
|
@Override
|
||||||
Composite displayArea = new Composite(parent, SWT.NONE);
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(true).applyTo(displayArea);
|
}
|
||||||
GridDataFactory.fillDefaults().grab(true, true).applyTo(displayArea);
|
});
|
||||||
|
|
||||||
if (!inSearchContainer()) {
|
Button selectNoneButton = new Button(buttonsArea, SWT.BORDER);
|
||||||
Composite titleArea = new Composite(displayArea, SWT.NONE);
|
selectNoneButton.setText(Labels.QUERY_SELECT_NONE_BUTTON);
|
||||||
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(titleArea);
|
GridDataFactory.fillDefaults().grab(true, false).applyTo(selectNoneButton);
|
||||||
GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(titleArea);
|
|
||||||
|
|
||||||
new Label(titleArea, SWT.NONE).setText(Labels.QUERY_TITLE);
|
selectNoneButton.addSelectionListener(new SelectionListener() {
|
||||||
titleText = new Text(titleArea, SWT.SINGLE | SWT.BORDER);
|
@Override
|
||||||
GridDataFactory.fillDefaults().grab(true, false).applyTo(titleText);
|
public void widgetSelected(SelectionEvent e) {
|
||||||
titleText.addModifyListener(new ModifyListener() {
|
assignedViewer.setAllChecked(false);
|
||||||
public void modifyText(ModifyEvent e) {
|
refreshAssignedText();
|
||||||
setPageComplete(isPageComplete());
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
createOptionsArea(displayArea);
|
@Override
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
createLabelsArea(displayArea);
|
try {
|
||||||
|
updateAssigned();
|
||||||
|
} catch (ApiException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
initialize();
|
}
|
||||||
setControl(displayArea);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initialize() {
|
// ---------------------------------------------------------------------
|
||||||
IRepositoryQuery query = getQuery();
|
// FILTER BY LABELS AREA
|
||||||
if (query == null) {
|
// ---------------------------------------------------------------------
|
||||||
return;
|
// private TableViewer labelsViewer;
|
||||||
}
|
private Text labelsText;
|
||||||
|
private CheckboxTableViewer labelsViewer; // not issue type, not priority
|
||||||
|
|
||||||
titleText.setText(query.getSummary());
|
private void refreshLabelsText() {
|
||||||
assigneeText.setText(query.getAttribute("assignee"));
|
if ((labelsText != null) && (labelsViewer != null)) {
|
||||||
milestoneCombo.setText(query.getAttribute("milestone"));
|
List<String> checkedItemsList = new ArrayList<String>();
|
||||||
|
for (Object o : labelsViewer.getCheckedElements()) {
|
||||||
|
checkedItemsList.add(((String) o));
|
||||||
|
}
|
||||||
|
labelsText.setText(StringUtils.join(checkedItemsList, ",")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
openButton.setSelection(Boolean.parseBoolean(query.getAttribute("opened")));
|
// --private CheckboxTableViewer prioritiesViewer; // 'priority' labels
|
||||||
closedButton.setSelection(Boolean.parseBoolean(query.getAttribute("closed")));
|
// --private CheckboxTableViewer issueTypesViewer;// 'issue' type labels
|
||||||
|
private void createFilterByLabelsArea(Composite parent) {
|
||||||
|
// Group labelsArea = new Group(parent, SWT.NONE);
|
||||||
|
// labelsArea.setText(Labels.QUERY_GROUP_LABELS);
|
||||||
|
// GridDataFactory.fillDefaults().grab(true, true).applyTo(labelsArea);
|
||||||
|
// GridLayoutFactory.swtDefaults().applyTo(labelsArea);
|
||||||
|
|
||||||
for (String label : query.getAttribute("labels").split(",")) {
|
/**
|
||||||
if (label.trim().length() > 0) {
|
* -- Group issuesArea = new Group(parent, SWT.NONE);
|
||||||
labelsViewer.add(label.trim());
|
* issuesArea.setText(Labels.QUERY_GROUP_LABELS_ISSUE_TYPES);
|
||||||
}
|
* GridDataFactory.fillDefaults().grab(true, true).applyTo(issuesArea);
|
||||||
}
|
* GridLayoutFactory.swtDefaults().applyTo(issuesArea);
|
||||||
|
*
|
||||||
|
* Group prioritiesArea = new Group(parent, SWT.NONE);
|
||||||
|
* prioritiesArea.setText(Labels.QUERY_GROUP_LABELS_PRIORITIES);
|
||||||
|
* GridDataFactory.fillDefaults().grab(true, true).applyTo(prioritiesArea);
|
||||||
|
* GridLayoutFactory.swtDefaults().applyTo(prioritiesArea); --
|
||||||
|
*/
|
||||||
|
Group labelsArea = new Group(parent, SWT.READ_ONLY);
|
||||||
|
labelsArea.setText(Labels.QUERY_GROUP_LABELS);
|
||||||
|
GridDataFactory.fillDefaults().grab(true, true).applyTo(labelsArea);
|
||||||
|
GridLayoutFactory.swtDefaults().applyTo(labelsArea);
|
||||||
|
|
||||||
}
|
labelsText = new Text(labelsArea, SWT.BORDER);
|
||||||
|
GridDataFactory.fillDefaults().grab(true, false).applyTo(labelsText);
|
||||||
|
|
||||||
public boolean isPageComplete() {
|
labelsViewer = CheckboxTableViewer.newCheckList(labelsArea, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
|
||||||
boolean complete = inSearchContainer() ? true : super.isPageComplete();
|
|
||||||
if (complete) {
|
|
||||||
String message = null;
|
|
||||||
if (!openButton.getSelection() && !closedButton.getSelection()) {
|
|
||||||
message = "Select either closed, opened or both issue states";
|
|
||||||
}
|
|
||||||
|
|
||||||
setErrorMessage(message);
|
GridDataFactory.fillDefaults().grab(true, true).hint(100, 80).applyTo(labelsViewer.getControl());
|
||||||
complete = message == null;
|
labelsViewer.setContentProvider(ArrayContentProvider.getInstance());
|
||||||
}
|
labelsViewer.setLabelProvider(new LabelProvider() {
|
||||||
return complete;
|
public Image getImage(Object element) {
|
||||||
}
|
return GiteaImages.LABEL;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
labelsViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||||
|
@Override
|
||||||
|
public void selectionChanged(SelectionChangedEvent event) {
|
||||||
|
setPageComplete(isPageComplete());
|
||||||
|
refreshLabelsText();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
public String getQueryTitle() {
|
/*
|
||||||
return titleText != null ? titleText.getText() : null;
|
* -- TODO: filter labels by priority prioritiesViewer =
|
||||||
}
|
* CheckboxTableViewer.newCheckList(prioritiesArea, SWT.BORDER | SWT.V_SCROLL |
|
||||||
|
* SWT.H_SCROLL);
|
||||||
|
*
|
||||||
|
* GridDataFactory.fillDefaults().grab(true, true).hint(100,
|
||||||
|
* 80).applyTo(prioritiesViewer.getControl());
|
||||||
|
* prioritiesViewer.setContentProvider(ArrayContentProvider.getInstance());
|
||||||
|
* prioritiesViewer.setLabelProvider(new LabelProvider() { public Image
|
||||||
|
* getImage(Object element) { return GiteaImages.LABEL; } });
|
||||||
|
* prioritiesViewer.addSelectionChangedListener(new ISelectionChangedListener()
|
||||||
|
* {
|
||||||
|
*
|
||||||
|
* @Override public void selectionChanged(SelectionChangedEvent event) {
|
||||||
|
* setPageComplete(isPageComplete()); } }); --
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* -- TODO: filter labels by issue type issueTypesViewer =
|
||||||
|
* CheckboxTableViewer.newCheckList(issuesArea, SWT.BORDER | SWT.V_SCROLL |
|
||||||
|
* SWT.H_SCROLL);
|
||||||
|
*
|
||||||
|
* GridDataFactory.fillDefaults().grab(true, true).hint(100,
|
||||||
|
* 80).applyTo(issueTypesViewer.getControl());
|
||||||
|
* issueTypesViewer.setContentProvider(ArrayContentProvider.getInstance());
|
||||||
|
* issueTypesViewer.setLabelProvider(new LabelProvider() { public Image
|
||||||
|
* getImage(Object element) { return GiteaImages.LABEL; } });
|
||||||
|
* issueTypesViewer.addSelectionChangedListener(new ISelectionChangedListener()
|
||||||
|
* {
|
||||||
|
*
|
||||||
|
* @Override public void selectionChanged(SelectionChangedEvent event) {
|
||||||
|
* setPageComplete(isPageComplete()); } }); --
|
||||||
|
*/
|
||||||
|
|
||||||
public void applyTo(IRepositoryQuery query) {
|
Composite buttonsArea = new Composite(labelsArea, SWT.BORDER | SWT.NONE);
|
||||||
query.setSummary(titleText.getText());
|
GridDataFactory.fillDefaults().grab(true, false).applyTo(buttonsArea);
|
||||||
query.setAttribute("assignee", assigneeText.getText());
|
GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).applyTo(buttonsArea);
|
||||||
query.setAttribute("milestone", milestoneCombo.getText());
|
|
||||||
query.setAttribute("opened", "" + openButton.getSelection());
|
|
||||||
query.setAttribute("closed", "" + closedButton.getSelection());
|
|
||||||
|
|
||||||
ArrayList<String> labels = new ArrayList<String>();
|
final Button selectAllButton = new Button(buttonsArea, SWT.BORDER);
|
||||||
|
selectAllButton.setText(Labels.QUERY_SELECT_ALL_BUTTON);
|
||||||
|
GridDataFactory.fillDefaults().grab(true, false).applyTo(selectAllButton);
|
||||||
|
|
||||||
for (TableItem i : labelsViewer.getTable().getItems()) {
|
selectAllButton.addSelectionListener(new SelectionListener() {
|
||||||
labels.add(i.getText());
|
@Override
|
||||||
}
|
public void widgetSelected(SelectionEvent e) {
|
||||||
query.setAttribute("labels", StringUtils.join(labels, ","));
|
labelsViewer.setAllChecked(true);
|
||||||
}
|
refreshLabelsText();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Button selectNoneButton = new Button(buttonsArea, SWT.BORDER);
|
||||||
|
selectNoneButton.setText(Labels.QUERY_SELECT_NONE_BUTTON);
|
||||||
|
GridDataFactory.fillDefaults().grab(true, false).applyTo(selectNoneButton);
|
||||||
|
|
||||||
|
selectNoneButton.addSelectionListener(new SelectionListener() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
labelsViewer.setAllChecked(false);
|
||||||
|
refreshLabelsText();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
* newLabel.addFocusListener(new FocusListener() {
|
||||||
|
*
|
||||||
|
* @Override public void focusLost(FocusEvent e) {
|
||||||
|
* getShell().setDefaultButton(null); setPageComplete(isPageComplete()); }
|
||||||
|
*
|
||||||
|
* @Override public void focusGained(FocusEvent e) {
|
||||||
|
* getShell().setDefaultButton(btnAdd); } });
|
||||||
|
* labelsViewer.getTable().addKeyListener(new KeyListener() {
|
||||||
|
*
|
||||||
|
* @Override public void keyReleased(KeyEvent e) { if (e.keyCode == SWT.DEL) {
|
||||||
|
* removeSelection(); } }
|
||||||
|
*
|
||||||
|
* @Override public void keyPressed(KeyEvent e) { } });
|
||||||
|
*/
|
||||||
|
updateLabels();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createLeftColumnArea(Composite parent) {
|
||||||
|
Composite leftArea = new Composite(parent, SWT.NONE);
|
||||||
|
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(leftArea);
|
||||||
|
GridDataFactory.fillDefaults().grab(true, true).applyTo(leftArea);
|
||||||
|
|
||||||
|
createIssueStateArea(leftArea);
|
||||||
|
createFilterByAssignedMembersArea(leftArea);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createRightColumnArea(Composite parent) {
|
||||||
|
Composite rightArea = new Composite(parent, SWT.NONE);
|
||||||
|
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(rightArea);
|
||||||
|
GridDataFactory.fillDefaults().grab(true, true).applyTo(rightArea);
|
||||||
|
|
||||||
|
createFilterByMilestoneArea(rightArea);
|
||||||
|
createFilterByLabelsArea(rightArea);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Composite displayArea (2 columns based).
|
||||||
|
* |---------------------------------------| |
|
||||||
|
* <QueryTitleArea.....................> | | <LeftColumnArea> |
|
||||||
|
* <RightColumnArea> | |---------------------------------------|
|
||||||
|
*/
|
||||||
|
public void createControl(Composite parent) {
|
||||||
|
Composite displayArea = new Composite(parent, SWT.NONE);
|
||||||
|
GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(true).applyTo(displayArea);
|
||||||
|
GridDataFactory.fillDefaults().grab(true, true).applyTo(displayArea);
|
||||||
|
|
||||||
|
if (!inSearchContainer()) {
|
||||||
|
createQueryTitleArea(displayArea);
|
||||||
|
}
|
||||||
|
|
||||||
|
createLeftColumnArea(displayArea);
|
||||||
|
|
||||||
|
createRightColumnArea(displayArea);
|
||||||
|
|
||||||
|
initialize();
|
||||||
|
setControl(displayArea);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initialize() {
|
||||||
|
IRepositoryQuery query = getQuery();
|
||||||
|
if (query == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
titleText.setText(query.getSummary());
|
||||||
|
// assigneeText.setText(query.getAttribute("assignee"));
|
||||||
|
milestoneCombo.setText(query.getAttribute("milestone"));
|
||||||
|
|
||||||
|
openButton.setSelection(Boolean.parseBoolean(query.getAttribute("opened")));
|
||||||
|
closedButton.setSelection(Boolean.parseBoolean(query.getAttribute("closed")));
|
||||||
|
|
||||||
|
try {
|
||||||
|
updateAssigned();
|
||||||
|
} catch (ApiException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
updateLabels();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* for (String label : query.getAttribute("labels").split(",")) { if
|
||||||
|
* (label.trim().length() > 0) { labelsViewer.add(label.trim()); } }
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPageComplete() {
|
||||||
|
boolean complete = inSearchContainer() ? true : super.isPageComplete();
|
||||||
|
if (complete) {
|
||||||
|
String message = null;
|
||||||
|
if (!openButton.getSelection() && !closedButton.getSelection()) {
|
||||||
|
message = "Select either closed, opened or both issue states";
|
||||||
|
}
|
||||||
|
|
||||||
|
setErrorMessage(message);
|
||||||
|
complete = message == null;
|
||||||
|
}
|
||||||
|
return complete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getQueryTitle() {
|
||||||
|
return titleText != null ? titleText.getText() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void applyTo(IRepositoryQuery query) {
|
||||||
|
query.setSummary(titleText.getText());
|
||||||
|
|
||||||
|
query.setAttribute("assignee", labelsText.getText());
|
||||||
|
|
||||||
|
query.setAttribute("milestone", milestoneCombo.getText());
|
||||||
|
query.setAttribute("opened", "" + openButton.getSelection());
|
||||||
|
query.setAttribute("closed", "" + closedButton.getSelection());
|
||||||
|
|
||||||
|
ArrayList<String> labels = new ArrayList<String>();
|
||||||
|
/*
|
||||||
|
* TODO: filter labels by issue type or priorities {{{ for (Object o :
|
||||||
|
* issueTypesViewer.getCheckedElements()) { labels.add(((String)o)); } for
|
||||||
|
* (Object o : prioritiesViewer.getCheckedElements()) { labels.add(((String)o));
|
||||||
|
* } }}}
|
||||||
|
*/
|
||||||
|
for (Object o : labelsViewer.getCheckedElements()) {
|
||||||
|
labels.add(((String) o));
|
||||||
|
}
|
||||||
|
query.setAttribute("labels", StringUtils.join(labels, ","));
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean updateLabels() {
|
||||||
|
if (labelsViewer == null)
|
||||||
|
return false;
|
||||||
|
if (labelsViewer.getControl().isDisposed())
|
||||||
|
return false;
|
||||||
|
boolean hasLabels = false;
|
||||||
|
GiteaConnection connection = ConnectionManager.getSafe(getTaskRepository());
|
||||||
|
if (connection != null) {
|
||||||
|
List<io.gitea.model.Label> labels = connection.getLabels();
|
||||||
|
// Collections.sort(labels, Comparator.comparing(
|
||||||
|
// io.gitea.model.Label::getName, String.CASE_INSENSITIVE_ORDER));
|
||||||
|
hasLabels = !labels.isEmpty();
|
||||||
|
List<String> allLabelsNames = new ArrayList<String>();
|
||||||
|
|
||||||
|
labels.forEach((label) -> allLabelsNames.add(label.getName()));
|
||||||
|
labelsViewer.setInput(allLabelsNames);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO: filter labels by issue types and priorities {{{ List<String>
|
||||||
|
* issueTypesNames = IssueType.getAllIssueType(allLabelsNames); List<String>
|
||||||
|
* prioritiesNames = GiteaPriorityLevel.getAllPriorityLabels(allLabelsNames);
|
||||||
|
* List<String> otherLabelsNames = new ArrayList<String>();
|
||||||
|
* allLabelsNames.forEach((label) -> { if ((!prioritiesNames.contains(label))
|
||||||
|
* &&(!issueTypesNames.contains(label))) otherLabelsNames.add(label); });
|
||||||
|
*
|
||||||
|
* labelsViewer.setInput(otherLabelsNames);
|
||||||
|
* prioritiesViewer.setInput(prioritiesNames);
|
||||||
|
* issueTypesViewer.setInput(issueTypesNames); }}}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// When coming from existing query, update the dialog to reflect query ...
|
||||||
|
IRepositoryQuery query = getQuery();
|
||||||
|
if (query != null) {
|
||||||
|
List<String> labelsInQuery = new ArrayList<String>();
|
||||||
|
Arrays.asList(query.getAttribute("labels").split(",")).forEach((label) -> {
|
||||||
|
if (label.trim().length() > 0)
|
||||||
|
labelsInQuery.add(label.trim());
|
||||||
|
});
|
||||||
|
List<String> labelsToCheck = new ArrayList<String>();
|
||||||
|
/*
|
||||||
|
* TODO: filter labels by issue types and priority {{{ List<String>
|
||||||
|
* priorityToCheck = new ArrayList<String>(); List<String> issueTypeToCheck =
|
||||||
|
* new ArrayList<String>(); }}}
|
||||||
|
*/
|
||||||
|
List<String> labelToGreyed = new ArrayList<String>();
|
||||||
|
labelsInQuery.forEach((label) -> {
|
||||||
|
if (allLabelsNames.contains(label))
|
||||||
|
labelsToCheck.add(label);
|
||||||
|
/*
|
||||||
|
* TODO: filter labels by issue types or priorities {{{ if
|
||||||
|
* (prioritiesNames.contains(label)) priorityToCheck.add(label); else if
|
||||||
|
* (otherLabelsNames.contains(label)) labelsToCheck.add(label); else
|
||||||
|
* labelToGreyed.add(label); }}}
|
||||||
|
*/
|
||||||
|
});
|
||||||
|
|
||||||
|
labelsViewer.setCheckedElements(labelsToCheck.toArray());
|
||||||
|
refreshLabelsText();
|
||||||
|
/*
|
||||||
|
* TODO: filter labels by issue types or priorities {{{
|
||||||
|
* prioritiesViewer.setCheckedElements(labelsToCheck.toArray()); }}}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// labelsViewer.setGrayedElements(labelsToGreyed.toArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hasLabels;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean updateMilestones() {
|
||||||
|
if (milestoneCombo.isDisposed())
|
||||||
|
return false;
|
||||||
|
boolean hasMilestones = false;
|
||||||
|
GiteaConnection connection = ConnectionManager.getSafe(getTaskRepository());
|
||||||
|
if (connection != null) {
|
||||||
|
List<Milestone> milestones = connection.getMilestones();
|
||||||
|
hasMilestones = !milestones.isEmpty();
|
||||||
|
milestoneCombo.removeAll();
|
||||||
|
// Collections.sort(milestones, Comparator.comparing(
|
||||||
|
// Milestone::getTitle, String.CASE_INSENSITIVE_ORDER));
|
||||||
|
milestoneCombo.add("");
|
||||||
|
for (Milestone s : milestones) {
|
||||||
|
milestoneCombo.add(s.getTitle());
|
||||||
|
}
|
||||||
|
milestoneCombo.select(0);
|
||||||
|
}
|
||||||
|
return hasMilestones;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean updateAssigned() throws ApiException {
|
||||||
|
boolean hasAssigned = false;
|
||||||
|
if (labelsViewer == null)
|
||||||
|
return false;
|
||||||
|
if (labelsViewer.getControl().isDisposed())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
GiteaConnection connection = ConnectionManager.getSafe(getTaskRepository());
|
||||||
|
if (connection != null) {
|
||||||
|
IRepositoryQuery query = getQuery();
|
||||||
|
List<String> usersNames = new ArrayList<String>();
|
||||||
|
connection.repoListAllCollaborators().forEach((user) -> usersNames.add(GiteaUser.getName(user)));
|
||||||
|
|
||||||
|
List<String> assignedInQuery = new ArrayList<String>();
|
||||||
|
Arrays.asList(query.getAttribute("assignee").split(",")).forEach((assignee) -> {
|
||||||
|
if (assignee.trim().length() > 0)
|
||||||
|
assignedInQuery.add(assignee.trim());
|
||||||
|
});
|
||||||
|
List<String> assignedList = new ArrayList<String>();
|
||||||
|
usersNames.forEach((assignee) -> {
|
||||||
|
if (assignedInQuery.contains(assignee))
|
||||||
|
assignedList.add(assignee);
|
||||||
|
});
|
||||||
|
assignedViewer.setInput(usersNames);
|
||||||
|
assignedViewer.setCheckedElements(assignedList.toArray());
|
||||||
|
}
|
||||||
|
return hasAssigned;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshRepository() {
|
||||||
|
try {
|
||||||
|
ICoreRunnable runnable = new ICoreRunnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
|
Policy.monitorFor(monitor);
|
||||||
|
monitor.beginTask("", 3); //$NON-NLS-1$
|
||||||
|
GiteaConnection connection = ConnectionManager.getSafe(getTaskRepository());
|
||||||
|
|
||||||
|
monitor.setTaskName(Messages.MylynGiteaUIQueryPage_LoadingLabels);
|
||||||
|
connection.refreshLabels();
|
||||||
|
monitor.worked(1);
|
||||||
|
|
||||||
|
monitor.setTaskName(Messages.MylynGiteaUIQueryPage_LoadingMembers);
|
||||||
|
connection.refreshMembers();
|
||||||
|
monitor.worked(1);
|
||||||
|
|
||||||
|
monitor.setTaskName(Messages.MylynGiteaUIQueryPage_LoadingMilestones);
|
||||||
|
connection.refreshMilestones();
|
||||||
|
monitor.done();
|
||||||
|
|
||||||
|
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
updateLabels();
|
||||||
|
updateMilestones();
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
IRunnableContext context = getContainer();
|
||||||
|
if (context == null)
|
||||||
|
if (inSearchContainer())
|
||||||
|
context = getSearchContainer().getRunnableContext();
|
||||||
|
else
|
||||||
|
context = PlatformUI.getWorkbench().getProgressService();
|
||||||
|
CommonUiUtil.run(context, runnable);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
IStatus status = e.getStatus();
|
||||||
|
ErrorDialog.openError(getShell(), Messages.MylynGiteaUIQueryPage_ErrorLoading, e.getLocalizedMessage(),
|
||||||
|
status);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
// Copyright (c) 2021, Fr.Terrot. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package io.gitea.mylyn.ui;
|
||||||
|
|
||||||
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
|
public class Messages extends NLS {
|
||||||
|
private static final String BUNDLE_NAME = "io.gitea.mylyn.ui.messages"; //$NON-NLS-1$
|
||||||
|
public static String MylynGiteaUIQueryPage_TooltipUpdateRepository;
|
||||||
|
public static String MylynGiteaUIQueryPage_ErrorLoading;
|
||||||
|
public static String MylynGiteaUIQueryPage_LoadingLabels;
|
||||||
|
public static String MylynGiteaUIQueryPage_LoadingMilestones;
|
||||||
|
public static String MylynGiteaUIQueryPage_LoadingMembers;
|
||||||
|
static {
|
||||||
|
// initialize resource bundle
|
||||||
|
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Messages() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
MylynGiteaUIQueryPage_TooltipUpdateRepository=Update milestones, labels and team members
|
||||||
|
MylynGiteaUIQueryPage_ErrorLoading=Error loading labels and milestones
|
||||||
|
MylynGiteaUIQueryPage_TaskLoadingLabels=Loading labels...
|
||||||
|
MylynGiteaUIQueryPage_TaskLoadingMilestones=Loading Milestones...
|
||||||
|
MylynGiteaUIQueryPage_TaskLoadingMembers=Loading team members...
|
Loading…
Reference in New Issue