Ejemplo n.º 1
0
  @Override
  public void actionPerformed(ActionEvent event) {
    final CurrentProject currentProject = appContext.getCurrentProject();

    if (currentProject == null || currentProject.getRootProject() == null) {
      return;
    }

    final ProjectDescriptor activeProject = currentProject.getRootProject();

    if (event.getParameters() == null) {
      Log.error(getClass(), localization.canNotOpenNodeWithoutParams());
      return;
    }

    final String path = event.getParameters().get(NODE_PARAM_ID);
    if (path == null || path.equals("")) {
      Log.error(getClass(), localization.nodeToOpenIsNotSpecified());
      return;
    }

    String nodePathToOpen =
        activeProject.getPath() + (!path.startsWith("/") ? "/".concat(path) : path);

    openNodeByPath(nodePathToOpen, currentProject, event);
  }
  /** Create view. */
  @Inject
  public UploadFileViewImpl(
      UploadFileViewBinder uploadFileViewBinder, CoreLocalizationConstant locale) {

    this.setTitle(locale.uploadFileTitle());
    setWidget(uploadFileViewBinder.createAndBindUi(this));
    bind();

    btnCancel =
        createButton(
            locale.cancel(),
            "file-uploadFile-cancel",
            new ClickHandler() {

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

    btnUpload =
        createButton(
            locale.uploadButton(),
            "file-uploadFile-upload",
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                delegate.onUploadClicked();
              }
            });
    getFooter().add(btnUpload);
  }
Ejemplo n.º 3
0
 @Inject
 public CloseAllAction(
     EditorAgent editorAgent, EventBus eventBus, CoreLocalizationConstant locale) {
   super(
       locale.editorTabCloseAll(),
       locale.editorTabCloseAllDescription(),
       null,
       editorAgent,
       eventBus);
 }
Ejemplo n.º 4
0
 @Inject
 public ImportLocalProjectAction(
     LocalZipImporterPagePresenter presenter,
     CoreLocalizationConstant locale,
     Resources resources,
     AppContext appContext) {
   super(
       Arrays.asList(PROJECT_PERSPECTIVE_ID),
       locale.importLocalProjectName(),
       locale.importLocalProjectDescription(),
       null,
       resources.importProject());
   this.presenter = presenter;
   this.appContext = appContext;
 }
Ejemplo n.º 5
0
 @Inject
 public ShowHiddenFilesAction(
     AppContext appContext,
     CoreLocalizationConstant localizationConstant,
     ProjectExplorerPresenter projectExplorerPresenter,
     Resources resources) {
   super(
       singletonList(PROJECT_PERSPECTIVE_ID),
       localizationConstant.actionShowHiddenFilesTitle(),
       localizationConstant.actionShowHiddenFilesDescription(),
       null,
       resources.showHiddenFiles());
   this.appContext = appContext;
   this.projectExplorerPresenter = projectExplorerPresenter;
 }
  /** Instantiates the Project Explorer presenter. */
  @Inject
  public ProjectExplorerPartPresenter(
      ProjectExplorerView view,
      EventBus eventBus,
      ProjectServiceClient projectServiceClient,
      ContextMenu contextMenu,
      CoreLocalizationConstant coreLocalizationConstant,
      AppContext appContext,
      TreeStructureProviderRegistry treeStructureProviderRegistry,
      DeleteNodeHandler deleteNodeHandler,
      AnalyticsEventLoggerExt eventLogger,
      Provider<ProjectListStructure> projectListStructureProvider,
      Provider<EditorAgent> editorAgentProvider) {
    this.view = view;
    this.eventBus = eventBus;
    this.contextMenu = contextMenu;
    this.projectServiceClient = projectServiceClient;
    this.coreLocalizationConstant = coreLocalizationConstant;
    this.appContext = appContext;
    this.treeStructureProviderRegistry = treeStructureProviderRegistry;
    this.deleteNodeHandler = deleteNodeHandler;
    this.eventLogger = eventLogger;
    this.projectListStructureProvider = projectListStructureProvider;
    this.view.setTitle(coreLocalizationConstant.projectExplorerTitleBarText());
    this.editorAgentProvider = editorAgentProvider;

    bind();
  }
Ejemplo n.º 7
0
  @Override
  public Promise<Void> promise(final ActionEvent event) {
    final CurrentProject currentProject = appContext.getCurrentProject();

    if (currentProject == null) {
      return Promises.reject(JsPromiseError.create(localization.noOpenedProject()));
    }

    final Call<Void, Throwable> call =
        new Call<Void, Throwable>() {

          private HandlerRegistration handlerRegistration;

          @Override
          public void makeCall(final Callback<Void, Throwable> callback) {
            actionCompletedCallBack = callback;

            handlerRegistration =
                eventBus.addHandler(
                    NodeExpandedEvent.TYPE,
                    new NodeExpandedEventHandler() {
                      @Override
                      public void onNodeExpanded() {
                        handlerRegistration.removeHandler();
                        callback.onSuccess(null);
                      }
                    });

            actionPerformed(event);
          }
        };

    return createFromCallback(call);
  }
Ejemplo n.º 8
0
 /** {@inheritDoc} */
 @Override
 public void onCloseClicked() {
   boolean haveUnsavedData = false;
   for (PreferencePagePresenter preference : preferences) {
     if (preference.isDirty()) {
       haveUnsavedData = true;
     }
   }
   if (haveUnsavedData) {
     dialogFactory
         .createConfirmDialog(
             "", locale.messagesPromptSaveChanges(), getConfirmCallback(), getCancelCallback())
         .show();
   } else {
     view.close();
   }
   view.enableSaveButton(false);
 }
Ejemplo n.º 9
0
  /** {@inheritDoc} */
  @Override
  public void onCloseClicked() {
    boolean haveUnsavedData = false;

    for (SettingsPagePresenter presenter : settings) {
      if (presenter.isDirty()) {
        haveUnsavedData = true;
      }
    }

    if (!haveUnsavedData) {
      view.close();

      return;
    }

    dialogFactory
        .createConfirmDialog(
            "", locale.messagesPromptSaveChanges(), getConfirmCallback(), getCancelCallback())
        .show();
  }
 /** {@inheritDoc} */
 @NotNull
 @Override
 public String getTitle() {
   return coreLocalizationConstant.projectExplorerButtonTitle();
 }
Ejemplo n.º 11
0
 @Override
 public String getTitleToolTip() {
   return localizationConstant.actionFullTextSearchDescription();
 }
Ejemplo n.º 12
0
 @Override
 public String getTitle() {
   return localizationConstant.actionFullTextSearch();
 }
Ejemplo n.º 13
0
  @Inject
  public SelectPathViewImpl(CoreLocalizationConstant locale, SelectPathViewImplUiBinder uiBinder) {
    setTitle(locale.selectPathWindowTitle());

    Widget widget = uiBinder.createAndBindUi(this);
    setWidget(widget);

    UniqueKeyProvider<Node> uniqueKeyProvider =
        new NodeUniqueKeyProvider() {
          @NotNull
          @Override
          public String getKey(@NotNull Node item) {
            if (item instanceof HasStorablePath) {
              return ((HasStorablePath) item).getStorablePath();
            } else {
              return String.valueOf(item.hashCode());
            }
          }
        };
    FolderNodeInterceptor interceptor = new FolderNodeInterceptor();
    Set<NodeInterceptor> interceptors = new HashSet<>();
    interceptors.add(interceptor);
    NodeLoader loader = new NodeLoader(interceptors);
    NodeStorage nodeStorage = new NodeStorage(uniqueKeyProvider);

    tree = new Tree(nodeStorage, loader);
    tree.setAutoSelect(true);
    tree.getSelectionModel().setSelectionMode(SINGLE);
    treeContainer.add(tree);

    KeyboardNavigationHandler handler =
        new KeyboardNavigationHandler() {
          @Override
          public void onEnter(NativeEvent evt) {
            evt.preventDefault();
            acceptButtonClicked();
          }
        };

    handler.bind(tree);

    cancelButton =
        createButton(
            locale.cancel(),
            "select-path-cancel-button",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                hide();
              }
            });

    acceptButton =
        createPrimaryButton(
            locale.ok(),
            "select-path-ok-button",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                acceptButtonClicked();
              }
            });

    addButtonToFooter(acceptButton);
    addButtonToFooter(cancelButton);
  }
 @Override
 public void onSelectedTypeChanged(String projectType) {
   view.setOpenAsButtonTitle(localizedConstant.projectProblemOpenAsButtonTitle(projectType));
   view.setMessage(localizedConstant.projectProblemPressingButtonsMessage(projectType));
 }