public void editFile() { if (filesListPanel.getSelectedFileItems() == null || filesListPanel.getSelectedFileItems().size() != 1) { return; } RepositoryFile file = filesListPanel.getSelectedFileItems().get(0).getRepositoryFile(); if (file.getName().endsWith(".analysisview.xaction")) { // $NON-NLS-1$ openFile(file, COMMAND.RUN); } else { // check to see if a plugin supports editing ContentTypePlugin plugin = PluginOptionsHelper.getContentTypePlugin(file.getName()); if (plugin != null && plugin.hasCommand(COMMAND.EDIT)) { // load the editor for this plugin String editUrl = getPath() + "api/repos/" + pathToId(file.getPath()) + "/" + (plugin != null && (plugin.getCommandPerspective(COMMAND.EDIT) != null) ? plugin.getCommandPerspective(COMMAND.EDIT) : "editor"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ // See if it's already loaded for (int i = 0; i < contentTabPanel.getTabCount(); i++) { Widget w = contentTabPanel.getTab(i).getContent(); if (w instanceof IFrameTabPanel && ((IFrameTabPanel) w).getUrl().endsWith(editUrl)) { // Already up, select and exit contentTabPanel.selectTab(i); return; } } contentTabPanel.showNewURLTab( Messages.getString("editingColon") + file.getTitle(), Messages.getString("editingColon") + file.getTitle(), editUrl, true); //$NON-NLS-1$ //$NON-NLS-2$ // Store representation of file in the frame for reference later when // save is called contentTabPanel.getCurrentFrame().setFileInfo(filesListPanel.getSelectedFileItems().get(0)); } else { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("error"), // $NON-NLS-1$ Messages.getString("cannotEditFileType"), // $NON-NLS-1$ true, false, true); dialogBox.center(); } } }
public void execute() { filesListPanel.setShowHiddenFiles(!solutionTree.isShowHiddenFiles()); solutionTree.setShowHiddenFiles(!solutionTree.isShowHiddenFiles()); solutionTree.setSelectedItem(solutionTree.getSelectedItem(), true); // update setting final String url = GWT.getHostPageBaseURL() + "api/user-settings/MANTLE_SHOW_HIDDEN_FILES"; //$NON-NLS-1$ RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url); try { builder.sendRequest( "" + solutionTree.isShowHiddenFiles(), EmptyRequestCallback.getInstance()); RepositoryFileTreeManager.getInstance() .fetchRepositoryFileTree(true, null, null, solutionTree.isShowHiddenFiles()); } catch (RequestException e) { // showError(e); } }
public void executeActionSequence(final FileCommand.COMMAND mode) { if (filesListPanel.getSelectedFileItems() == null || filesListPanel.getSelectedFileItems().size() != 1) { return; } // open in content panel AbstractCommand authCmd = new AbstractCommand() { protected void performOperation() { performOperation(false); } protected void performOperation(boolean feedback) { final FileItem selectedFileItem = filesListPanel.getSelectedFileItems().get(0); String url = null; url = "api/repo/files/" + SolutionBrowserPanel.pathToId( filesListPanel.getSelectedFileItems().get(0).getRepositoryFile().getPath()) + "/generatedContent"; //$NON-NLS-1$ //$NON-NLS-2$ url = getPath() + url; if (mode == FileCommand.COMMAND.BACKGROUND) { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("info"), // $NON-NLS-1$ Messages.getString("backgroundExecutionWarning"), // $NON-NLS-1$ true, false, true); dialogBox.center(); url += "&background=true"; // $NON-NLS-1$ RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url); try { builder.sendRequest( null, new RequestCallback() { public void onError(Request request, Throwable exception) { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("error"), Messages.getString("couldNotBackgroundExecute"), false, false, true); //$NON-NLS-1$ //$NON-NLS-2$ dialogBox.center(); } public void onResponseReceived(Request request, Response response) {} }); } catch (RequestException e) { } } else if (mode == FileCommand.COMMAND.NEWWINDOW) { // popup blockers might attack this Window.open( url, "_blank", "menubar=yes,location=no,resizable=yes,scrollbars=yes,status=no"); //$NON-NLS-1$ // //$NON-NLS-2$ } else if (mode == FileCommand.COMMAND.SUBSCRIBE) { final String myurl = url + "&subscribepage=yes"; // $NON-NLS-1$ contentTabPanel.showNewURLTab( selectedFileItem.getLocalizedName(), selectedFileItem.getLocalizedName(), myurl, true); } else { contentTabPanel.showNewURLTab( selectedFileItem.getLocalizedName(), selectedFileItem.getLocalizedName(), url, true); } } }; authCmd.execute(); }
public void onTreeItemSelected(TreeItem item) { filesListPanel.setShowHiddenFiles(solutionTree.isShowHiddenFiles()); filesListPanel.populateFilesList(SolutionBrowserPanel.this, solutionTree, item); filesListPanel.getToolbar().setEnabled(false); }