Skip to content

Commit

Permalink
Remove ForgeProxies
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-wyluda committed Jul 30, 2014
1 parent d58c65c commit 02fcab5
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.jboss.forge.addon.ui.util.InputComponents;
import org.jboss.forge.furnace.proxy.Proxies;
import org.jboss.forge.plugin.idea.service.ForgeService;
import org.jboss.forge.plugin.idea.util.ForgeProxies;

import javax.swing.*;
import java.awt.*;
Expand All @@ -39,7 +38,7 @@ public void buildUI(Container container)
{
final ConverterFactory converterFactory = ForgeService.getInstance()
.getConverterFactory();
final UISelectOne<Object> selectOne = ForgeProxies.proxyTo(UISelectOne.class, input);
final UISelectOne<Object> selectOne = (UISelectOne) input;
final Converter<Object, String> converter = (Converter<Object, String>) InputComponents
.getItemLabelConverter(converterFactory, selectOne);
final DefaultComboBoxModel model = new DefaultComboBoxModel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.jboss.forge.plugin.idea.service.ForgeService;
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 javax.swing.*;
import java.awt.*;
Expand All @@ -43,7 +42,7 @@ public ForgeComponent build(final InputComponent<?, Object> input)
@Override
public void buildUI(Container container)
{
final UISelectMany inputMany = ForgeProxies.proxyTo(UISelectMany.class, input);
final UISelectMany inputMany = (UISelectMany) input;

final ConverterFactory converterFactory = ForgeService.getInstance().getConverterFactory();
Converter<Object, String> converter = InputComponents.getItemLabelConverter(converterFactory, inputMany);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
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;

import java.io.File;
Expand All @@ -25,7 +24,7 @@ public class DirectoryChooserMultipleComponentBuilder extends ComponentBuilder
@Override
public ForgeComponent build(InputComponent<?, Object> input)
{
return new ListComponent(ForgeProxies.proxyTo(UIInputMany.class, input))
return new ListComponent((UIInputMany) input)
{
@Override
protected String editSelectedItem(String item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
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;

import java.io.File;
Expand All @@ -25,7 +24,7 @@ public class FileChooserMultipleComponentBuilder extends ComponentBuilder
@Override
public ForgeComponent build(InputComponent<?, Object> input)
{
return new ListComponent(ForgeProxies.proxyTo(UIInputMany.class, input))
return new ListComponent((UIInputMany) input)
{
@Override
protected String editSelectedItem(String item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
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;

/**
Expand All @@ -22,7 +21,7 @@ public class JavaClassChooserMultipleComponentBuilder extends ComponentBuilder
@Override
public ForgeComponent build(InputComponent<?, Object> input)
{
return new ListComponent(ForgeProxies.proxyTo(UIInputMany.class, input))
return new ListComponent((UIInputMany) input)
{
@Override
protected String editSelectedItem(String item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
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;

/**
Expand All @@ -23,7 +22,7 @@ public class TextBoxMultipleComponentBuilder extends ComponentBuilder
@Override
public ForgeComponent build(final InputComponent<?, Object> input)
{
return new ListComponent(ForgeProxies.proxyTo(UIInputMany.class, input))
return new ListComponent((UIInputMany) input)
{
@Override
protected String editSelectedItem(String item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,15 @@ public class CompletionUtil
{
public static boolean hasCompletions(InputComponent input)
{
HasCompleter hasCompleter = getHasCompleter(input);
HasCompleter hasCompleter = (HasCompleter) input;
return hasCompleter != null && hasCompleter.getCompleter() != null;
}

public static HasCompleter getHasCompleter(InputComponent input)
{
return ForgeProxies.proxyTo(HasCompleter.class, input);
}

public static List<String> getCompletions(ConverterFactory converterFactory, UIContext context,
InputComponent input, String text)
{
List<String> result = new ArrayList<>();
UICompleter completer = getHasCompleter(input).getCompleter();
UICompleter completer = ((HasCompleter) input).getCompleter();
Converter converter = converterFactory.getConverter(input.getValueType(), String.class);

Iterable proposals = completer.getCompletionProposals(context, input, text);
Expand Down
44 changes: 0 additions & 44 deletions src/main/java/org/jboss/forge/plugin/idea/util/ForgeProxies.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static void openSelection(UIContext context)
{
Project project = projectFromContext(context);

FileResource resource = ForgeProxies.proxyTo(FileResource.class, context.getSelection());
FileResource resource = (FileResource) context.getSelection();

if (resource != null)
{
Expand Down

0 comments on commit 02fcab5

Please sign in to comment.