コード例 #1
0
ファイル: GitProjectUtils.java プロジェクト: jonas/nbgit
 public static void renameProject(Project p, Object caller) {
   if (p == null) {
     return;
   }
   ContextAwareAction action = (ContextAwareAction) CommonProjectActions.renameProjectAction();
   Lookup ctx = Lookups.singleton(p);
   Action ctxAction = action.createContextAwareInstance(ctx);
   ctxAction.actionPerformed(new ActionEvent(caller, 0, "")); // NOI18N
 }
コード例 #2
0
  @Override
  public Action createContextAwareInstance(Lookup actionContext) {
    if (!ProfilingPointsManager.getDefault().isProfilingSessionInProgress()) {
      Collection<? extends CodeProfilingPoint.Annotation> anns =
          actionContext.lookupAll(CodeProfilingPoint.Annotation.class);
      if (anns.size() == 1) {
        CodeProfilingPoint pp = anns.iterator().next().profilingPoint();

        action.setProfilingPoint(pp);
        action.setBooleanState(pp.isEnabled());
        return action;
      }
    }
    return this;
  }
コード例 #3
0
  @Override
  public Action createContextAwareInstance(Lookup actionContext) {
    try {
      Method getDelegateMethod = action.getClass().getDeclaredMethod("getDelegate");
      getDelegateMethod.setAccessible(true);
      Action act = (Action) getDelegateMethod.invoke(action);

      String iconBase = (String) action.getValue("iconBase");

      if (iconBase != null) {
        act.putValue(SMALL_ICON, ImageUtilities.loadImageIcon(iconBase, true));
      }

      return act;

    } catch (Exception ex) {
      return action.createContextAwareInstance(actionContext);
    }
  }
コード例 #4
0
 @Override
 public void actionPerformed(ActionEvent e) {
   action.actionPerformed(e);
 }
コード例 #5
0
 @Override
 public void removePropertyChangeListener(PropertyChangeListener listener) {
   action.removePropertyChangeListener(listener);
 }
コード例 #6
0
 @Override
 public void addPropertyChangeListener(PropertyChangeListener listener) {
   action.addPropertyChangeListener(listener);
 }
コード例 #7
0
 @Override
 public boolean isEnabled() {
   return action.isEnabled();
 }
コード例 #8
0
 @Override
 public void setEnabled(boolean b) {
   action.setEnabled(b);
 }
コード例 #9
0
 @Override
 public void putValue(String key, Object value) {
   action.putValue(key, value);
 }
コード例 #10
0
 @Override
 public Object getValue(String key) {
   return action.getValue(key);
 }