本文整理汇总了Java中org.netbeans.spi.palette.PaletteActions类的典型用法代码示例。如果您正苦于以下问题:Java PaletteActions类的具体用法?Java PaletteActions怎么用?Java PaletteActions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PaletteActions类属于org.netbeans.spi.palette包,在下文中一共展示了PaletteActions类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getActions
import org.netbeans.spi.palette.PaletteActions; //导入依赖的package包/类
@Override
public Action[] getActions(boolean context) {
if (actions == null) {
List<Action> actionList = new ArrayList<Action>(5);
Action a = new Utils.NewCategoryAction( this );
if( a.isEnabled() ) {
actionList.add( a );
actionList.add( null );
}
actionList.add( new Utils.SortCategoriesAction( this ) );
actionList.add( null );
actionList.add( new Utils.RefreshPaletteAction() );
actions = actionList.toArray( new Action[actionList.size()] );
}
PaletteActions customActions = (PaletteActions)getLookup().lookup( PaletteActions.class );
if( null != customActions ) {
return Utils.mergeActions( actions, customActions.getCustomPaletteActions() );
}
return actions;
}
示例2: getActions
import org.netbeans.spi.palette.PaletteActions; //导入依赖的package包/类
public Action[] getActions(boolean context) {
if (actions == null) {
Node n = getParentNode();
if( null == n ) {
return new Action[0];
}
actions = new Action[] {
new Utils.CutItemAction( this ),
new Utils.CopyItemAction( this ),
new Utils.PasteItemAction( n ),
null,
new Utils.RemoveItemAction( this ),
null,
new Utils.SortItemsAction( n ),
null,
new Utils.RefreshPaletteAction()
};
}
PaletteActions customActions = getCustomActions();
if( null != customActions ) {
return Utils.mergeActions( actions, customActions.getCustomItemActions( getLookup() ) );
}
return actions;
}
示例3: createCustomButtons
import org.netbeans.spi.palette.PaletteActions; //导入依赖的package包/类
private void createCustomButtons() {
PaletteActions customActions = root.getLookup().lookup( PaletteActions.class );
if( null == customActions )
return;
Action[] actions = customActions.getImportActions();
if( null == actions || actions.length == 0 )
return;
customButtons = new JButton[actions.length];
for( int i=0; i<actions.length; i++ ) {
customButtons[i] = new JButton( actions[i] );
if( null != actions[i].getValue( Action.NAME ) )
Mnemonics.setLocalizedText( customButtons[i], actions[i].getValue( Action.NAME ).toString() );
if( null != actions[i].getValue( Action.LONG_DESCRIPTION ) )
customButtons[i].getAccessibleContext().setAccessibleDescription( actions[i].getValue( Action.LONG_DESCRIPTION ).toString() );
java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = i;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 10);
customActionsPanel.add( customButtons[i], gridBagConstraints);
}
}
示例4: refresh
import org.netbeans.spi.palette.PaletteActions; //导入依赖的package包/类
public void refresh() {
synchronized( rootNode ) {
PaletteActions customActions = rootNode.getLookup().lookup( PaletteActions.class );
Action customRefreshAction = customActions.getRefreshAction();
if( null != customRefreshAction ) {
customRefreshAction.actionPerformed( new ActionEvent( getRoot(), 0, "refresh" ) ); //NOI18N
}
clearSelection();
categoriesNeedRefresh = true;
isRefreshingChildren = true;
try {
rootNode.refreshChildren();
} finally {
isRefreshingChildren = false;
}
fireCategoriesChanged( null, false );
}
}
示例5: getActions
import org.netbeans.spi.palette.PaletteActions; //导入依赖的package包/类
@Override
public Action[] getActions(boolean context) {
if (actions == null) {
Node n = getParentNode();
if( null == n ) {
return new Action[0];
}
List<Action> actionList = new ArrayList<Action>(12);
actionList.add( new Utils.PasteItemAction( this ) );
actionList.add( null );
Action a = new Utils.NewCategoryAction( n );
if( a.isEnabled() ) {
actionList.add( a );
actionList.add( null );
}
actionList.add( new Utils.DeleteCategoryAction(this) );
actionList.add( new Utils.RenameCategoryAction(this) );
actionList.add( null );
actionList.add( new Utils.SortItemsAction(this) );
actionList.add( null );
actionList.add( new Utils.SortCategoriesAction( n ) );
actionList.add( null );
actionList.add( new Utils.RefreshPaletteAction() );
actions = actionList.toArray( new Action[actionList.size()] );
}
PaletteActions customActions = (PaletteActions)getParentNode().getLookup().lookup( PaletteActions.class );
if( null != customActions ) {
return Utils.mergeActions( actions, customActions.getCustomCategoryActions( getLookup() ) );
}
return actions;
}
示例6: getCustomActions
import org.netbeans.spi.palette.PaletteActions; //导入依赖的package包/类
private PaletteActions getCustomActions() {
PaletteActions res = null;
Node category = getParentNode();
if( null != category ) {
Node root = category.getParentNode();
if( null != root ) {
res = root.getLookup().lookup( PaletteActions.class );
}
}
return res;
}
示例7: resetPalette
import org.netbeans.spi.palette.PaletteActions; //导入依赖的package包/类
public static void resetPalette( final PaletteController controller, final Settings settings ) {
Node rootNode = (Node)controller.getRoot().lookup( Node.class );
if( null != rootNode ) {
PaletteActions customActions = rootNode.getLookup().lookup( PaletteActions.class );
Action resetAction = customActions.getResetAction();
if( null != resetAction ) {
settings.reset();
resetAction.actionPerformed( new ActionEvent( controller, 0, "reset" ) ); //NOI18N
controller.refresh();
} else {
resetPalette( rootNode, controller, settings );
}
}
}
示例8: createPaletteActions
import org.netbeans.spi.palette.PaletteActions; //导入依赖的package包/类
@Override
public PaletteActions createPaletteActions() {
return new FormPaletteActions();
}
示例9: getPreferredAction
import org.netbeans.spi.palette.PaletteActions; //导入依赖的package包/类
public Action getPreferredAction() {
PaletteActions customActions = getCustomActions();
if( null == customActions )
return null;;
return customActions.getPreferredAction( getLookup() );
}
示例10: createPaletteActions
import org.netbeans.spi.palette.PaletteActions; //导入依赖的package包/类
PaletteActions createPaletteActions();