@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); }
@Inject public CloseAllAction( EditorAgent editorAgent, EventBus eventBus, CoreLocalizationConstant locale) { super( locale.editorTabCloseAll(), locale.editorTabCloseAllDescription(), null, editorAgent, eventBus); }
@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; }
@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(); }
@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); }
/** {@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); }
/** {@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(); }
@Override public String getTitleToolTip() { return localizationConstant.actionFullTextSearchDescription(); }
@Override public String getTitle() { return localizationConstant.actionFullTextSearch(); }
@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)); }