コード例 #1
0
ファイル: AddToIndexViewImpl.java プロジェクト: raphsoft/che
  /**
   * Create view.
   *
   * @param resources
   * @param locale
   */
  @Inject
  protected AddToIndexViewImpl(GitResources resources, GitLocalizationConstant locale) {
    this.res = resources;
    this.locale = locale;

    ensureDebugId("git-addToIndex-window");
    setTitle(locale.addToIndexTitle());
    setWidget(ourUiBinder.createAndBindUi(this));

    btnAdd =
        createButton(
            locale.buttonAdd(),
            "git-addToIndex-btnAdd",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                delegate.onAddClicked();
              }
            });
    btnAdd.addStyleName(Window.resources.windowCss().primaryButton());
    addButtonToFooter(btnAdd);

    btnCancel =
        createButton(
            locale.buttonCancel(),
            "git-addToIndex-btnCancel",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                delegate.onCancelClicked();
              }
            });
    addButtonToFooter(btnCancel);
  }
コード例 #2
0
ファイル: BranchPresenter.java プロジェクト: jgallimore/che
  /**
   * Handler some action whether some exception happened.
   *
   * @param throwable exception what happened
   * @param console console for displaying error
   */
  void handleError(@NotNull Throwable throwable, GitOutputConsole console) {
    String errorMessage = throwable.getMessage();
    if (errorMessage == null) {
      console.printError(constant.branchDeleteFailed());
      notificationManager.notify(
          constant.branchDeleteFailed(), FAIL, true, project.getRootProject());
      return;
    }

    try {
      errorMessage = dtoFactory.createDtoFromJson(errorMessage, ServiceError.class).getMessage();
      if (errorMessage.equals("Unable get private ssh key")) {
        console.printError(constant.messagesUnableGetSshKey());
        notificationManager.notify(
            constant.messagesUnableGetSshKeyTitle(),
            constant.messagesUnableGetSshKey(),
            FAIL,
            true,
            project.getRootProject());
        return;
      }
      console.printError(errorMessage);
      notificationManager.notify(errorMessage, FAIL, true, project.getRootProject());
    } catch (Exception e) {
      console.printError(errorMessage);
      notificationManager.notify(errorMessage, FAIL, true, project.getRootProject());
    }
  }
コード例 #3
0
 /** Add description to buttons. */
 private void prepareRadioButtons() {
   addDescription(soft, locale.resetSoftTypeDescription());
   addDescription(mixed, locale.resetMixedTypeDescription());
   addDescription(hard, locale.resetHardTypeDescription());
   //        addDescription(keep, locale.resetKeepTypeDescription());
   //        addDescription(merge, locale.resetMergeTypeDescription());
 }
コード例 #4
0
  /** Creates table what contains list of available commits. */
  private void createCommitsTable() {
    commits = new CellTable<Revision>(15, tableRes);

    Column<Revision, String> dateColumn =
        new Column<Revision, String>(new TextCell()) {
          @Override
          public String getValue(Revision revision) {
            return DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM)
                .format(new Date((long) revision.getCommitTime()));
          }

          @Override
          public void render(Cell.Context context, Revision revision, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant(
                "<div id=\""
                    + UIObject.DEBUG_ID_PREFIX
                    + "git-reset-cellTable-"
                    + context.getIndex()
                    + "\">");
            super.render(context, revision, sb);
          }
        };
    Column<Revision, String> commiterColumn =
        new Column<Revision, String>(new TextCell()) {
          @Override
          public String getValue(Revision revision) {
            if (revision.getCommitter() == null) {
              return "";
            }
            return revision.getCommitter().getName();
          }
        };
    Column<Revision, String> commentColumn =
        new Column<Revision, String>(new TextCell()) {
          @Override
          public String getValue(Revision revision) {
            return revision.getMessage();
          }
        };

    commits.addColumn(dateColumn, locale.commitGridDate());
    commits.setColumnWidth(dateColumn, "20%");
    commits.addColumn(commiterColumn, locale.commitGridCommiter());
    commits.setColumnWidth(commiterColumn, "20%");
    commits.addColumn(commentColumn, locale.commitGridComment());
    commits.setColumnWidth(commentColumn, "60%");

    final SingleSelectionModel<Revision> selectionModel = new SingleSelectionModel<Revision>();
    selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            Revision selectedObject = selectionModel.getSelectedObject();
            delegate.onRevisionSelected(selectedObject);
          }
        });
    commits.setSelectionModel(selectionModel);
  }
コード例 #5
0
ファイル: HistoryAction.java プロジェクト: raphsoft/che
 @Inject
 public HistoryAction(
     Provider<HistoryPresenter> presenterProvider,
     AppContext appContext,
     GitLocalizationConstant constant) {
   super(
       constant.historyControlTitle(),
       constant.historyControlPrompt(),
       FontAwesome.HISTORY,
       appContext);
   this.presenterProvider = presenterProvider;
 }
コード例 #6
0
ファイル: BranchPresenter.java プロジェクト: jgallimore/che
 private void renameBranch() {
   final String selectedBranchName = getSelectedBranchName();
   dialogFactory
       .createInputDialog(
           constant.branchTitleRename(),
           constant.branchTypeRename(),
           selectedBranchName,
           0,
           selectedBranchName.length(),
           getNewBranchNameCallback(),
           null)
       .show();
 }
コード例 #7
0
ファイル: BranchPresenter.java プロジェクト: jgallimore/che
 /** {@inheritDoc} */
 @Override
 public void onRenameClicked() {
   if (selectedBranch.isRemote()) {
     dialogFactory
         .createConfirmDialog(
             constant.branchConfirmRenameTitle(),
             constant.branchConfirmRenameMessage(),
             getConfirmRenameBranchCallback(),
             null)
         .show();
   } else {
     renameBranch();
   }
 }
コード例 #8
0
 @Inject
 public ResetFilesAction(
     ResetFilesPresenter presenter,
     AppContext appContext,
     GitLocalizationConstant constant,
     ProjectExplorerPresenter projectExplorer) {
   super(
       constant.resetFilesControlTitle(),
       constant.resetFilesControlPrompt(),
       FontAwesome.UNDO,
       appContext,
       projectExplorer);
   this.presenter = presenter;
 }
コード例 #9
0
 @Inject
 public ShowMergeAction(
     MergePresenter presenter,
     AppContext appContext,
     GitResources resources,
     GitLocalizationConstant constant,
     AnalyticsEventLogger eventLogger,
     SelectionAgent selectionAgent) {
   super(
       constant.mergeControlTitle(),
       constant.mergeControlPrompt(),
       resources.merge(),
       appContext,
       selectionAgent);
   this.presenter = presenter;
   this.eventLogger = eventLogger;
 }
コード例 #10
0
ファイル: BranchPresenter.java プロジェクト: jgallimore/che
  /** {@inheritDoc} */
  @Override
  public void onCreateClicked() {
    dialogFactory
        .createInputDialog(
            constant.branchCreateNew(),
            constant.branchTypeNew(),
            new InputCallback() {
              @Override
              public void accepted(String value) {
                if (!value.isEmpty()) {
                  service.branchCreate(
                      workspaceId,
                      project.getRootProject(),
                      value,
                      null,
                      new AsyncRequestCallback<Branch>(
                          dtoUnmarshallerFactory.newUnmarshaller(Branch.class)) {
                        @Override
                        protected void onSuccess(Branch result) {
                          getBranches();
                        }

                        @Override
                        protected void onFailure(Throwable exception) {
                          final String errorMessage =
                              (exception.getMessage() != null)
                                  ? exception.getMessage()
                                  : constant.branchCreateFailed();
                          final GitOutputConsole console =
                              gitOutputConsoleFactory.create(BRANCH_CREATE_COMMAND_NAME);
                          console.printError(errorMessage);
                          consolesPanelPresenter.addCommandOutput(
                              appContext.getDevMachineId(), console);
                          notificationManager.notify(
                              constant.branchCreateFailed(), FAIL, true, project.getRootProject());
                        }
                      });
                }
              }
            },
            null)
        .show();
  }
コード例 #11
0
  /**
   * Create view.
   *
   * @param resources
   * @param locale
   */
  @Inject
  protected ResetToCommitViewImpl(GitResources resources, GitLocalizationConstant locale) {
    this.res = resources;
    this.locale = locale;
    this.ensureDebugId("git-reset-window");

    createCommitsTable();

    Widget widget = ourUiBinder.createAndBindUi(this);

    this.setTitle(locale.resetCommitViewTitle());
    this.setWidget(widget);

    prepareRadioButtons();

    btnCancel =
        createButton(
            locale.buttonCancel(),
            "git-reset-cancel",
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                delegate.onCancelClicked();
              }
            });
    getFooter().add(btnCancel);

    btnReset =
        createButton(
            locale.buttonReset(),
            "git-reset-reset",
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                delegate.onResetClicked();
              }
            });
    getFooter().add(btnReset);
  }