-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement JavaClassChooserMultipleComponentBuilder
- Loading branch information
1 parent
cc38662
commit fdfdc8e
Showing
3 changed files
with
85 additions
and
0 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
58 changes: 58 additions & 0 deletions
58
...g/jboss/forge/plugin/idea/ui/component/many/JavaClassChooserMultipleComponentBuilder.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,58 @@ | ||
/* | ||
* Copyright 2014 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.jboss.forge.plugin.idea.ui.component.many; | ||
|
||
import org.jboss.forge.addon.ui.hints.InputType; | ||
import org.jboss.forge.addon.ui.input.InputComponent; | ||
import org.jboss.forge.addon.ui.input.UIInputMany; | ||
import org.jboss.forge.plugin.idea.ui.component.ComponentBuilder; | ||
import org.jboss.forge.plugin.idea.ui.component.ForgeComponent; | ||
import org.jboss.forge.plugin.idea.util.ForgeProxies; | ||
import org.jboss.forge.plugin.idea.util.IDEUtil; | ||
|
||
/** | ||
* @author Adam Wyłuda | ||
*/ | ||
public class JavaClassChooserMultipleComponentBuilder extends ComponentBuilder | ||
{ | ||
@Override | ||
public ForgeComponent build(InputComponent<?, Object> input) | ||
{ | ||
return new ListComponent(ForgeProxies.proxyTo(UIInputMany.class, input)) | ||
{ | ||
@Override | ||
protected String editSelectedItem(String item) | ||
{ | ||
return IDEUtil.chooseClass(context, item); | ||
} | ||
|
||
@Override | ||
protected String findItemToAdd() | ||
{ | ||
return IDEUtil.chooseClass(context, ""); | ||
} | ||
}; | ||
} | ||
|
||
@Override | ||
protected Class<?> getProducedType() | ||
{ | ||
return String.class; | ||
} | ||
|
||
@Override | ||
protected String getSupportedInputType() | ||
{ | ||
return InputType.JAVA_CLASS_PICKER; | ||
} | ||
|
||
@Override | ||
protected Class<?>[] getSupportedInputComponentTypes() | ||
{ | ||
return new Class<?>[]{UIInputMany.class}; | ||
} | ||
} |
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