com.intellij.util.ui.ElementProducer Java Examples

The following examples show how to use com.intellij.util.ui.ElementProducer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TableToolbarDecorator.java    From consulo with Apache License 2.0 6 votes vote down vote up
TableToolbarDecorator(@Nonnull JTable table, @Nullable final ElementProducer<?> producer) {
  myTable = table;
  myProducer = producer;
  myAddActionEnabled = myRemoveActionEnabled = myUpActionEnabled = myDownActionEnabled = isModelEditable();
  if (isModelEditable()) {
    createDefaultTableActions(producer);
  }
  myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
    @Override
    public void valueChanged(ListSelectionEvent e) {
      updateButtons();
    }
  });
  myTable.addPropertyChangeListener("enabled", new PropertyChangeListener() {
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
      updateButtons();
    }
  });
}
 
Example #2
Source File: TreeToolbarDecorator.java    From consulo with Apache License 2.0 6 votes vote down vote up
TreeToolbarDecorator(JTree tree, @Nullable final ElementProducer<?> producer) {
  myTree = tree;
  myProducer = producer;
  myAddActionEnabled = myRemoveActionEnabled = myUpActionEnabled = myDownActionEnabled = myTree.getModel() instanceof EditableTreeModel;
  if (myTree.getModel() instanceof EditableTreeModel) {
    createDefaultTreeActions();
  }
  myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
    @Override
    public void valueChanged(TreeSelectionEvent e) {
      updateButtons();
    }
  });
  myTree.addPropertyChangeListener("enabled", new PropertyChangeListener() {
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
      updateButtons();
    }
  });
}
 
Example #3
Source File: LatteVariableSettingsForm.java    From intellij-latte with MIT License 5 votes vote down vote up
@Nullable
@Override
public JComponent createComponent() {
	ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<LatteVariableSettings>() {
		@Override
		public LatteVariableSettings createElement() {
			//IdeFocusManager.getInstance(TwigSettingsForm.this.project).requestFocus(TwigNamespaceDialog.getWindows(), true);
			return null;
		}

		@Override
		public boolean canCreateElement() {
			return true;
		}
	});

	tablePanel.setEditAction(anActionButton ->
			LatteVariableSettingsForm.this.openVariablePathDialog(LatteVariableSettingsForm.this.tableView.getSelectedObject())
	);

	tablePanel.setAddAction(anActionButton ->
			LatteVariableSettingsForm.this.openVariablePathDialog(null)
	);

	tablePanel.disableUpAction();
	tablePanel.disableDownAction();

	this.panelConfigTableView.add(tablePanel.createPanel());

	return this.panel1;
}
 
Example #4
Source File: LatteCustomFunctionSettingsForm.java    From intellij-latte with MIT License 5 votes vote down vote up
@Nullable
@Override
public JComponent createComponent() {
	ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<LatteFunctionSettings>() {
		@Override
		public LatteFunctionSettings createElement() {
			//IdeFocusManager.getInstance(TwigSettingsForm.this.project).requestFocus(TwigNamespaceDialog.getWindows(), true);
			return null;
		}

		@Override
		public boolean canCreateElement() {
			return true;
		}
	});

	tablePanel.setEditAction(anActionButton ->
			LatteCustomFunctionSettingsForm.this.openFunctionDialog(LatteCustomFunctionSettingsForm.this.tableView.getSelectedObject())
	);

	tablePanel.setAddAction(anActionButton ->
			LatteCustomFunctionSettingsForm.this.openFunctionDialog(null)
	);

	tablePanel.disableUpAction();
	tablePanel.disableDownAction();

	this.panelConfigTableView.add(tablePanel.createPanel());

	return this.panel1;
}
 
Example #5
Source File: LatteCustomMacroSettingsForm.java    From intellij-latte with MIT License 5 votes vote down vote up
@Nullable
@Override
public JComponent createComponent() {
	ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<LatteTagSettings>() {
		@Override
		public LatteTagSettings createElement() {
			//IdeFocusManager.getInstance(TwigSettingsForm.this.project).requestFocus(TwigNamespaceDialog.getWindows(), true);
			return null;
		}

		@Override
		public boolean canCreateElement() {
			return true;
		}
	});

	tablePanel.setEditAction(anActionButton ->
			LatteCustomMacroSettingsForm.this.openMacroDialog(LatteCustomMacroSettingsForm.this.tableView.getSelectedObject())
	);

	tablePanel.setAddAction(anActionButton ->
			LatteCustomMacroSettingsForm.this.openMacroDialog(null)
	);

	tablePanel.disableUpAction();
	tablePanel.disableDownAction();

	this.panelConfigTableView.add(tablePanel.createPanel());

	return this.panel1;
}
 
Example #6
Source File: LatteCustomModifierSettingsForm.java    From intellij-latte with MIT License 5 votes vote down vote up
@Nullable
@Override
public JComponent createComponent() {
	ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<LatteFilterSettings>() {
		@Override
		public LatteFilterSettings createElement() {
			//IdeFocusManager.getInstance(TwigSettingsForm.this.project).requestFocus(TwigNamespaceDialog.getWindows(), true);
			return null;
		}

		@Override
		public boolean canCreateElement() {
			return true;
		}
	});

	tablePanel.setEditAction(anActionButton ->
			LatteCustomModifierSettingsForm.this.openModifierDialog(LatteCustomModifierSettingsForm.this.tableView.getSelectedObject())
	);

	tablePanel.setAddAction(anActionButton ->
			LatteCustomModifierSettingsForm.this.openModifierDialog(null)
	);

	tablePanel.disableUpAction();
	tablePanel.disableDownAction();

	this.panelConfigTableView.add(tablePanel.createPanel());

	return this.panel1;
}
 
Example #7
Source File: MethodSignatureTypeSettingsForm.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
@Nullable
@Override
public JComponent createComponent() {
    ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<MethodSignatureSetting>() {
        @Override
        public MethodSignatureSetting createElement() {
            //IdeFocusManager.getInstance(TwigSettingsForm.this.project).requestFocus(TwigNamespaceDialog.getWindows(), true);
            return null;
        }

        @Override
        public boolean canCreateElement() {
            return true;
        }
    });

    tablePanel.setEditAction(anActionButton ->
        MethodSignatureTypeSettingsForm.this.openTwigPathDialog(MethodSignatureTypeSettingsForm.this.tableView.getSelectedObject())
    );

    tablePanel.setAddAction(anActionButton ->
        MethodSignatureTypeSettingsForm.this.openTwigPathDialog(null)
    );

    tablePanel.disableUpAction();
    tablePanel.disableDownAction();

    this.panelConfigTableView.add(tablePanel.createPanel());

    return this.panel1;
}
 
Example #8
Source File: MethodParameterReferenceSettingsForm.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
@Nullable
@Override
public JComponent createComponent() {
    ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<MethodParameterSetting>() {
        @Override
        public MethodParameterSetting createElement() {
            //IdeFocusManager.getInstance(TwigSettingsForm.this.project).requestFocus(TwigNamespaceDialog.getWindows(), true);
            return null;
        }

        @Override
        public boolean canCreateElement() {
            return true;
        }
    });

    tablePanel.setEditAction(anActionButton ->
        MethodParameterReferenceSettingsForm.this.openTwigPathDialog(MethodParameterReferenceSettingsForm.this.tableView.getSelectedObject())
    );

    tablePanel.setAddAction(anActionButton ->
        MethodParameterReferenceSettingsForm.this.openTwigPathDialog(null)
    );

    tablePanel.disableUpAction();
    tablePanel.disableDownAction();

    this.panelConfigTableView.add(tablePanel.createPanel());

    return this.panel1;
}
 
Example #9
Source File: UseAliasListForm.java    From idea-php-annotation-plugin with MIT License 4 votes vote down vote up
@Nullable
@Override
public JComponent createComponent() {
    ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<UseAliasOption>() {
        @Override
        public UseAliasOption createElement() {
            return null;
        }

        @Override
        public boolean canCreateElement() {
            return true;
        }
    });

    tablePanel.setEditAction(anActionButton -> {

        UseAliasOption useAliasOption = tableView.getSelectedObject();
        if(useAliasOption == null) {
            return;
        }

        UseAliasForm.create(panel1, useAliasOption, option -> {
            tableView.getTableViewModel().fireTableDataChanged();
            changed = true;
        });
    });

    tablePanel.setAddAction(anActionButton -> UseAliasForm.create(panel1, option -> {
        tableView.getListTableModel().addRow(option);
        changed = true;
    }));

    tablePanel.setRemoveAction(anActionButton -> {
        modelList.removeRow(tableView.getSelectedRow());
        tableView.getTableViewModel().fireTableDataChanged();
        changed = true;
    });

    tablePanel.disableDownAction();
    tablePanel.disableUpAction();

    this.panel1.add(tablePanel.createPanel());

    return this.panel;
}
 
Example #10
Source File: ToolbarDecorator.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static ToolbarDecorator createDecorator(@Nonnull JTree tree, @Nullable ElementProducer<?> producer) {
  return new TreeToolbarDecorator(tree, producer).initPosition();
}
 
Example #11
Source File: ToolbarDecorator.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static <T> ToolbarDecorator createDecorator(@Nonnull TableView<T> table, @Nullable ElementProducer<T> producer) {
  return new TableToolbarDecorator(table, producer).initPosition();
}