public static IdeaPluginDescriptorImpl[] loadDescriptors(@Nullable StartupProgress progress) { if (ClassUtilCore.isLoadingOfExternalPluginsDisabled()) { return IdeaPluginDescriptorImpl.EMPTY_ARRAY; } final List<IdeaPluginDescriptorImpl> result = new ArrayList<IdeaPluginDescriptorImpl>(); int pluginsCount = countPlugins(PathManager.getPluginsPath()) + countPlugins(PathManager.getPreinstalledPluginsPath()); loadDescriptors(PathManager.getPluginsPath(), result, progress, pluginsCount); Application application = ApplicationManager.getApplication(); boolean fromSources = false; if (application == null || !application.isUnitTestMode()) { int size = result.size(); loadDescriptors(PathManager.getPreinstalledPluginsPath(), result, progress, pluginsCount); fromSources = size == result.size(); } loadDescriptorsFromProperty(result); loadDescriptorsFromClassPath(result, fromSources ? progress : null); IdeaPluginDescriptorImpl[] pluginDescriptors = result.toArray(new IdeaPluginDescriptorImpl[result.size()]); try { Arrays.sort(pluginDescriptors, new PluginDescriptorComparator(pluginDescriptors)); } catch (Exception e) { prepareLoadingPluginsErrorMessage( IdeBundle.message("error.plugins.were.not.loaded", e.getMessage())); getLogger().info(e); return findCorePlugin(pluginDescriptors); } return pluginDescriptors; }
@NotNull @Override protected Action[] createActions() { List<Action> actions = ContainerUtil.newArrayList(getOKAction()); if (myShowUpgradeButton) { actions.add( new AbstractAction(IdeBundle.message("updates.buy.online.button")) { @Override public void actionPerformed(ActionEvent e) { LicensingFacade facade = LicensingFacade.getInstance(); assert facade != null; BrowserUtil.browse(facade.getUpgradeUrl()); doCancelAction(); } }); } actions.add( new AbstractAction(IdeBundle.message("updates.remind.later.button")) { @Override public void actionPerformed(ActionEvent e) { UpdateSettings.getInstance().forgetChannelId(myChannel.getId()); doCancelAction(); } }); actions.add(getCancelAction()); return actions.toArray(new Action[actions.size()]); }
public static DefaultActionGroup createPopupActionGroup( final Project project, final TodoPanelSettings settings, Consumer<TodoFilter> todoFilterConsumer) { TodoFilter[] filters = TodoConfiguration.getInstance().getTodoFilters(); DefaultActionGroup group = new DefaultActionGroup(); group.add( new TodoFilterApplier( IdeBundle.message("action.todo.show.all"), IdeBundle.message("action.description.todo.show.all"), null, settings, todoFilterConsumer)); for (TodoFilter filter : filters) { group.add( new TodoFilterApplier(filter.getName(), null, filter, settings, todoFilterConsumer)); } group.addSeparator(); group.add( new AnAction( IdeBundle.message("action.todo.edit.filters"), IdeBundle.message("action.todo.edit.filters"), AllIcons.General.Settings) { @Override public void actionPerformed(AnActionEvent e) { final ShowSettingsUtil util = ShowSettingsUtil.getInstance(); util.editConfigurable(project, new TodoConfigurable()); } }); return group; }
public FilterLegalsAction(final Runnable update) { super( IdeBundle.message("action.show.included.only"), IdeBundle.message("action.description.show.included.only"), AllIcons.General.Filter); myUpdate = update; }
protected String getPresentationText(final boolean inSplitter) { if (inSplitter) { return IdeBundle.message("action.close.all.unmodified.editors.in.tab.group"); } else { return IdeBundle.message("action.close.all.unmodified.editors"); } }
private MyRefreshAction(JComponent tree) { super( IdeBundle.message("action.refresh"), IdeBundle.message("action.refresh"), AllIcons.Actions.Refresh); registerShortcutOn(tree); }
private void initWizard(final String title) { setTitle(title); myCurrentStep = 0; myPreviousButton = new JButton(IdeBundle.message("button.wizard.previous")); myNextButton = new JButton(IdeBundle.message("button.wizard.next")); myCancelButton = new JButton(CommonBundle.getCancelButtonText()); myHelpButton = new JButton(CommonBundle.getHelpButtonText()); myContentPanel = new JPanel(new CardLayout()); myIcon = new TallImageComponent(null); JRootPane rootPane = getRootPane(); if (rootPane != null) { // it will be null in headless mode, i.e. tests rootPane.registerKeyboardAction( new ActionListener() { public void actionPerformed(final ActionEvent e) { helpAction(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); rootPane.registerKeyboardAction( new ActionListener() { public void actionPerformed(final ActionEvent e) { helpAction(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_HELP, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); } }
public ShowFilesAction(final Runnable update) { super( IdeBundle.message("action.show.files"), IdeBundle.message("action.description.show.files"), AllIcons.FileTypes.Any_type); myUpdate = update; }
@Override public void update(@NotNull AnActionEvent e) { super.update(e); Presentation presentation = e.getPresentation(); DataContext context = e.getDataContext(); EditorWindow window = getEditorWindow(context); if (window == null || window.getOwner().isPreview()) { presentation.setEnabledAndVisible(false); } else { if (getFile(context) != null) { presentation.setEnabledAndVisible(true); } else { Content content = getContent(context); presentation.setEnabledAndVisible(content != null && content.isPinnable()); } } if (ActionPlaces.EDITOR_TAB_POPUP.equals(e.getPlace()) || ViewContext.CELL_POPUP_PLACE.equals(e.getPlace())) { presentation.setText( isSelected(e) ? IdeBundle.message("action.unpin.tab") : IdeBundle.message("action.pin.tab")); } else { presentation.setText( isSelected(e) ? IdeBundle.message("action.unpin.active.tab") : IdeBundle.message("action.pin.active.tab")); } }
public boolean validate() throws ConfigurationException { final String moduleName = getModuleName(); if (myCreateModuleCb.isSelected() || !myWizardContext.isCreatingNewProject()) { final String moduleFileDirectory = myModuleFileLocation.getText(); if (moduleFileDirectory.length() == 0) { throw new ConfigurationException("Enter module file location"); } if (moduleName.length() == 0) { throw new ConfigurationException("Enter a module name"); } if (!ProjectWizardUtil.createDirectoryIfNotExists( IdeBundle.message("directory.module.file"), moduleFileDirectory, myImlLocationChangedByUser)) { return false; } if (!ProjectWizardUtil.createDirectoryIfNotExists( IdeBundle.message("directory.module.content.root"), myModuleContentRoot.getText(), myContentRootChangedByUser)) { return false; } File moduleFile = new File(moduleFileDirectory, moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION); if (moduleFile.exists()) { int answer = Messages.showYesNoDialog( IdeBundle.message( "prompt.overwrite.project.file", moduleFile.getAbsolutePath(), IdeBundle.message("project.new.wizard.module.identification")), IdeBundle.message("title.file.already.exists"), Messages.getQuestionIcon()); if (answer != 0) { return false; } } } if (!myWizardContext.isCreatingNewProject()) { final Module module; final ProjectStructureConfigurable fromConfigurable = ProjectStructureConfigurable.getInstance(myWizardContext.getProject()); if (fromConfigurable != null) { module = fromConfigurable.getModulesConfig().getModule(moduleName); } else { module = ModuleManager.getInstance(myWizardContext.getProject()).findModuleByName(moduleName); } if (module != null) { throw new ConfigurationException( "Module \'" + moduleName + "\' already exist in project. Please, specify another name."); } } return !myWizardContext.isCreatingNewProject() || super.validate(); }
public InstallPluginAction(PluginManagerMain mgr, PluginManagerMain installed) { super( IdeBundle.message("action.download.and.install.plugin"), IdeBundle.message("action.download.and.install.plugin"), AllIcons.Actions.Install); myHost = mgr; myInstalled = installed; }
/** Sets current LAF. The method doesn't update component hierarchy. */ @Override public void setCurrentLookAndFeel(UIManager.LookAndFeelInfo lookAndFeelInfo) { if (findLaf(lookAndFeelInfo.getClassName()) == null) { LOG.error("unknown LookAndFeel : " + lookAndFeelInfo); return; } // Set L&F if (IdeaLookAndFeelInfo.CLASS_NAME.equals( lookAndFeelInfo.getClassName())) { // that is IDEA default LAF IdeaLaf laf = new IdeaLaf(); MetalLookAndFeel.setCurrentTheme(new IdeaBlueMetalTheme()); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { Messages.showMessageDialog( IdeBundle.message( "error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon()); return; } } else if (DarculaLookAndFeelInfo.CLASS_NAME.equals(lookAndFeelInfo.getClassName())) { DarculaLaf laf = new DarculaLaf(); try { UIManager.setLookAndFeel(laf); JBColor.setDark(true); IconLoader.setUseDarkIcons(true); } catch (Exception e) { Messages.showMessageDialog( IdeBundle.message( "error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon()); return; } } else { // non default LAF try { LookAndFeel laf = ((LookAndFeel) Class.forName(lookAndFeelInfo.getClassName()).newInstance()); if (laf instanceof MetalLookAndFeel) { MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); } UIManager.setLookAndFeel(laf); } catch (Exception e) { Messages.showMessageDialog( IdeBundle.message( "error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon()); return; } } myCurrentLaf = ObjectUtils.chooseNotNull(findLaf(lookAndFeelInfo.getClassName()), lookAndFeelInfo); checkLookAndFeel(lookAndFeelInfo, false); }
private JComponent createActionsPanel() { final JButton include = new JButton(IdeBundle.message("button.include")); final JButton includeRec = new JButton(IdeBundle.message("button.include.recursively")); final JButton exclude = new JButton(IdeBundle.message("button.exclude")); final JButton excludeRec = new JButton(IdeBundle.message("button.exclude.recursively")); myPackageTree .getSelectionModel() .addTreeSelectionListener( new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { final boolean recursiveEnabled = isButtonEnabled(true, e.getPaths(), e); includeRec.setEnabled(recursiveEnabled); excludeRec.setEnabled(recursiveEnabled); final boolean nonRecursiveEnabled = isButtonEnabled(false, e.getPaths(), e); include.setEnabled(nonRecursiveEnabled); exclude.setEnabled(nonRecursiveEnabled); } }); JPanel buttonsPanel = new JPanel(new VerticalFlowLayout()); buttonsPanel.add(include); buttonsPanel.add(includeRec); buttonsPanel.add(exclude); buttonsPanel.add(excludeRec); include.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { includeSelected(false); } }); includeRec.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { includeSelected(true); } }); exclude.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { excludeSelected(false); } }); excludeRec.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { excludeSelected(true); } }); return buttonsPanel; }
@SuppressWarnings("unchecked") public void resetElements( T[] elements, final @Nullable Comparator<T> sortComparator, final boolean restoreSelectedElements) { final List<T> selectedElements = restoreSelectedElements && mySelectedElements != null ? new ArrayList<T>(mySelectedElements) : null; myElements = elements; if (sortComparator != null) { myComparator = new ElementNodeComparatorWrapper(sortComparator); } mySelectedNodes.clear(); myNodeToParentMap.clear(); myElementToNodeMap.clear(); myContainerNodes.clear(); ApplicationManager.getApplication() .runReadAction( new Runnable() { @Override public void run() { myTreeModel = buildModel(); } }); myTree.setModel(myTreeModel); myTree.setRootVisible(false); restoreTree(); if (myOptionControls == null) { myCopyJavadocCheckbox = new NonFocusableCheckBox(IdeBundle.message("checkbox.copy.javadoc")); if (myIsInsertOverrideVisible) { myInsertOverrideAnnotationCheckbox = new NonFocusableCheckBox(IdeBundle.message("checkbox.insert.at.override")); myOptionControls = new JCheckBox[] {myCopyJavadocCheckbox, myInsertOverrideAnnotationCheckbox}; } else { myOptionControls = new JCheckBox[] {myCopyJavadocCheckbox}; } } myTree.doLayout(); setOKActionEnabled(myElements != null && myElements.length > 0); if (selectedElements != null) { selectElements(selectedElements.toArray(new ClassMember[selectedElements.size()])); } if (mySelectedElements == null || mySelectedElements.isEmpty()) { expandFirst(); } }
@Override protected String getOkButtonText() { if (hasPatch()) { return ApplicationManager.getApplication().isRestartCapable() ? IdeBundle.message("updates.download.and.install.patch.button.restart") : IdeBundle.message("updates.download.and.install.patch.button"); } else if (myLatestBuild.getButtons().size() > 0) { return myLatestBuild.getButtons().get(0).getName(); } else { return IdeBundle.message("updates.more.info.button"); } }
public MacrosDialog(Component parent) { super(parent, true); MacroManager.getInstance().cacheMacrosPreview(DataManager.getInstance().getDataContext(parent)); setTitle(IdeBundle.message("title.macros")); setOKButtonText(IdeBundle.message("button.insert")); myMacrosModel = new DefaultListModel(); myMacrosList = new JList(myMacrosModel); myPreviewTextarea = new JTextArea(); init(); }
protected boolean doSetIcon( DefaultMutableTreeNode node, @Nullable String path, Component component) { if (StringUtil.isNotEmpty(path) && !new File(path).isFile()) { Messages.showErrorDialog( component, IdeBundle.message("error.file.not.found.message", path), IdeBundle.message("title.choose.action.icon")); return false; } String actionId = getActionId(node); if (actionId == null) return false; final AnAction action = ActionManager.getInstance().getAction(actionId); if (action != null && action.getTemplatePresentation() != null) { if (StringUtil.isNotEmpty(path)) { Image image = null; try { image = ImageLoader.loadFromStream( VfsUtil.convertToURL(VfsUtil.pathToUrl(path.replace(File.separatorChar, '/'))) .openStream()); } catch (IOException e) { LOG.debug(e); } Icon icon = new File(path).exists() ? IconLoader.getIcon(image) : null; if (icon != null) { if (icon.getIconWidth() > EmptyIcon.ICON_18.getIconWidth() || icon.getIconHeight() > EmptyIcon.ICON_18.getIconHeight()) { Messages.showErrorDialog( component, IdeBundle.message("custom.icon.validation.message"), IdeBundle.message("title.choose.action.icon")); return false; } node.setUserObject(Pair.create(actionId, icon)); mySelectedSchema.addIconCustomization(actionId, path); } } else { node.setUserObject(Pair.create(actionId, null)); mySelectedSchema.removeIconCustomization(actionId); final DefaultMutableTreeNode nodeOnToolbar = findNodeOnToolbar(actionId); if (nodeOnToolbar != null) { editToolbarIcon(actionId, nodeOnToolbar); node.setUserObject(nodeOnToolbar.getUserObject()); } } return true; } return false; }
protected JComponent createCenterPanel() { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints constr; // list label constr = new GridBagConstraints(); constr.gridy = 0; constr.anchor = GridBagConstraints.WEST; constr.insets = new Insets(5, 5, 0, 5); panel.add(new JLabel(IdeBundle.message("label.macros")), constr); // macros list constr = new GridBagConstraints(); constr.gridy = 1; constr.weightx = 1; constr.weighty = 1; constr.insets = new Insets(0, 5, 0, 5); constr.fill = GridBagConstraints.BOTH; constr.anchor = GridBagConstraints.WEST; panel.add(new JScrollPane(myMacrosList), constr); myMacrosList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myMacrosList.setPreferredSize(null); // preview label constr = new GridBagConstraints(); constr.gridx = 0; constr.gridy = 2; constr.anchor = GridBagConstraints.WEST; constr.insets = new Insets(5, 5, 0, 5); panel.add(new JLabel(IdeBundle.message("label.macro.preview")), constr); // preview constr = new GridBagConstraints(); constr.gridx = 0; constr.gridy = 3; constr.weightx = 1; constr.weighty = 1; constr.fill = GridBagConstraints.BOTH; constr.anchor = GridBagConstraints.WEST; constr.insets = new Insets(0, 5, 5, 5); panel.add(new JScrollPane(myPreviewTextarea), constr); myPreviewTextarea.setEditable(false); myPreviewTextarea.setLineWrap(true); myPreviewTextarea.setPreferredSize(null); panel.setPreferredSize(new Dimension(400, 500)); return panel; }
private void checkWorkingDirectory() throws ExecutionException { if (myWorkDirectory == null) { return; } if (!myWorkDirectory.exists()) { throw new ExecutionException( IdeBundle.message( "run.configuration.error.working.directory.does.not.exist", myWorkDirectory.getAbsolutePath())); } if (!myWorkDirectory.isDirectory()) { throw new ExecutionException( IdeBundle.message("run.configuration.error.working.directory.not.directory")); } }
protected JComponent createNorthPanel() { class MyTextField extends JTextField { public MyTextField() { super(""); } public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); return new Dimension(200, d.height); } } JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(4, 0, 8, 8); gbConstraints.fill = GridBagConstraints.VERTICAL; gbConstraints.weightx = 0; gbConstraints.weighty = 1; gbConstraints.anchor = GridBagConstraints.EAST; JLabel label = new JLabel(IdeBundle.message("editbox.line.number")); panel.add(label, gbConstraints); gbConstraints.fill = GridBagConstraints.BOTH; gbConstraints.weightx = 1; myField = new MyTextField(); panel.add(myField, gbConstraints); myField.setToolTipText(IdeBundle.message("tooltip.syntax.linenumber.columnnumber")); LogicalPosition position = myEditor.getCaretModel().getLogicalPosition(); myField.setText(String.format("%d:%d", position.line + 1, position.column + 1)); if (isInternal()) { gbConstraints.gridy = 1; gbConstraints.weightx = 0; gbConstraints.weighty = 1; gbConstraints.anchor = GridBagConstraints.EAST; final JLabel offsetLabel = new JLabel("Offset:"); panel.add(offsetLabel, gbConstraints); gbConstraints.fill = GridBagConstraints.BOTH; gbConstraints.weightx = 1; myOffsetField = new MyTextField(); panel.add(myOffsetField, gbConstraints); myOffsetField.setToolTipText(String.valueOf(myEditor.getCaretModel().getOffset())); } return panel; }
private static PsiDirectory createSubdirectory( final PsiDirectory oldDirectory, final String name, Project project) throws IncorrectOperationException { final PsiDirectory[] psiDirectory = new PsiDirectory[1]; final IncorrectOperationException[] exception = new IncorrectOperationException[1]; CommandProcessor.getInstance() .executeCommand( project, new Runnable() { public void run() { psiDirectory[0] = ApplicationManager.getApplication() .runWriteAction( new Computable<PsiDirectory>() { public PsiDirectory compute() { try { return oldDirectory.createSubdirectory(name); } catch (IncorrectOperationException e) { exception[0] = e; return null; } } }); } }, IdeBundle.message("command.create.new.subdirectory"), null); if (exception[0] != null) throw exception[0]; return psiDirectory[0]; }
public Process createProcess() throws ExecutionException { if (LOG.isDebugEnabled()) { LOG.debug("Executing [" + getCommandLineString() + "]"); } List<String> commands; try { checkWorkingDirectory(); if (StringUtil.isEmptyOrSpaces(myExePath)) { throw new ExecutionException( IdeBundle.message("run.configuration.error.executable.not.specified")); } commands = CommandLineUtil.toCommandLine(myExePath, myProgramParams.getList()); } catch (ExecutionException e) { LOG.info(e); throw e; } try { return startProcess(commands); } catch (IOException e) { LOG.info(e); throw new ProcessNotCreatedException(e.getMessage(), e, this); } }
@Override public final JComponent createCustomComponent(final Presentation presentation) { final JPanel panel = new JPanel(new GridBagLayout()); panel.add( new JLabel(IdeBundle.message("label.scope")), new GridBagConstraints( 0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 5, 0, 0), 0, 0)); panel.add( super.createCustomComponent(presentation), new GridBagConstraints( 1, 0, 1, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); return panel; }
public FavoritesAbbreviatePackageNamesAction(Project project, FavoritesViewTreeBuilder builder) { super( project, builder, IdeBundle.message("action.abbreviate.qualified.package.names"), AllIcons.ObjectBrowser.AbbreviatePackageNames); }
public Process createProcess() throws ExecutionException { if (LOG.isDebugEnabled()) { LOG.debug("Executing [" + getCommandLineString() + "]"); } List<String> commands; try { checkWorkingDirectory(); if (StringUtil.isEmptyOrSpaces(myExePath)) { throw new ExecutionException( IdeBundle.message("run.configuration.error.executable.not.specified")); } commands = CommandLineUtil.toCommandLine(myExePath, myProgramParams.getList()); } catch (ExecutionException e) { LOG.warn(e); throw e; } try { ProcessBuilder builder = new ProcessBuilder(commands); setupEnvironment(builder.environment()); builder.directory(myWorkDirectory); builder.redirectErrorStream(myRedirectErrorStream); return builder.start(); } catch (IOException e) { LOG.warn(e); throw new ProcessNotCreatedException(e.getMessage(), e, this); } }
@Override public void update(AnActionEvent e) { Presentation presentation = e.getPresentation(); if (ActionPlaces.PROJECT_VIEW_POPUP.equals(e.getPlace()) || ActionPlaces.COMMANDER_POPUP.equals(e.getPlace())) { presentation.setText(IdeBundle.message("action.delete.ellipsis")); } else { presentation.setText(IdeBundle.message("action.delete")); } if (e.getProject() == null) { presentation.setEnabled(false); return; } DataContext dataContext = e.getDataContext(); DeleteProvider provider = getDeleteProvider(dataContext); if (e.getInputEvent() instanceof KeyEvent) { KeyEvent keyEvent = (KeyEvent) e.getInputEvent(); Object component = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext); if (component instanceof JTextComponent) provider = null; // Do not override text deletion if (keyEvent.getKeyCode() == KeyEvent.VK_BACK_SPACE) { // Do not override text deletion in speed search if (component instanceof JComponent) { SpeedSearchSupply searchSupply = SpeedSearchSupply.getSupply((JComponent) component); if (searchSupply != null) provider = null; } String activeSpeedSearchFilter = SpeedSearchSupply.SPEED_SEARCH_CURRENT_QUERY.getData(dataContext); if (!StringUtil.isEmpty(activeSpeedSearchFilter)) { provider = null; } } } if (provider instanceof TitledHandler) { presentation.setText(((TitledHandler) provider).getActionTitle()); } boolean canDelete = provider != null && provider.canDeleteElement(dataContext); if (ActionPlaces.isPopupPlace(e.getPlace())) { presentation.setVisible(canDelete); } else { presentation.setEnabled(canDelete); } }
public void projectClosed() { if (myPaletteWindow != null) { myPaletteWindow.dispose(); ToolWindowManager.getInstance(myProject) .unregisterToolWindow(IdeBundle.message("toolwindow.palette")); myPaletteWindow = null; } }
@Override protected String getActionName(PsiDirectory directory, String newName) { return IdeBundle.message( "progress.creating.file", directory.getVirtualFile().getPresentableUrl(), File.separator, newName); }
private void updateUnindexedFiles(ProgressIndicator indicator) { PerformanceWatcher.Snapshot snapshot = PerformanceWatcher.takeSnapshot(); PushedFilePropertiesUpdater.getInstance(myProject).pushAllPropertiesNow(); boolean trackResponsiveness = !ApplicationManager.getApplication().isUnitTestMode(); if (trackResponsiveness) snapshot.logResponsivenessSinceCreation("Pushing properties"); indicator.setIndeterminate(true); indicator.setText(IdeBundle.message("progress.indexing.scanning")); myIndex.clearIndicesIfNecessary(); CollectingContentIterator finder = myIndex.createContentIterator(indicator); snapshot = PerformanceWatcher.takeSnapshot(); myIndex.iterateIndexableFilesConcurrently(finder, myProject, indicator); myIndex.filesUpdateEnumerationFinished(); if (trackResponsiveness) snapshot.logResponsivenessSinceCreation("Indexable file iteration"); List<VirtualFile> files = finder.getFiles(); if (myOnStartup && !ApplicationManager.getApplication().isUnitTestMode()) { // full VFS refresh makes sense only after it's loaded, i.e. after scanning files to index is // finished ((StartupManagerImpl) StartupManager.getInstance(myProject)).scheduleInitialVfsRefresh(); } if (files.isEmpty()) { return; } snapshot = PerformanceWatcher.takeSnapshot(); if (trackResponsiveness) LOG.info("Unindexed files update started: " + files.size() + " files to update"); indicator.setIndeterminate(false); indicator.setText(IdeBundle.message("progress.indexing.updating")); indexFiles(indicator, files); if (trackResponsiveness) snapshot.logResponsivenessSinceCreation("Unindexed files update"); }
@Override protected void doOKAction() { super.doOKAction(); if (myCurrentProject != null) { int exitCode = Messages.showDialog( IdeBundle.message("prompt.open.project.in.new.frame"), IdeBundle.message("title.open.project"), new String[] { IdeBundle.message("button.newframe"), IdeBundle.message("button.existingframe") }, 1, Messages.getQuestionIcon()); if (exitCode == 1) { ProjectUtil.closeAndDispose(myCurrentProject); } } final ProjectOptions myOptions = new ProjectOptions(); myOptions.setProjectName(myProjectName.getText()); myOptions.setProjectPath(myProjectPath.getPath()); myOptions.setCreateNewLanguage(false); myOptions.setCreateNewSolution(false); myOptions.setStorageScheme(myProjectFormatPanel.isDefault()); // invoke later is for plugins to be ready ApplicationManager.getApplication() .invokeLater( new Runnable() { @Override public void run() { try { ProjectFactory factory = new ProjectFactory(myCurrentProject, myOptions); Project project = factory.createProject(); myCurrentTemplateItem .getTemplateFiller() .fillProjectWithModules(project.getComponent(MPSProject.class)); factory.activate(); } catch (ProjectNotCreatedException e) { Messages.showErrorDialog(getContentPane(), e.getMessage()); } } }); }