com.intellij.openapi.components.State Java Examples

The following examples show how to use com.intellij.openapi.components.State. 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: BuckProjectSettingsProvider.java    From buck with Apache License 2.0 6 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  State state = (State) o;
  return showDebug == state.showDebug
      && autoFormatOnBlur == state.autoFormatOnBlur
      && enableAutoDeps == state.enableAutoDeps
      && runAfterInstall == state.runAfterInstall
      && multiInstallMode == state.multiInstallMode
      && uninstallBeforeInstalling == state.uninstallBeforeInstalling
      && customizedInstallSetting == state.customizedInstallSetting
      && Objects.equal(lastAlias, state.lastAlias)
      && Objects.equal(buckExecutable, state.buckExecutable)
      && Objects.equal(adbExecutable, state.adbExecutable)
      && Objects.equal(customizedInstallSettingCommand, state.customizedInstallSettingCommand)
      && Objects.equal(cells, state.cells);
}
 
Example #2
Source File: PasswordDatabase.java    From consulo with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public State getState() {
  TreeMap<ByteArrayWrapper, byte[]> sorted;
  String pi;
  synchronized (myDatabase) {
    pi = toHex(myMasterPasswordInfo);
    sorted = new TreeMap<ByteArrayWrapper, byte[]>(myDatabase);
  }
  String[][] db = new String[2][sorted.size()];
  int i = 0;
  for (Map.Entry<ByteArrayWrapper, byte[]> e : sorted.entrySet()) {
    db[0][i] = toHex(e.getKey().unwrap());
    db[1][i] = toHex(e.getValue());
    i++;
  }
  State s = new State();
  s.PASSWORDS = db;
  s.MASTER_PASSWORD_INFO = pi;
  return s;
}
 
Example #3
Source File: BuckProjectSettingsProvider.java    From buck with Apache License 2.0 6 votes vote down vote up
@Override
public void loadState(State state) {
  this.state = state;
  if (state.cells != null) {
    buckCellSettingsProvider.setCells(state.cells);
    state.cells = null;
  }
  if (state.adbExecutable != null || state.buckExecutable != null) {
    if (!buckExecutableSettingsProvider.getAdbExecutableOverride().isPresent()) {
      buckExecutableSettingsProvider.setAdbExecutableOverride(
          Optional.ofNullable(state.adbExecutable));
      state.adbExecutable = null;
    }
    if (!buckExecutableSettingsProvider.getBuckExecutableOverride().isPresent()) {
      buckExecutableSettingsProvider.setBuckExecutableOverride(
          Optional.ofNullable(state.buckExecutable));
      state.buckExecutable = null;
    }
  }
}
 
Example #4
Source File: Configurator.java    From JHelper with GNU Lesser General Public License v3.0 5 votes vote down vote up
public State(
		String author,
		String tasksDirectory,
		String outputFile,
		String runFile,
		boolean codeEliminationOn,
		boolean codeReformattingOn
) {
	this.author = author;
	this.tasksDirectory = tasksDirectory;
	this.outputFile = outputFile;
	this.runFile = runFile;
	this.codeEliminationOn = codeEliminationOn;
	this.codeReformattingOn = codeReformattingOn;
}
 
Example #5
Source File: StateComponentInfo.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
private static State getStateSpec(@Nonnull Class<?> aClass) {
  do {
    State stateSpec = aClass.getAnnotation(State.class);
    if (stateSpec != null) {
      return stateSpec;
    }
  }
  while ((aClass = aClass.getSuperclass()) != null);
  return null;
}
 
Example #6
Source File: PantsLocalSettings.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public State getState() {
  State state = new State();
  fillState(state);
  return state;
}
 
Example #7
Source File: DWSettingsProvider.java    From intellij-demandware with MIT License 5 votes vote down vote up
@Override
public void loadState(State state) {
    myState.hostname = state.hostname;
    myState.username = state.username;
    myState.passwordKey = state.passwordKey;
    myState.version = state.version;
    myState.autoUploadEnabled = state.autoUploadEnabled;
}
 
Example #8
Source File: RunDashboardManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public State getState() {
  State state = new State();
  state.ruleStates = myGroupers.stream().filter(grouper -> !grouper.getRule().isAlwaysEnabled())
          .map(grouper -> new RuleState(grouper.getRule().getName(), grouper.isEnabled())).collect(Collectors.toList());
  return state;
}
 
Example #9
Source File: RunDashboardManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void loadState(State state) {
  state.ruleStates.forEach(ruleState -> {
    for (DashboardGrouper grouper : myGroupers) {
      if (grouper.getRule().getName().equals(ruleState.name) && !grouper.getRule().isAlwaysEnabled()) {
        grouper.setEnabled(ruleState.enabled);
        return;
      }
    }
  });
}
 
Example #10
Source File: ExportSettingsAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static String getComponentPresentableName(@Nonnull State state, @Nonnull Class<?> aClass) {
  String defaultName = state.name();
  String resourceBundleName;

  PluginDescriptor pluginDescriptor = null;
  ClassLoader classLoader = aClass.getClassLoader();

  if(classLoader instanceof PluginClassLoader) {
    pluginDescriptor = PluginManager.getPlugin(((PluginClassLoader)classLoader).getPluginId());
  }

  if (pluginDescriptor != null && !PluginManagerCore.CORE_PLUGIN.equals(pluginDescriptor.getPluginId())) {
    resourceBundleName = pluginDescriptor.getResourceBundleBaseName();
  }
  else {
    resourceBundleName = OptionsBundle.PATH_TO_BUNDLE;
  }

  if (resourceBundleName == null) {
    return defaultName;
  }

  if (classLoader != null) {
    ResourceBundle bundle = AbstractBundle.getResourceBundle(resourceBundleName, classLoader);
    if (bundle != null) {
      return CommonBundle.messageOrDefault(bundle, "exportable." + defaultName + ".presentable.name", defaultName);
    }
  }
  return defaultName;
}
 
Example #11
Source File: BuckCellSettingsProvider.java    From buck with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  BuckCellSettingsProvider.State state = (BuckCellSettingsProvider.State) o;
  return Objects.equal(cells, state.cells);
}
 
Example #12
Source File: CacheComponent.java    From p4ic4idea with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public ProjectCacheStore.State getState() {
    try {
        return projectCache.getState();
    } catch (InterruptedException e) {
        if (project != null) {
            InternalErrorMessage.send(project).cacheLockTimeoutError(new ErrorEvent<>(
                    new VcsInterruptedException(SERIALIZE_CACHE_TIMEOUT_MESSAGE, e)));
        } else {
            LOG.warn(SERIALIZE_CACHE_TIMEOUT_MESSAGE, e);
        }
        return null;
    }
}
 
Example #13
Source File: BuckExecutableSettingsProvider.java    From buck with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  State state = (State) o;
  return Objects.equal(buckExecutable, state.buckExecutable)
      && Objects.equal(adbExecutable, state.adbExecutable)
      && Objects.equal(buildifierExecutable, state.buildifierExecutable)
      && Objects.equal(buildozerExecutable, state.buildozerExecutable);
}
 
Example #14
Source File: CacheComponent.java    From p4ic4idea with Apache License 2.0 5 votes vote down vote up
@Override
public void loadState(ProjectCacheStore.State state) {
    try {
        this.projectCache.setState(state);
    } catch (InterruptedException e) {
        if (project != null) {
            InternalErrorMessage.send(project).cacheLockTimeoutError(new ErrorEvent<>(
                    new VcsInterruptedException(DESERIALIZE_CACHE_TIMEOUT_MESSAGE, e)));
        } else {
            LOG.warn(DESERIALIZE_CACHE_TIMEOUT_MESSAGE, e);
        }
    }
}
 
Example #15
Source File: TodoView.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public State getState() {
  if (myContentManager != null) {
    // all panel were constructed
    Content content = myContentManager.getSelectedContent();
    state.selectedIndex = content == null ? -1 : myContentManager.getIndexOfContent(content);
  }
  return state;
}
 
Example #16
Source File: PersistentRootConfigComponent.java    From p4ic4idea with Apache License 2.0 5 votes vote down vote up
@Override
public void loadState(Element element) {
    if (element == null || element.getChildren().isEmpty()) {
        LOG.warn("Loaded null or empty state");
        return;
    }
    synchronized (sync) {
        rootPartMap.clear();
        for (Element root : element.getChildren("root")) {
            if (root.getChildren().isEmpty()) {
                LOG.warn("Invalid parsing of serialized node " + new XMLOutputter().outputString(root));
                continue;
            }
            final VcsRootCacheStore.State state = XmlSerializer.deserialize(
                    root.getChildren().get(0), VcsRootCacheStore.State.class);
            if (state.rootDirectory == null) {
                LOG.warn("Loaded a null root directory configuration; assuming root directory " +
                        ProjectUtil.findProjectBaseDir(project));
                state.rootDirectory = project.getBasePath();
            }
            final VcsRootCacheStore store = new VcsRootCacheStore(state, null);
            VirtualFile rootDir = store.getRootDirectory();
            rootPartMap.put(rootDir, store.getConfigParts());
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("Loaded state from XML: " + rootPartMap);
        }
    }
}
 
Example #17
Source File: StateComponentInfo.java    From consulo with Apache License 2.0 4 votes vote down vote up
public StateComponentInfo(PersistentStateComponent<T> component, State state) {
  myComponent = component;
  myState = state;
}
 
Example #18
Source File: ToolsProjectConfig.java    From consulo with Apache License 2.0 4 votes vote down vote up
public State(String afterCommitToolId) {
  myAfterCommitToolId = afterCommitToolId;
}
 
Example #19
Source File: ToolsProjectConfig.java    From consulo with Apache License 2.0 4 votes vote down vote up
public State() {
}
 
Example #20
Source File: StructureViewFactoryImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
@Nonnull
public State getState() {
  return myState;
}
 
Example #21
Source File: ReadonlyStatusHandlerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void loadState(State state) {
  myState = state;
}
 
Example #22
Source File: VcsLogTabsProperties.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void loadState(State state) {
  myState = state;
}
 
Example #23
Source File: VcsLogTabsProperties.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public State getState() {
  return myState;
}
 
Example #24
Source File: PushSettings.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void loadState(State state) {
  myState = state;
}
 
Example #25
Source File: PushSettings.java    From consulo with Apache License 2.0 4 votes vote down vote up
@javax.annotation.Nullable
@Override
public State getState() {
  return myState;
}
 
Example #26
Source File: DiffSettingsHolder.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void loadState(State state) {
  myState = state;
}
 
Example #27
Source File: DiffSettingsHolder.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public State getState() {
  return myState;
}
 
Example #28
Source File: TextDiffSettingsHolder.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void loadState(State state) {
  myState = state;
}
 
Example #29
Source File: TextDiffSettingsHolder.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public State getState() {
  return myState;
}
 
Example #30
Source File: ExternalDiffSettings.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void loadState(State state) {
  myState = state;
}