Java Code Examples for com.intellij.openapi.util.Comparing#strEqual()
The following examples show how to use
com.intellij.openapi.util.Comparing#strEqual() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AllFileTemplatesConfigurable.java From consulo with Apache License 2.0 | 6 votes |
public static boolean isInternalTemplate(String templateName, String templateTabTitle) { if (templateName == null) { return false; } if (Comparing.strEqual(templateTabTitle, TEMPLATES_TITLE)) { return isInternalTemplateName(templateName); } if (Comparing.strEqual(templateTabTitle, CODE_TITLE)) { return true; } if (Comparing.strEqual(templateTabTitle, OTHER_TITLE)) { return true; } if (Comparing.strEqual(templateTabTitle, INCLUDES_TITLE)) { return Comparing.strEqual(templateName, FILE_HEADER_TEMPLATE_NAME); } return false; }
Example 2
Source File: XDebugSessionImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public void updateBreakpointPresentation(@Nonnull final XLineBreakpoint<?> breakpoint, @Nullable final Image icon, @Nullable final String errorMessage) { CustomizedBreakpointPresentation presentation; synchronized (myRegisteredBreakpoints) { presentation = myRegisteredBreakpoints.get(breakpoint); if (presentation == null || (Comparing.equal(presentation.getIcon(), icon) && Comparing.strEqual(presentation.getErrorMessage(), errorMessage))) { return; } presentation.setErrorMessage(errorMessage); presentation.setIcon(icon); } myDebuggerManager.getBreakpointManager().getLineBreakpointManager().queueBreakpointUpdate((XLineBreakpointImpl<?>)breakpoint); }
Example 3
Source File: ConfigurableWebBrowser.java From consulo with Apache License 2.0 | 6 votes |
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ConfigurableWebBrowser)) { return false; } ConfigurableWebBrowser browser = (ConfigurableWebBrowser)o; return getId().equals(browser.getId()) && family.equals(browser.family) && active == browser.active && Comparing.strEqual(name, browser.name) && Comparing.equal(path, browser.path) && Comparing.equal(specificSettings, browser.specificSettings); }
Example 4
Source File: TableModelEditor.java From consulo with Apache License 2.0 | 6 votes |
@Override public void setValueAt(Object newValue, int rowIndex, int columnIndex) { if (rowIndex < getRowCount()) { @SuppressWarnings("unchecked") ColumnInfo<T, Object> column = (ColumnInfo<T, Object>)getColumnInfos()[columnIndex]; T item = getItem(rowIndex); Object oldValue = column.valueOf(item); if (column.getColumnClass() == String.class ? !Comparing.strEqual(((String)oldValue), ((String)newValue)) : !Comparing.equal(oldValue, newValue)) { column.setValue(helper.getMutable(item, rowIndex), newValue); if (dataChangedListener != null) { dataChangedListener.dataChanged(column, rowIndex); } } } }
Example 5
Source File: ShowCoveringTestsAction.java From consulo with Apache License 2.0 | 6 votes |
private void extractTests(final File traceFile, final DataInputStream in, final Set<String> tests) throws IOException { long traceSize = in.readInt(); for (int i = 0; i < traceSize; i++) { final String className = in.readUTF(); final int linesSize = in.readInt(); for(int l = 0; l < linesSize; l++) { final int line = in.readInt(); if (Comparing.strEqual(className, myClassFQName)) { if (myLineData.getLineNumber() == line) { tests.add(FileUtil.getNameWithoutExtension(traceFile)); return; } } } } }
Example 6
Source File: ScopeChooserConfigurable.java From consulo with Apache License 2.0 | 6 votes |
@RequiredUIAccess @Override public boolean isModified() { final List<String> order = getScopesState().myOrder; if (myRoot.getChildCount() != order.size()) return true; for (int i = 0; i < myRoot.getChildCount(); i++) { final MyNode node = (MyNode)myRoot.getChildAt(i); final ScopeConfigurable scopeConfigurable = (ScopeConfigurable)node.getConfigurable(); final NamedScope namedScope = scopeConfigurable.getEditableObject(); if (order.size() <= i) return true; final String name = order.get(i); if (!Comparing.strEqual(name, namedScope.getName())) return true; if (isInitialized(scopeConfigurable)) { final NamedScopesHolder holder = scopeConfigurable.getHolder(); final NamedScope scope = holder.getScope(name); if (scope == null) return true; if (scopeConfigurable.isModified()) return true; } } return false; }
Example 7
Source File: ModuleConfigurable.java From consulo with Apache License 2.0 | 6 votes |
@Override public void setDisplayName(String name) { name = name.trim(); final ModifiableModuleModel modifiableModuleModel = myConfigurator.getModuleModel(); if (StringUtil.isEmpty(name)) return; //empty string comes on double click on module node if (Comparing.strEqual(name, myModuleName)) return; //nothing changed try { modifiableModuleModel.renameModule(myModule, name); } catch (ModuleWithNameAlreadyExistsException ignored) { } myConfigurator.moduleRenamed(myModule, myModuleName, name); myModuleName = name; myConfigurator.setModified(!Comparing.strEqual(myModuleName, myModule.getName())); myContext.getDaemonAnalyzer().queueUpdateForAllElementsWithErrors(); }
Example 8
Source File: JdkUtil.java From consulo with Apache License 2.0 | 6 votes |
public static boolean checkForJdk(final File homePath) { File binPath = new File(homePath.getAbsolutePath() + File.separator + "bin"); if (!binPath.exists()) return false; FileFilter fileFilter = new FileFilter() { @Override @SuppressWarnings({"HardCodedStringLiteral"}) public boolean accept(File f) { if (f.isDirectory()) return false; return Comparing.strEqual(FileUtil.getNameWithoutExtension(f), "javac") || Comparing.strEqual(FileUtil.getNameWithoutExtension(f), "javah"); } }; File[] children = binPath.listFiles(fileFilter); return children != null && children.length >= 2 && checkForRuntime(homePath.getAbsolutePath()); }
Example 9
Source File: CoverageSuiteChooserDialog.java From consulo with Apache License 2.0 | 6 votes |
@Override public void update(AnActionEvent e) { final CheckedTreeNode[] selectedSuites = mySuitesTree.getSelectedNodes(CheckedTreeNode.class, null); final Presentation presentation = e.getPresentation(); presentation.setEnabled(false); for (CheckedTreeNode node : selectedSuites) { final Object userObject = node.getUserObject(); if (userObject instanceof CoverageSuite) { final CoverageSuite selectedSuite = (CoverageSuite)userObject; if (selectedSuite.getCoverageDataFileProvider() instanceof DefaultCoverageFileProvider && Comparing.strEqual(((DefaultCoverageFileProvider)selectedSuite.getCoverageDataFileProvider()).getSourceProvider(), DefaultCoverageFileProvider.class.getName())) { presentation.setEnabled(true); } } } }
Example 10
Source File: DirectoryChooser.java From consulo with Apache License 2.0 | 5 votes |
@Nullable private String getCommonFragment(int count) { String commonFragment = null; for (String[] path : myPaths) { int index = getFragmentIndex(path, count); if (index == -1) return null; if (commonFragment == null) { commonFragment = path[index]; continue; } if (!Comparing.strEqual(commonFragment, path[index], SystemInfo.isFileSystemCaseSensitive)) return null; } return commonFragment; }
Example 11
Source File: DependencyRule.java From consulo with Apache License 2.0 | 5 votes |
public boolean equals(Object o) { if (!(o instanceof DependencyRule)) return false; DependencyRule other = (DependencyRule)o; return getDisplayText().equals(other.getDisplayText()) && Comparing.strEqual(getPackageSetPresentation(myFromScope), getPackageSetPresentation(other.myFromScope)) && Comparing.strEqual(getPackageSetPresentation(myToScope), getPackageSetPresentation(other.myToScope)); }
Example 12
Source File: DefaultProjectProfileManager.java From consulo with Apache License 2.0 | 5 votes |
@Override public synchronized void setProjectProfile(@Nullable String newProfile) { if (Comparing.strEqual(newProfile, myProjectProfile)) { return; } String oldProfile = myProjectProfile; myProjectProfile = newProfile; USE_PROJECT_PROFILE = newProfile != null; if (oldProfile != null) { myListenerPublisher.profileActivated(getProfile(oldProfile), newProfile != null ? getProfile(newProfile) : null); } }
Example 13
Source File: ProjectConfigurable.java From consulo with Apache License 2.0 | 5 votes |
@RequiredUIAccess @Override @SuppressWarnings({"SimplifiableIfStatement"}) public boolean isModified() { final String compilerOutput = CompilerConfiguration.getInstance(myProject).getCompilerOutputUrl(); if (!Comparing.strEqual(FileUtil.toSystemIndependentName(VfsUtil.urlToPath(compilerOutput)), FileUtil.toSystemIndependentName(myProjectCompilerOutput.getText()))) { return true; } if (myProjectName != null) { if (!myProjectName.getText().trim().equals(myProject.getName())) return true; } return false; }
Example 14
Source File: SingleInspectionProfilePanel.java From consulo with Apache License 2.0 | 5 votes |
public boolean isModified() { if (myModified) return true; if (mySelectedProfile.isChanged()) return true; if (myShareProfile != (mySelectedProfile.getProfileManager() == myProjectProfileManager)) return true; if (!Comparing.strEqual(myCurrentProfileName, mySelectedProfile.getName())) return true; if (!Comparing.equal(myInitialScopesOrder, mySelectedProfile.getScopesOrder())) return true; if (descriptorsAreChanged()) { return true; } return false; }
Example 15
Source File: BaseCoverageSuite.java From consulo with Apache License 2.0 | 5 votes |
@Nullable public static CoverageRunner readRunnerAttribute(Element element) { final String runner = element.getAttributeValue(COVERAGE_RUNNER); if (runner != null) { for (CoverageRunner coverageRunner : CoverageRunner.EP_NAME.getExtensionList()) { if (Comparing.strEqual(coverageRunner.getId(), runner)) { return coverageRunner; } } } return null; }
Example 16
Source File: BrowserSettingsPanel.java From consulo with Apache License 2.0 | 5 votes |
public boolean isModified() { WebBrowserManager browserManager = WebBrowserManager.getInstance(); GeneralSettings generalSettings = GeneralSettings.getInstance(); DefaultBrowserPolicy defaultBrowserPolicy = getDefaultBrowser(); if (getDefaultBrowserPolicy(browserManager) != defaultBrowserPolicy || browserManager.isShowBrowserHover() != showBrowserHover.isSelected()) { return true; } if (defaultBrowserPolicy == DefaultBrowserPolicy.ALTERNATIVE && !Comparing.strEqual(generalSettings.getBrowserPath(), alternativeBrowserPathField.getText())) { return true; } return browsersEditor.isModified(); }
Example 17
Source File: DefaultSdksModel.java From consulo with Apache License 2.0 | 5 votes |
@Override @Nullable public Sdk findSdk(String sdkName) { for (Sdk sdk : mySdks.values()) { if (Comparing.strEqual(sdk.getName(), sdkName)) return sdk; } return null; }
Example 18
Source File: ImplementationViewComponent.java From consulo with Apache License 2.0 | 5 votes |
public String getPresentableName(VirtualFile vFile) { final String presentableName = vFile.getPresentableName(); if (myElementPresentation == null) { return presentableName; } if (Comparing.strEqual(vFile.getName(), myElementPresentation + "." + vFile.getExtension())){ return presentableName; } return presentableName + " (" + myElementPresentation + ")"; }
Example 19
Source File: PatternDialectProvider.java From consulo with Apache License 2.0 | 4 votes |
public static PatternDialectProvider getInstance(String shortName) { for (PatternDialectProvider provider : Extensions.getExtensions(EP_NAME)) { if (Comparing.strEqual(provider.getShortName(), shortName)) return provider; } return null; //todo replace with File }
Example 20
Source File: DefaultSdksModel.java From consulo with Apache License 2.0 | 4 votes |
private boolean canApply(String[] errorString, @Nullable MasterDetailsComponent rootConfigurable, boolean addedOnly) throws ConfigurationException { LinkedHashMap<Sdk, Sdk> sdks = new LinkedHashMap<>(mySdks); if (addedOnly) { Sdk[] allSdks = mySdkTableProvider.get().getAllSdks(); for (Sdk sdk : allSdks) { sdks.remove(sdk); } } ArrayList<String> allNames = new ArrayList<>(); Sdk itemWithError = null; for (Sdk currItem : sdks.values()) { String currName = currItem.getName(); if (currName.isEmpty()) { itemWithError = currItem; errorString[0] = ProjectBundle.message("sdk.list.name.required.error"); break; } if (allNames.contains(currName)) { itemWithError = currItem; errorString[0] = ProjectBundle.message("sdk.list.unique.name.required.error"); break; } final SdkAdditionalData sdkAdditionalData = currItem.getSdkAdditionalData(); if (sdkAdditionalData instanceof ValidatableSdkAdditionalData) { try { ((ValidatableSdkAdditionalData)sdkAdditionalData).checkValid(this); } catch (ConfigurationException e) { if (rootConfigurable != null) { final Object projectJdk = rootConfigurable.getSelectedObject(); if (!(projectJdk instanceof Sdk) || !Comparing.strEqual(((Sdk)projectJdk).getName(), currName)) { //do not leave current item with current name rootConfigurable.selectNodeInTree(currName); } } throw new ConfigurationException(ProjectBundle.message("sdk.configuration.exception", currName) + " " + e.getMessage()); } } allNames.add(currName); } if (itemWithError == null) return true; if (rootConfigurable != null) { rootConfigurable.selectNodeInTree(itemWithError.getName()); } return false; }