本文整理汇总了Java中org.openide.util.actions.SystemAction类的典型用法代码示例。如果您正苦于以下问题:Java SystemAction类的具体用法?Java SystemAction怎么用?Java SystemAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SystemAction类属于org.openide.util.actions包,在下文中一共展示了SystemAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getActions
import org.openide.util.actions.SystemAction; //导入依赖的package包/类
@Override
public Action[] getActions(boolean context) {
if (!context) {
Action copyPath = Actions.forID("Edit", //NOI18N
"org.netbeans.modules.utilities.CopyPathToClipboard"); //NOI18N
return new Action[]{
SystemAction.get(OpenMatchingObjectsAction.class),
replacing && !matchingObject.isObjectValid()
? new RefreshAction(matchingObject) : null,
null,
copyPath == null ? new CopyPathAction() : copyPath,
SystemAction.get(HideResultAction.class),
null,
SystemAction.get(SelectInAction.class),
SystemAction.get(MoreAction.class)
};
} else {
return new Action[0];
}
}
示例2: getActions
import org.openide.util.actions.SystemAction; //导入依赖的package包/类
public Action[] getActions(VCSContext ctx, VCSAnnotator.ActionDestination destination) {
Lookup context = ctx.getElements();
List<Action> actions = new ArrayList<Action>();
if (destination == VCSAnnotator.ActionDestination.MainMenu) {
actions.add(SystemAction.get(ShowHistoryAction.class));
actions.add(SystemAction.get(RevertDeletedAction.class));
} else {
actions.add(SystemActionBridge.createAction(
SystemAction.get(ShowHistoryAction.class),
NbBundle.getMessage(ShowHistoryAction.class, "CTL_ShowHistory"),
context));
actions.add(SystemActionBridge.createAction(
SystemAction.get(RevertDeletedAction.class),
NbBundle.getMessage(RevertDeletedAction.class, "CTL_ShowRevertDeleted"),
context));
}
return actions.toArray(new Action[actions.size()]);
}
示例3: FindSupport
import org.openide.util.actions.SystemAction; //导入依赖的package包/类
private FindSupport(TopComponent tc) {
this.tc = tc;
bar = new FindBar(this);
ActionMap actionMap = tc.getActionMap();
CallbackSystemAction a = SystemAction.get(org.openide.actions.FindAction.class);
actionMap.put(a.getActionMapKey(), new FindAction(true));
actionMap.put(FIND_NEXT_ACTION, new FindAction(true));
actionMap.put(FIND_PREVIOUS_ACTION, new FindAction(false));
// Hack ensuring the same shortcuts as editor
JEditorPane pane = new JEditorPane();
for (Action action : pane.getEditorKitForContentType("text/x-java").getActions()) { // NOI18N
Object name = action.getValue(Action.NAME);
if (FIND_NEXT_ACTION.equals(name) || FIND_PREVIOUS_ACTION.equals(name)) {
reuseShortcut(action);
}
}
// PENDING the colors below should not be hardcoded
highlighterAll = new DefaultHighlighter.DefaultHighlightPainter(new Color(255,180,66));
highlighterCurrent = new DefaultHighlighter.DefaultHighlightPainter(new Color(176,197,227));
pattern = Pattern.compile("$^"); // NOI18N
}
示例4: performAction
import org.openide.util.actions.SystemAction; //导入依赖的package包/类
@Override
public void performAction(SystemAction action) {
Node[] selected = getSelectedRootNodes();
if (selected == null || selected.length == 0)
return;
for (int i=0; i < selected.length; i++)
if (!selected[i].canDestroy())
return;
try { // clear nodes selection first
getExplorerManager().setSelectedNodes(new Node[0]);
}
catch (PropertyVetoException e) {} // cannot be vetoed
nodesToDestroy = selected;
if (java.awt.EventQueue.isDispatchThread())
doDelete();
else // reinvoke synchronously in AWT thread
Mutex.EVENT.readAccess(this);
}
示例5: getActions
import org.openide.util.actions.SystemAction; //导入依赖的package包/类
@Override
public Action[] getActions(boolean context) {
Action[] res = new Action[2];
res[0] = new AbstractAction(NbBundle.getMessage(HiddenDataObject.class, "LBL_restore")) { //NOI18N
@Override
public void actionPerformed(ActionEvent e) {
try {
destroy();
} catch( IOException ex ) {
Exceptions.printStackTrace(ex);
}
}
};
res[0].setEnabled(canDestroy());
res[1] = SystemAction.get(OpenLayerFilesAction.class);
return res;
}
示例6: testIconsSystemAction
import org.openide.util.actions.SystemAction; //导入依赖的package包/类
/**
* Test whether pressed, rollover and disabled icons
* work for SystemAction.
*/
public void testIconsSystemAction() throws Exception {
Action saInstance = SystemAction.get(TestSystemAction.class);
JButton jb = new JButton();
Actions.connect(jb, saInstance);
Icon icon = jb.getIcon();
assertNotNull(icon);
checkIfLoadedCorrectIcon(icon, jb, 0, "Enabled icon");
Icon rolloverIcon = jb.getRolloverIcon();
assertNotNull(rolloverIcon);
checkIfLoadedCorrectIcon(rolloverIcon, jb, 1, "Rollover icon");
Icon pressedIcon = jb.getPressedIcon();
assertNotNull(pressedIcon);
checkIfLoadedCorrectIcon(pressedIcon, jb, 2, "Pressed icon");
Icon disabledIcon = jb.getDisabledIcon();
assertNotNull(disabledIcon);
checkIfLoadedCorrectIcon(disabledIcon, jb, 3, "Disabled icon");
}
示例7: createExtendedPopup
import org.openide.util.actions.SystemAction; //导入依赖的package包/类
void createExtendedPopup(int xpos, int ypos, JMenu newMenu) {
Node[] ns = manager.getSelectedNodes();
JPopupMenu popup = null;
if (ns.length > 0) {
// if any nodes are selected --> find theirs actions
Action[] actions = NodeOp.findActions(ns);
popup = Utilities.actionsToPopup(actions, this);
} else {
// if none node is selected --> get context actions from view's root
if (manager.getRootContext() != null) {
popup = manager.getRootContext().getContextMenu();
}
}
int cnt = 0;
if (popup == null) {
popup = SystemAction.createPopupMenu(new SystemAction[] { });
}
popup.add(newMenu);
createPopup(xpos, ypos, popup);
}
示例8: getActions
import org.openide.util.actions.SystemAction; //导入依赖的package包/类
public final Action[] getActions(boolean context) {
if (isUISettingCategoryNode()) {
return new Action[0];
} else {
return new Action[] {
SystemAction.get(FileSystemAction.class),
null,
SystemAction.get(PasteAction.class),
null,
SystemAction.get(MoveUpAction.class),
SystemAction.get(MoveDownAction.class),
SystemAction.get(ReorderAction.class),
null,
SystemAction.get(NewTemplateAction.class),
null,
SystemAction.get(ToolsAction.class),
SystemAction.get(PropertiesAction.class),
};
}
}
示例9: testNewLoaderThatChangesActionsBecomesModified
import org.openide.util.actions.SystemAction; //导入依赖的package包/类
public void testNewLoaderThatChangesActionsBecomesModified () throws Exception {
assertFalse("Not modified at begining", NbLoaderPool.isModified(newL));
Object actions = newL.getActions ();
assertNotNull ("Some actions there", actions);
assertTrue ("Default actions called", newL.defaultActionsCalled);
assertFalse("Still not modified", NbLoaderPool.isModified(newL));
List<SystemAction> list = new ArrayList<SystemAction>();
list.add(SystemAction.get(OpenAction.class));
list.add(SystemAction.get(NewAction.class));
newL.setActions(list.toArray(new SystemAction[0]));
assertFalse("Even if we changed actions, it is not modified", NbLoaderPool.isModified(newL));
List l = Arrays.asList (newL.getActions ());
assertEquals ("But actions are changed", list, l);
}
示例10: getActions
import org.openide.util.actions.SystemAction; //导入依赖的package包/类
@NonNull
@Override
public Action[] getActions(final boolean context) {
if (context) {
return super.getActions(context);
} else {
if (actions == null) {
actions = new Action[] {
CommonProjectActions.newFileAction(),
null,
SystemAction.get(FindAction.class),
null,
SystemAction.get(PasteAction.class ),
null,
SystemAction.get(FileSystemAction.class ),
null,
SystemAction.get(ToolsAction.class )
};
}
return actions;
}
}
示例11: ignoreNotSharableAncestor
import org.openide.util.actions.SystemAction; //导入依赖的package包/类
/**
* Permanently ignores (modifies ignore file) topmost not-sharable ancestor of a given file.
* @param topFile
* @param notSharableFile
*/
private static void ignoreNotSharableAncestor (File topFile, File notSharableFile) {
if (topFile.equals(notSharableFile)) {
throw new IllegalStateException("Trying to ignore " + notSharableFile + " in " + topFile); //NOI18N
}
File parent;
// find the topmost
while (!topFile.equals(parent = notSharableFile.getParentFile()) && SharabilityQuery.getSharability(FileUtil.normalizeFile(parent)) == SharabilityQuery.NOT_SHARABLE) {
notSharableFile = parent;
}
addNotSharable(topFile, notSharableFile.getAbsolutePath());
// ignore only folders
if (notSharableFile.isDirectory()) {
for (File f : Git.getInstance().getCreatedFolders()) {
if (Utils.isAncestorOrEqual(f, notSharableFile)) {
SystemAction.get(IgnoreAction.class).ignoreFolders(topFile, new File[] { notSharableFile });
}
}
}
}
示例12: getProvider
import org.openide.util.actions.SystemAction; //导入依赖的package包/类
public static ShelveChangesActionProvider getProvider () {
if (ACTION_PROVIDER == null) {
ACTION_PROVIDER = new ShelveChangesActionProvider() {
@Override
public Action getAction () {
Action a = SystemAction.get(SaveStashAction.class);
Utils.setAcceleratorBindings("Actions/Git", a); //NOI18N
return a;
}
@Override
public JComponent[] getUnshelveActions (VCSContext ctx, boolean popup) {
JComponent[] cont = UnshelveMenu.getInstance().getMenu(ctx, popup);
if (cont == null) {
cont = super.getUnshelveActions(ctx, popup);
}
return cont;
}
};
}
return ACTION_PROVIDER;
}
示例13: createNodes
import org.openide.util.actions.SystemAction; //导入依赖的package包/类
/** Implements superclass abstract method. Creates nodes from key.
* @return <code>PendingActionNode</code> if key is of
* <code>Action</code> type otherwise <code>null</code> */
protected Node[] createNodes(Object key) {
Node n = null;
if(key instanceof Action) {
Action action = (Action)key;
Icon icon = (action instanceof SystemAction) ?
((SystemAction)action).getIcon() : null;
String actionName = (String)action.getValue(Action.NAME);
if (actionName == null) actionName = ""; // NOI18N
actionName = org.openide.awt.Actions.cutAmpersand(actionName);
n = new NoActionNode(icon, actionName, NbBundle.getMessage(
Install.class, "CTL_ActionInProgress", actionName));
} else if (key instanceof ExecutorTask) {
n = new NoActionNode(null, key.toString(),
NbBundle.getMessage(Install.class, "CTL_PendingExternalProcess2",
// getExecutionEngine() had better be non-null, since getPendingTasks gave an ExecutorTask:
ExecutionEngine.getExecutionEngine().getRunningTaskName((ExecutorTask) key))
);
} else if (key instanceof InternalHandle) {
n = new NoActionNode(null, ((InternalHandle)key).getDisplayName(), null);
}
return n == null ? null : new Node[] { n };
}
示例14: performUpdate
import org.openide.util.actions.SystemAction; //导入依赖的package包/类
public static void performUpdate(final Context context, final String contextDisplayName) {
if(!Subversion.getInstance().checkClientAvailable()) {
return;
}
if (context == null || context.getRoots().size() == 0) {
return;
}
SVNUrl repository;
try {
repository = getSvnUrl(context);
} catch (SVNClientException ex) {
SvnClientExceptionHandler.notifyException(ex, true, true);
return;
}
RequestProcessor rp = Subversion.getInstance().getRequestProcessor(repository);
SvnProgressSupport support = new SvnProgressSupport() {
public void perform() {
SystemAction.get(UpdateAction.class).update(context, this, contextDisplayName, null);
}
};
support.start(rp, repository, org.openide.util.NbBundle.getMessage(UpdateAction.class, "MSG_Update_Progress")); // NOI18N
}
示例15: loadActions
import org.openide.util.actions.SystemAction; //导入依赖的package包/类
private static Action[] loadActions(String[] names) {
ArrayList<Action> arr = new ArrayList<Action>();
ClassLoader loader = Thread.currentThread().getContextClassLoader();
for (int i = 0; i < names.length; i++) {
if (names[i] == null) {
arr.add(null);
continue;
}
try {
Class<? extends SystemAction> sa = Class.forName("org.openide.actions." + names[i] + "Action", true, loader).asSubclass(SystemAction.class);
arr.add(SystemAction.get(sa)); // NOI18N
} catch (ClassNotFoundException e) {
// ignore it, missing org-openide-actions.jar
}
}
return arr.toArray(new Action[0]);
}