use of org.eclipse.jface.viewers.CheckStateChangedEvent in project janrufmonitor by tbrandt77.
the class UpdatesPage method createControl.
public void createControl(Composite c) {
Composite select = new Composite(c, SWT.NONE);
select.setLayout(new GridLayout(1, false));
select.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label ln = new Label(select, SWT.LEFT);
ln.setText(this.m_i18n.getString(this.getNamespace(), "updates", "label", this.m_language));
updates = CheckboxTableViewer.newCheckList(select, SWT.FULL_SELECTION | SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
updates.setLabelProvider(new UpdateLabelProvider());
updates.setContentProvider(new UpdateContentProvider());
updates.getTable().setHeaderVisible(true);
TableColumn col = new TableColumn(updates.getTable(), SWT.LEFT | SWT.TOP);
col.setWidth(200);
col.setText(this.m_i18n.getString(this.getNamespace(), "modname", "label", this.m_language));
col = new TableColumn(updates.getTable(), SWT.LEFT | SWT.TOP);
col.setWidth(50);
col.setText(this.m_i18n.getString(this.getNamespace(), "currentversion", "label", this.m_language));
col = new TableColumn(updates.getTable(), SWT.LEFT | SWT.TOP);
col.setWidth(50);
col.setText(this.m_i18n.getString(this.getNamespace(), "newversion", "label", this.m_language));
// col = new TableColumn(updates.getTable(), SWT.LEFT | SWT.TOP);
// col.setWidth(350);
Listener paintListener = new Listener() {
public void handleEvent(Event event) {
if (event.index != 3)
return;
switch(event.type) {
case SWT.MeasureItem:
{
TableItem item = (TableItem) event.item;
String text = item.getText(event.index);
Point size = event.gc.textExtent(text);
event.width = size.x;
event.height = Math.max(event.height, size.y + 7);
break;
}
case SWT.PaintItem:
{
TableItem item = (TableItem) event.item;
String text = item.getText(event.index);
Point size = event.gc.textExtent(text);
int offset2 = (event.index == 0 ? Math.max(0, (event.height - size.y) / 2) : 0) + 3;
event.gc.drawText(text, event.x + offset2, event.y + offset2, true);
break;
}
case SWT.EraseItem:
{
event.detail &= ~SWT.FOREGROUND;
break;
}
}
}
};
updates.getTable().addListener(SWT.MeasureItem, paintListener);
updates.getTable().addListener(SWT.PaintItem, paintListener);
updates.getTable().addListener(SWT.EraseItem, paintListener);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 220;
// gd.minimumWidth = 490;
gd.grabExcessHorizontalSpace = true;
updates.getTable().setLayoutData(gd);
updates.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent e) {
Object[] o = updates.getCheckedElements();
setPageComplete(o.length > 0);
}
});
final Button refresh = new Button(select, SWT.PUSH);
refresh.setText(this.m_i18n.getString(this.getNamespace(), "refresh", "label", this.m_language));
refresh.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent ev) {
try {
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor pm) throws InvocationTargetException, InterruptedException {
pm.setTaskName(m_i18n.getString(getNamespace(), "task", "label", m_language));
final List l = m_um.getUpdates();
DisplayManager.getDefaultDisplay().asyncExec(new Runnable() {
public void run() {
updates.setInput(l);
updates.refresh(true);
}
});
if (l.size() == 0) {
DisplayManager.getDefaultDisplay().asyncExec(new Runnable() {
public void run() {
MessageDialog.openInformation(getShell(), "", m_i18n.getString(getNamespace(), "noupdates", "label", m_language));
}
});
}
}
};
ProgressMonitorDialog pmd = new ProgressMonitorDialog(getShell());
pmd.run(true, true, op);
} catch (InvocationTargetException e) {
m_logger.log(Level.SEVERE, e.getMessage(), e);
} catch (InterruptedException e) {
m_logger.log(Level.SEVERE, e.getMessage(), e);
}
}
});
ln = new Label(select, SWT.LEFT | SWT.WRAP);
ln.setText(this.m_i18n.getString(this.getNamespace(), "updates", "description", this.m_language));
gd = new GridData(480, 50);
gd.horizontalSpan = 2;
gd.minimumWidth = 480;
ln.setLayoutData(gd);
this.setControl(c);
if (this.m_preload) {
try {
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor pm) throws InvocationTargetException, InterruptedException {
pm.setTaskName(m_i18n.getString(getNamespace(), "task", "label", m_language));
final List l = m_um.getUpdates();
DisplayManager.getDefaultDisplay().asyncExec(new Runnable() {
public void run() {
updates.setInput(l);
updates.refresh(true);
}
});
if (l.size() == 0) {
DisplayManager.getDefaultDisplay().asyncExec(new Runnable() {
public void run() {
MessageDialog.openInformation(getShell(), "", m_i18n.getString(getNamespace(), "noupdates", "label", m_language));
}
});
}
}
};
ProgressMonitorDialog pmd = new ProgressMonitorDialog(getShell());
pmd.run(false, true, op);
} catch (InvocationTargetException e) {
this.m_logger.log(Level.SEVERE, e.getMessage(), e);
} catch (InterruptedException e) {
this.m_logger.log(Level.SEVERE, e.getMessage(), e);
}
}
}
use of org.eclipse.jface.viewers.CheckStateChangedEvent in project janrufmonitor by tbrandt77.
the class RuleAssistent method createContents.
protected Control createContents(Composite parent) {
this.setTitle(this.m_i18n.getString(this.getNamespace(), "title", "label", this.m_language));
this.noDefaultAndApplyButton();
Composite c = new Composite(parent, SWT.NONE);
c.setLayout(new GridLayout(1, false));
Label l = new Label(c, SWT.NONE);
l.setText(this.m_i18n.getString(this.NAMESPACE, "available", "label", this.m_language));
cl = CheckboxTableViewer.newCheckList(c, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL);
cl.setLabelProvider(new RuleLabelProvider());
cl.setContentProvider(new RuleContentProvider());
List rules = this.getRules();
cl.setInput(rules);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.heightHint = 100;
cl.getTable().setLayoutData(gd);
IRule rule = null;
for (int i = 0; i < rules.size(); i++) {
rule = (IRule) rules.get(i);
cl.setChecked(rule, rule.isActive());
}
cl.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
boolean checked = event.getChecked();
IRule rule = (IRule) event.getElement();
rule.setActive(checked);
}
});
Composite buttonGroup = new Composite(c, SWT.NONE);
buttonGroup.setLayout(new GridLayout(4, false));
Button newButton = new Button(buttonGroup, SWT.PUSH);
newButton.setText(this.m_i18n.getString(this.NAMESPACE, "new", "label", this.m_language));
newButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
openRuleWizard(null);
IRule rule = null;
List rules = getRules();
for (int i = 0; i < rules.size(); i++) {
rule = (IRule) rules.get(i);
cl.setChecked(rule, rule.isActive());
}
}
});
final Button changeButton = new Button(buttonGroup, SWT.PUSH);
changeButton.setText(this.m_i18n.getString(this.NAMESPACE, "change", "label", this.m_language));
changeButton.setEnabled(false);
changeButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
StructuredSelection s = (StructuredSelection) cl.getSelection();
if (!s.isEmpty()) {
IRule rule = (IRule) s.getFirstElement();
openRuleWizard(rule);
IRule r = null;
List rules = getRules();
for (int i = 0; i < rules.size(); i++) {
r = (IRule) rules.get(i);
cl.setChecked(r, r.isActive());
}
}
}
});
final Button copyButton = new Button(buttonGroup, SWT.PUSH);
copyButton.setText(this.m_i18n.getString(this.NAMESPACE, "copy", "label", this.m_language));
copyButton.setEnabled(false);
copyButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
StructuredSelection s = (StructuredSelection) cl.getSelection();
if (!s.isEmpty()) {
if (MessageDialog.openConfirm(e.display.getActiveShell(), m_i18n.getString(NAMESPACE, "copytitle", "label", m_language), m_i18n.getString(NAMESPACE, "copyconfirmation", "label", m_language))) {
List ruleList = s.toList();
IRule r = null;
IRule copiedRule = null;
for (int i = 0; i < ruleList.size(); i++) {
r = (IRule) ruleList.get(i);
copiedRule = getRuntime().getRuleEngine().createRule(r.toString());
copiedRule.setName(m_i18n.getString(NAMESPACE, "copyof", "label", m_language) + r.getName());
m_rules.add(copiedRule);
cl.add(copiedRule);
cl.setChecked(copiedRule, copiedRule.isActive());
}
cl.refresh();
}
}
}
});
final Button deleteButton = new Button(buttonGroup, SWT.PUSH);
deleteButton.setText(this.m_i18n.getString(this.NAMESPACE, "delete", "label", this.m_language));
deleteButton.setEnabled(false);
deleteButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
StructuredSelection s = (StructuredSelection) cl.getSelection();
if (!s.isEmpty()) {
if (MessageDialog.openConfirm(e.display.getActiveShell(), m_i18n.getString(NAMESPACE, "deletetitle", "label", m_language), m_i18n.getString(NAMESPACE, "deleteconfirmation", "label", m_language))) {
Object o = s.getFirstElement();
cl.remove(o);
m_rules.remove(o);
cl.refresh();
}
}
}
});
l = new Label(c, SWT.NONE);
l.setText(this.m_i18n.getString(this.NAMESPACE, "ruledesc", "label", this.m_language));
final Text ruleAsText = new Text(c, SWT.BORDER | SWT.WRAP);
ruleAsText.setLayoutData(new GridData(GridData.FILL_BOTH));
ruleAsText.setEditable(false);
cl.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
StructuredSelection selected = (StructuredSelection) event.getSelection();
if (selected.isEmpty()) {
deleteButton.setEnabled(false);
changeButton.setEnabled(false);
copyButton.setEnabled(false);
} else {
deleteButton.setEnabled(true);
changeButton.setEnabled(true);
copyButton.setEnabled(true);
}
IRule rule = (IRule) selected.getFirstElement();
ruleAsText.setText(createDescription(rule));
}
});
return c;
}
use of org.eclipse.jface.viewers.CheckStateChangedEvent in project n4js by eclipse.
the class WorkingSetConfigurationDialog method createTableViewer.
private void createTableViewer(final Composite parent) {
tableViewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER | SWT.MULTI);
tableViewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(final CheckStateChangedEvent event) {
syncSelectionAndButtonStates();
}
});
final GridData data = new GridData(GridData.FILL_BOTH);
data.heightHint = convertHeightInCharsToPixels(20);
data.widthHint = convertWidthInCharsToPixels(50);
tableViewer.getTable().setLayoutData(data);
tableViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(WorkingSetLabelProvider.INSTANCE));
tableViewer.setContentProvider(ArrayContentProvider.getInstance());
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(final SelectionChangedEvent event) {
handleSelectionChanged();
}
});
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(final DoubleClickEvent event) {
if (editButton != null && editButton.isEnabled()) {
editSelectedWorkingSet();
}
}
});
}
use of org.eclipse.jface.viewers.CheckStateChangedEvent in project dsl-devkit by dsldevkit.
the class ValidPreferenceCheckedTreeViewer method initViewer.
/**
* Initialize the tree viewer.
*/
private void initViewer() {
setUseHashlookup(true);
addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(final CheckStateChangedEvent event) {
doCheckStateChanged(event.getElement());
}
});
addTreeListener(new ITreeViewerListener() {
@Override
public void treeCollapsed(final TreeExpansionEvent event) {
// nothing to do here
}
@Override
public void treeExpanded(final TreeExpansionEvent event) {
final Widget item = findItem(event.getElement());
if (item instanceof TreeItem) {
initializeItem((TreeItem) item);
}
}
});
}
use of org.eclipse.jface.viewers.CheckStateChangedEvent in project egit by eclipse.
the class ExistingOrNewPage method createControl.
@Override
public void createControl(Composite parent) {
final RepositoryUtil util = Activator.getDefault().getRepositoryUtil();
Composite main = new Composite(parent, SWT.NONE);
// use zero spacing to save some real estate here
GridLayoutFactory.fillDefaults().spacing(0, 0).applyTo(main);
final Button internalModeButton = new Button(main, SWT.CHECK);
internalModeButton.setText(UIText.ExistingOrNewPage_InternalModeCheckbox);
internalModeButton.setToolTipText(UIText.ExistingOrNewPage_CreationInWorkspaceWarningTooltip);
internalModeButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
internalMode = internalModeButton.getSelection();
updateControls();
}
});
externalComposite = new Composite(main, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, true).applyTo(externalComposite);
externalComposite.setLayout(new GridLayout(3, false));
new Label(externalComposite, SWT.NONE).setText(UIText.ExistingOrNewPage_ExistingRepositoryLabel);
final Combo existingRepoCombo = new Combo(externalComposite, SWT.READ_ONLY);
GridDataFactory.fillDefaults().grab(true, false).applyTo(existingRepoCombo);
final ComboViewer v = new ComboViewer(existingRepoCombo);
v.setContentProvider(new RepoComboContentProvider());
v.setLabelProvider(new RepoComboLabelProvider());
v.setInput(new Object());
// the default ViewerSorter seems to do the right thing
// i.e. sort as String
v.setComparator(new ViewerComparator());
existingRepoCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
selectedRepository = null;
IStructuredSelection sel = (IStructuredSelection) v.getSelection();
setRepository((Repository) sel.getFirstElement());
updateControls();
}
});
Button createRepoWizard = new Button(externalComposite, SWT.PUSH);
createRepoWizard.setText(UIText.ExistingOrNewPage_CreateRepositoryButton);
createRepoWizard.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
NewRepositoryWizard wiz = new NewRepositoryWizard(true);
if (new WizardDialog(getShell(), wiz).open() == Window.OK) {
v.refresh();
selectedRepository = wiz.getCreatedRepository();
v.setSelection(new StructuredSelection(selectedRepository));
updateControls();
}
}
});
new Label(externalComposite, SWT.NONE).setText(UIText.ExistingOrNewPage_WorkingDirectoryLabel);
workDir = new Text(externalComposite, SWT.BORDER | SWT.READ_ONLY);
GridDataFactory.fillDefaults().grab(true, false).applyTo(workDir);
GridDataFactory.fillDefaults().applyTo(workDir);
// leave the space between the "Create" and "Browse" buttons empty (i.e.
// do not fill to the right border
new Label(externalComposite, SWT.NONE);
new Label(externalComposite, SWT.NONE).setText(UIText.ExistingOrNewPage_RelativePathLabel);
relPath = new Text(externalComposite, SWT.BORDER);
relPath.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
updateControls();
}
});
GridDataFactory.fillDefaults().grab(true, false).applyTo(relPath);
browseRepository = new Button(externalComposite, SWT.PUSH);
browseRepository.setEnabled(false);
browseRepository.setText(UIText.ExistingOrNewPage_BrowseRepositoryButton);
browseRepository.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dlg = new DirectoryDialog(getShell());
dlg.setMessage(UIText.ExistingOrNewPage_title);
dlg.setFilterPath(selectedRepository.getWorkTree().getPath());
String directory = dlg.open();
if (directory != null) {
setRelativePath(directory);
updateControls();
}
}
});
Table projectMoveTable = new Table(externalComposite, SWT.MULTI | SWT.FULL_SELECTION | SWT.CHECK | SWT.BORDER);
projectMoveViewer = new CheckboxTableViewer(projectMoveTable);
GridDataFactory.fillDefaults().span(3, 1).grab(true, true).applyTo(projectMoveTable);
TableColumn tc;
tc = new TableColumn(projectMoveTable, SWT.NONE);
tc.setText(UIText.ExistingOrNewPage_ProjectNameColumnHeader);
tc.setWidth(100);
tc = new TableColumn(projectMoveTable, SWT.NONE);
tc.setText(UIText.ExistingOrNewPage_CurrentLocationColumnHeader);
tc.setWidth(250);
tc = new TableColumn(projectMoveTable, SWT.NONE);
tc.setText(UIText.ExistingOrNewPage_NewLocationTargetHeader);
tc.setWidth(350);
projectMoveTable.setHeaderVisible(true);
projectMoveViewer.setContentProvider(ArrayContentProvider.getInstance());
projectMoveViewer.setLabelProvider(moveProjectsLabelProvider);
projectMoveViewer.setInput(myWizard.projects);
projectMoveViewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
updateControls();
}
});
TableItem[] children = projectMoveViewer.getTable().getItems();
for (int i = 0; i < children.length; i++) {
TableItem item = children[i];
IProject data = (IProject) item.getData();
RepositoryFinder repositoryFinder = new RepositoryFinder(data);
repositoryFinder.setFindInChildren(false);
try {
Collection<RepositoryMapping> find = repositoryFinder.find(new NullProgressMonitor());
if (find.size() != 1)
item.setChecked(true);
} catch (CoreException e1) {
item.setText(2, e1.getMessage());
}
}
parentRepoComposite = new Composite(main, SWT.NONE);
parentRepoComposite.setLayout(new GridLayout(3, false));
GridDataFactory.fillDefaults().grab(true, true).applyTo(parentRepoComposite);
tree = new Tree(parentRepoComposite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.CHECK);
viewer = new CheckboxTreeViewer(tree);
tree.setHeaderVisible(true);
tree.setLayout(new GridLayout());
tree.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(3, 1).create());
viewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
if (event.getChecked()) {
ProjectAndRepo checkable = (ProjectAndRepo) event.getElement();
for (TreeItem ti : tree.getItems()) {
if (ti.getItemCount() > 0 || ((ProjectAndRepo) ti.getData()).getRepo().equals(// $NON-NLS-1$
""))
ti.setChecked(false);
for (TreeItem subTi : ti.getItems()) {
IProject project = ((ProjectAndRepo) subTi.getData()).getProject();
if (checkable.getProject() != null && !subTi.getData().equals(checkable) && checkable.getProject().equals(project))
subTi.setChecked(false);
}
}
}
}
});
TreeColumn c1 = new TreeColumn(tree, SWT.NONE);
c1.setText(UIText.ExistingOrNewPage_HeaderProject);
c1.setWidth(100);
TreeColumn c2 = new TreeColumn(tree, SWT.NONE);
c2.setText(UIText.ExistingOrNewPage_HeaderLocation);
c2.setWidth(400);
TreeColumn c3 = new TreeColumn(tree, SWT.NONE);
c3.setText(UIText.ExistingOrNewPage_HeaderRepository);
c3.setWidth(200);
boolean allProjectsInExistingRepos = true;
for (IProject project : myWizard.projects) {
RepositoryFinder repositoryFinder = new RepositoryFinder(project);
repositoryFinder.setFindInChildren(false);
try {
Collection<RepositoryMapping> mappings;
mappings = repositoryFinder.find(new NullProgressMonitor());
Iterator<RepositoryMapping> mi = mappings.iterator();
RepositoryMapping m = mi.hasNext() ? mi.next() : null;
if (m == null) {
// no mapping found, enable repository creation
TreeItem treeItem = new TreeItem(tree, SWT.NONE);
updateProjectTreeItem(treeItem, project);
treeItem.setText(1, project.getLocation().toOSString());
// $NON-NLS-1$
treeItem.setText(2, "");
// $NON-NLS-1$
treeItem.setData(new ProjectAndRepo(project, ""));
allProjectsInExistingRepos = false;
} else if (!mi.hasNext()) {
// exactly one mapping found
IPath path = m.getGitDirAbsolutePath();
if (path != null) {
TreeItem treeItem = new TreeItem(tree, SWT.NONE);
updateProjectTreeItem(treeItem, project);
treeItem.setText(1, project.getLocation().toOSString());
fillTreeItemWithGitDirectory(m, treeItem, path, false);
treeItem.setData(new ProjectAndRepo(project, path.toOSString()));
treeItem.setChecked(true);
}
} else {
IPath path = m.getGitDirAbsolutePath();
if (path != null) {
TreeItem treeItem = new TreeItem(tree, SWT.NONE);
updateProjectTreeItem(treeItem, project);
treeItem.setText(1, project.getLocation().toOSString());
// $NON-NLS-1$
treeItem.setData(new ProjectAndRepo(project, ""));
TreeItem treeItem2 = new TreeItem(treeItem, SWT.NONE);
updateProjectTreeItem(treeItem2, project);
fillTreeItemWithGitDirectory(m, treeItem2, path, true);
treeItem2.setData(new ProjectAndRepo(project, path.toOSString()));
while (mi.hasNext()) {
// fill in additional mappings
m = mi.next();
path = m.getGitDirAbsolutePath();
if (path != null) {
treeItem2 = new TreeItem(treeItem, SWT.NONE);
updateProjectTreeItem(treeItem2, project);
fillTreeItemWithGitDirectory(m, treeItem2, path, true);
treeItem2.setData(new ProjectAndRepo(m.getContainer().getProject(), path.toOSString()));
}
}
treeItem.setExpanded(true);
}
allProjectsInExistingRepos = false;
}
} catch (CoreException e) {
TreeItem treeItem2 = new TreeItem(tree, SWT.BOLD | SWT.ITALIC);
treeItem2.setText(e.getMessage());
}
}
createRepo = new Button(parentRepoComposite, SWT.PUSH);
createRepo.setLayoutData(GridDataFactory.fillDefaults().create());
createRepo.setText(UIText.ExistingOrNewPage_CreateButton);
createRepo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
File gitDir = new File(repositoryToCreate.getText(), Constants.DOT_GIT);
try {
Repository repository = FileRepositoryBuilder.create(gitDir);
repository.create();
for (IProject project : getProjects(false).keySet()) {
//
if (// $NON-NLS-1$
!gitDir.toString().contains(".."))
project.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
}
util.addConfiguredRepository(gitDir);
} catch (IOException e1) {
String msg = NLS.bind(UIText.ExistingOrNewPage_ErrorFailedToCreateRepository, gitDir.toString());
org.eclipse.egit.ui.Activator.handleError(msg, e1, true);
} catch (CoreException e2) {
String msg = NLS.bind(UIText.ExistingOrNewPage_ErrorFailedToRefreshRepository, gitDir);
org.eclipse.egit.ui.Activator.handleError(msg, e2, true);
}
for (TreeItem ti : tree.getSelection()) {
IPath projectPath = new Path(ti.getText(1));
IPath gitPath = new Path(gitDir.toString());
IPath relative = gitPath.makeRelativeTo(projectPath);
ti.setText(2, relative.toOSString());
((ProjectAndRepo) ti.getData()).repo = gitDir.toString();
ti.setChecked(true);
}
updateControls();
}
});
repositoryToCreate = new Text(parentRepoComposite, SWT.SINGLE | SWT.BORDER);
repositoryToCreate.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(1, 1).create());
repositoryToCreate.addListener(SWT.Modify, new Listener() {
@Override
public void handleEvent(Event e) {
if (repositoryToCreate.getText().equals("")) {
// $NON-NLS-1$
createRepo.setEnabled(false);
return;
}
IPath fromOSString = Path.fromOSString(repositoryToCreate.getText());
createRepo.setEnabled(minumumPath.matchingFirstSegments(fromOSString) == fromOSString.segmentCount());
}
});
dotGitSegment = new Label(parentRepoComposite, SWT.NONE);
dotGitSegment.setEnabled(false);
dotGitSegment.setText(File.separatorChar + Constants.DOT_GIT);
dotGitSegment.setLayoutData(GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).create());
tree.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
tree.select((TreeItem) e.item);
updateControls();
}
});
Dialog.applyDialogFont(main);
setControl(main);
if (allProjectsInExistingRepos) {
internalMode = true;
internalModeButton.setSelection(true);
updateControls();
}
}
Aggregations