Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
143 additions
and
68 deletions.
There are no files selected for viewing
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
31 changes: 27 additions & 4 deletions
31
com.dubture.composer.ui/src/com/dubture/composer/ui/controller/PackageController.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 |
---|---|---|
@@ -1,29 +1,52 @@ | ||
package com.dubture.composer.ui.controller; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.jface.viewers.LabelProvider; | ||
import org.eclipse.jface.viewers.Viewer; | ||
import org.eclipse.swt.graphics.Image; | ||
import org.getcomposer.ComposerPackage; | ||
import org.getcomposer.MinimalPackage; | ||
|
||
import com.dubture.composer.ui.ComposerUIPluginImages; | ||
|
||
public class PackageController extends LabelProvider implements ITableController { | ||
|
||
private String[] packages; | ||
private List<MinimalPackage> packages; | ||
protected Image pkgImage = ComposerUIPluginImages.PACKAGE.createImage(); | ||
protected Image phpImage = ComposerUIPluginImages.PHP.createImage(); | ||
|
||
@SuppressWarnings("unchecked") | ||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { | ||
packages = (String[])newInput; | ||
if (newInput == null) { | ||
packages = null; | ||
} else { | ||
packages = (List<MinimalPackage>)newInput; | ||
} | ||
} | ||
|
||
public Object[] getElements(Object inputElement) { | ||
return packages; | ||
if (packages != null) { | ||
return packages.toArray(); | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
public void addPackages(List<ComposerPackage> packages) { | ||
this.packages.addAll(packages); | ||
} | ||
|
||
public Image getColumnImage(Object element, int columnIndex) { | ||
MinimalPackage pkg = (MinimalPackage)element; | ||
if (pkg.getName() == "php") { | ||
return phpImage; | ||
} | ||
return pkgImage; | ||
} | ||
|
||
public String getColumnText(Object element, int columnIndex) { | ||
return (String)element; | ||
MinimalPackage pkg = (MinimalPackage)element; | ||
return pkg.getName(); | ||
} | ||
} |
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
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
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