forked from smilebase/org.eclipse.mylyn.github
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: michael handler <michael.handler@fullstop.at>
- Loading branch information
Showing
6 changed files
with
153 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...yn.github.ui/src/org/eclipse/mylyn/github/ui/internal/editorpart/GitHubIntegerEditor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.eclipse.mylyn.github.ui.internal.editorpart; | ||
|
||
import org.eclipse.mylyn.tasks.core.data.TaskAttribute; | ||
import org.eclipse.mylyn.tasks.core.data.TaskDataModel; | ||
import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor; | ||
import org.eclipse.swt.SWT; | ||
import org.eclipse.swt.widgets.Composite; | ||
import org.eclipse.swt.widgets.Text; | ||
import org.eclipse.ui.forms.widgets.FormToolkit; | ||
|
||
public class GitHubIntegerEditor extends AbstractAttributeEditor { | ||
|
||
public GitHubIntegerEditor(TaskDataModel manager, TaskAttribute taskAttribute) { | ||
super(manager, taskAttribute); | ||
} | ||
|
||
@Override | ||
public void createControl(Composite parent, FormToolkit toolkit) { | ||
Text text = new Text(parent, SWT.FLAT | SWT.READ_ONLY); | ||
toolkit.adapt(text, false, false); | ||
text.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE); | ||
text.setText(getTaskAttribute().getValue()); | ||
setControl(text); | ||
} | ||
|
||
} |
88 changes: 88 additions & 0 deletions
88
...n.github.ui/src/org/eclipse/mylyn/github/ui/internal/editorpart/GitHubTaskEditorPart.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package org.eclipse.mylyn.github.ui.internal.editorpart; | ||
|
||
import org.eclipse.jface.layout.GridDataFactory; | ||
import org.eclipse.mylyn.tasks.core.data.TaskAttribute; | ||
import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor; | ||
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart; | ||
import org.eclipse.swt.layout.GridLayout; | ||
import org.eclipse.swt.widgets.Composite; | ||
import org.eclipse.ui.forms.widgets.ExpandableComposite; | ||
import org.eclipse.ui.forms.widgets.FormToolkit; | ||
import org.eclipse.ui.forms.widgets.Section; | ||
|
||
public class GitHubTaskEditorPart extends AbstractTaskEditorPart { | ||
|
||
@Override | ||
public String getPartName() { | ||
return "GitHub Attributes"; | ||
} | ||
|
||
@Override | ||
public void createControl(Composite parent, FormToolkit toolkit) { | ||
int style = ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ||
| ExpandableComposite.EXPANDED; | ||
|
||
Section section = createSection(parent, toolkit, style); | ||
GridDataFactory.fillDefaults().grab(true, false).applyTo(section); | ||
section.setText("Github Attributes"); | ||
GridDataFactory.fillDefaults().grab(true, false).applyTo(section); | ||
setSection(toolkit, section); | ||
|
||
Composite composite = toolkit.createComposite(section); | ||
GridLayout layout2 = createSectionClientLayout(); | ||
layout2.numColumns = 1; | ||
composite.setLayout(layout2); | ||
|
||
Composite headerComposite = toolkit.createComposite(composite); | ||
GridLayout layout = new GridLayout(1, false); | ||
layout.verticalSpacing = 1; | ||
layout.marginHeight = 0; | ||
layout.marginWidth = 0; | ||
headerComposite.setLayout(layout); | ||
GridDataFactory.fillDefaults().grab(true, false).applyTo(headerComposite); | ||
|
||
TaskAttribute statusAtribute = getTaskData().getRoot().getMappedAttribute( | ||
"task.github.votes"); | ||
addAttribute(headerComposite, toolkit, statusAtribute, 0); | ||
|
||
// ensure layout does not wrap | ||
layout.numColumns = headerComposite.getChildren().length; | ||
|
||
// ensure that the composite does not show a bunch of blank space | ||
if (layout.numColumns == 0) { | ||
layout.numColumns = 1; | ||
toolkit.createLabel(headerComposite, " "); //$NON-NLS-1$ | ||
} | ||
|
||
toolkit.paintBordersFor(composite); | ||
section.setClient(composite); | ||
} | ||
|
||
private GridLayout createSectionClientLayout() { | ||
GridLayout layout = new GridLayout(); | ||
layout.marginHeight = 0; | ||
// leave 1px for borders | ||
layout.marginTop = 2; | ||
// spacing if a section is expanded | ||
layout.marginBottom = 8; | ||
return layout; | ||
} | ||
|
||
private void addAttribute(Composite composite, FormToolkit toolkit, TaskAttribute attribute, | ||
int indent) { | ||
AbstractAttributeEditor editor = createAttributeEditor(attribute); | ||
if (editor != null) { | ||
// having editable controls in the header looks odd | ||
editor.setReadOnly(true); | ||
editor.setDecorationEnabled(false); | ||
|
||
editor.createLabelControl(composite, toolkit); | ||
GridDataFactory.defaultsFor(editor.getLabelControl()).indent(indent, 0).applyTo( | ||
editor.getLabelControl()); | ||
|
||
editor.createControl(composite, toolkit); | ||
getTaskEditorPage().getAttributeEditorToolkit().adapt(editor); | ||
} | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
...i/src/org/eclipse/mylyn/github/ui/internal/editorpart/GitHubTaskEditorPartDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.eclipse.mylyn.github.ui.internal.editorpart; | ||
|
||
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage; | ||
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart; | ||
import org.eclipse.mylyn.tasks.ui.editors.TaskEditorPartDescriptor; | ||
|
||
public class GitHubTaskEditorPartDescriptor extends TaskEditorPartDescriptor { | ||
|
||
public GitHubTaskEditorPartDescriptor() { | ||
super("org.eclipse.mylyn.github.editor.parts.github"); | ||
setPath(AbstractTaskEditorPage.PATH_ATTRIBUTES); | ||
} | ||
|
||
@Override | ||
public AbstractTaskEditorPart createPart() { | ||
return new GitHubTaskEditorPart(); | ||
} | ||
|
||
} |