public WorkspacePreferences() {
    super("Workspace"); // $NON-NLS-1$
    this.preferences = ResourcesPlugin.getPlugin().getPluginPreferences();

    final String version = preferences.getString(ICoreConstants.PREF_VERSION_KEY);
    if (!ICoreConstants.PREF_VERSION.equals(version)) upgradeVersion(version);

    // initialize cached preferences (for better performance)
    super.setAutoBuilding(preferences.getBoolean(ResourcesPlugin.PREF_AUTO_BUILDING));
    super.setSnapshotInterval(preferences.getInt(ResourcesPlugin.PREF_SNAPSHOT_INTERVAL));
    super.setMaxBuildIterations(preferences.getInt(ResourcesPlugin.PREF_MAX_BUILD_ITERATIONS));
    super.setApplyFileStatePolicy(
        preferences.getBoolean(ResourcesPlugin.PREF_APPLY_FILE_STATE_POLICY));
    super.setMaxFileStates(preferences.getInt(ResourcesPlugin.PREF_MAX_FILE_STATES));
    super.setMaxFileStateSize(preferences.getLong(ResourcesPlugin.PREF_MAX_FILE_STATE_SIZE));
    super.setFileStateLongevity(preferences.getLong(ResourcesPlugin.PREF_FILE_STATE_LONGEVITY));
    super.setOperationsPerSnapshot(
        preferences.getInt(PreferenceInitializer.PREF_OPERATIONS_PER_SNAPSHOT));
    super.setDeltaExpiration(preferences.getLong(PreferenceInitializer.PREF_DELTA_EXPIRATION));

    // This property listener ensures we are being updated properly when changes
    // are done directly to the preference store.
    preferences.addPropertyChangeListener(
        new Preferences.IPropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent event) {
            synchronizeWithPreferences(event.getProperty());
          }
        });
  }
  protected void appendSpaceBefore(ICSSNode node, String toAppend, StringBuffer source) {
    if (node == null || source == null) return;
    if (isCleanup() && !getCleanupStrategy(node).isFormatSource())
      return; // for not formatting case on cleanup action

    Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences();
    if (toAppend != null
        && toAppend.startsWith("{")
        && preferences.getBoolean(
            CSSCorePreferenceNames.WRAPPING_NEWLINE_ON_OPEN_BRACE)) { // $NON-NLS-1$
      source.append(getLineDelimiter(node));
      source.append(getIndent(node));
      return;
    } else if (
    /* ! mgr.isOnePropertyPerLine() && */ preferences.getInt(CSSCorePreferenceNames.LINE_WIDTH) > 0
        && (!preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR)
            || node.getOwnerDocument().getNodeType() != ICSSNode.STYLEDECLARATION_NODE)) {
      int n = getLastLineLength(node, source);
      int append =
          (toAppend != null)
              ? TextUtilities.indexOf(DefaultLineTracker.DELIMITERS, toAppend, 0)[0]
              : 0;
      if (toAppend != null) append = (append < 0) ? toAppend.length() : append;
      if (n + append + 1 > preferences.getInt(CSSCorePreferenceNames.LINE_WIDTH)) {
        source.append(getLineDelimiter(node));
        source.append(getIndent(node));
        source.append(getIndentString());
        return;
      }
    }
    source.append(" "); // $NON-NLS-1$
  }
 protected void synchronizeWithPreferences(String property) {
   // do not use the value in the event - may be a string instead
   // of the expected type. Retrieve it from the preferences store
   // using the type-specific method
   if (property.equals(ResourcesPlugin.PREF_AUTO_BUILDING))
     super.setAutoBuilding(preferences.getBoolean(ResourcesPlugin.PREF_AUTO_BUILDING));
   else if (property.equals(ResourcesPlugin.PREF_SNAPSHOT_INTERVAL))
     super.setSnapshotInterval(preferences.getLong(ResourcesPlugin.PREF_SNAPSHOT_INTERVAL));
   else if (property.equals(ResourcesPlugin.PREF_MAX_BUILD_ITERATIONS))
     super.setMaxBuildIterations(preferences.getInt(ResourcesPlugin.PREF_MAX_BUILD_ITERATIONS));
   else if (property.equals(ResourcesPlugin.PREF_APPLY_FILE_STATE_POLICY))
     super.setApplyFileStatePolicy(
         preferences.getBoolean(ResourcesPlugin.PREF_APPLY_FILE_STATE_POLICY));
   else if (property.equals(ResourcesPlugin.PREF_MAX_FILE_STATES))
     super.setMaxFileStates(preferences.getInt(ResourcesPlugin.PREF_MAX_FILE_STATES));
   else if (property.equals(ResourcesPlugin.PREF_MAX_FILE_STATE_SIZE))
     super.setMaxFileStateSize(preferences.getLong(ResourcesPlugin.PREF_MAX_FILE_STATE_SIZE));
   else if (property.equals(ResourcesPlugin.PREF_FILE_STATE_LONGEVITY))
     super.setFileStateLongevity(preferences.getLong(ResourcesPlugin.PREF_FILE_STATE_LONGEVITY));
   else if (property.equals(PreferenceInitializer.PREF_OPERATIONS_PER_SNAPSHOT))
     super.setOperationsPerSnapshot(
         preferences.getInt(PreferenceInitializer.PREF_OPERATIONS_PER_SNAPSHOT));
   else if (property.equals(PreferenceInitializer.PREF_DELTA_EXPIRATION))
     super.setDeltaExpiration(preferences.getLong(PreferenceInitializer.PREF_DELTA_EXPIRATION));
 }
Пример #4
0
 /**
  * Method createMISession.
  *
  * @param Process
  * @param PTY
  * @param type
  * @throws MIException
  * @return MISession
  * @deprecated
  */
 @Deprecated
 public MISession createMISession(
     MIProcess process, IMITTY pty, int type, String miVersion, IProgressMonitor monitor)
     throws MIException {
   MIPlugin miPlugin = getDefault();
   Preferences prefs = miPlugin.getPluginPreferences();
   int timeout = prefs.getInt(IMIConstants.PREF_REQUEST_TIMEOUT);
   int launchTimeout = prefs.getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT);
   return createMISession(process, pty, timeout, type, launchTimeout, miVersion, monitor);
 }
  private String getIndentString() {
    StringBuffer indent = new StringBuffer();

    Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences();
    if (preferences != null) {
      char indentChar = ' ';
      String indentCharPref = preferences.getString(CSSCorePreferenceNames.INDENTATION_CHAR);
      if (CSSCorePreferenceNames.TAB.equals(indentCharPref)) {
        indentChar = '\t';
      }
      int indentationWidth = preferences.getInt(CSSCorePreferenceNames.INDENTATION_SIZE);

      for (int i = 0; i < indentationWidth; i++) {
        indent.append(indentChar);
      }
    }
    return indent.toString();
  }
  protected String decoratedPropNameRegion(CompoundRegion region, CSSCleanupStrategy stgy) {
    if (isFormat()) return region.getText();

    String text = null;
    if (!stgy.isFormatSource()) text = region.getFullText();
    else text = region.getText();

    if (region.getType() == CSSRegionContexts.CSS_STRING
        || region.getType() == CSSRegionContexts.CSS_URI) return decoratedRegion(region, 1, stgy);
    if (isCleanup()) {
      if (stgy.getPropNameCase() == CSSCleanupStrategy.ASIS
          || region.getType() != CSSRegionContexts.CSS_DECLARATION_PROPERTY) return text;
      else if (stgy.getPropNameCase() == CSSCleanupStrategy.UPPER) return text.toUpperCase();
      else return text.toLowerCase();
    }
    Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences();

    if (region.getType() != CSSRegionContexts.CSS_DECLARATION_PROPERTY) return text;
    else if (preferences.getInt(CSSCorePreferenceNames.CASE_PROPERTY_NAME)
        == CSSCorePreferenceNames.UPPER) return text.toUpperCase();
    else return text.toLowerCase();
  }
  protected String decoratedIdentRegion(CompoundRegion region, CSSCleanupStrategy stgy) {
    if (isFormat()) return region.getText();

    String text = null;
    if (!stgy.isFormatSource()) text = region.getFullText();
    else text = region.getText();

    if (region.getType() == CSSRegionContexts.CSS_STRING
        || region.getType() == CSSRegionContexts.CSS_URI) return decoratedRegion(region, 0, stgy);

    if (isCleanup()) {
      if (stgy.getIdentCase() == CSSCleanupStrategy.ASIS
          || region.getType() == CSSRegionContexts.CSS_COMMENT) return text;
      else if (stgy.getIdentCase() == CSSCleanupStrategy.UPPER) return text.toUpperCase();
      else return text.toLowerCase();
    }

    Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences();
    if (region.getType() == CSSRegionContexts.CSS_COMMENT) return text;
    else if (preferences.getInt(CSSCorePreferenceNames.CASE_IDENTIFIER)
        == CSSCorePreferenceNames.UPPER) return text.toUpperCase();
    else return text.toLowerCase();
  }
  public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) {
    Vector vector = new Vector();

    // prefix[0] is either '\t' or ' ' x tabWidth, depending on preference
    Preferences preferences = HTMLCorePlugin.getDefault().getPluginPreferences();
    int indentationWidth = preferences.getInt(HTMLCorePreferenceNames.INDENTATION_SIZE);
    String indentCharPref = preferences.getString(HTMLCorePreferenceNames.INDENTATION_CHAR);
    boolean useSpaces = HTMLCorePreferenceNames.SPACE.equals(indentCharPref);

    for (int i = 0; i <= indentationWidth; i++) {
      StringBuffer prefix = new StringBuffer();
      boolean appendTab = false;

      if (useSpaces) {
        for (int j = 0; j + i < indentationWidth; j++) prefix.append(' ');

        if (i != 0) appendTab = true;
      } else {
        for (int j = 0; j < i; j++) prefix.append(' ');

        if (i != indentationWidth) appendTab = true;
      }

      if (appendTab) {
        prefix.append('\t');
        vector.add(prefix.toString());
        // remove the tab so that indentation - tab is also an indent
        // prefix
        prefix.deleteCharAt(prefix.length() - 1);
      }
      vector.add(prefix.toString());
    }

    vector.add(""); // $NON-NLS-1$

    return (String[]) vector.toArray(new String[vector.size()]);
  }
Пример #9
0
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated NOT
   */
  @Override
  public boolean step(STEMTime time, long timeDelta, int cycle) {

    // Validate all decorators that return deltas to make sure
    // they are of deterministic nature. The Runge Kutta integratio
    // can only handle determininistic variants

    for (Decorator decorator : this.getDecorators())
      if (decorator instanceof IntegrationDecorator) {
        IntegrationDecorator idec = (IntegrationDecorator) decorator;
        if (!idec.isDeterministic()) {
          Activator.logError(
              "Error, decorator: "
                  + idec
                  + " is not deterministic. The Runge Kutta Integrator can only handle deterministic models.",
              new Exception());
          return false;
        }
      }

    Activator act = org.eclipse.stem.ui.Activator.getDefault();
    if (act != null) {
      final Preferences preferences = act.getPluginPreferences();
      num_threads =
          (short)
              preferences.getInt(
                  org.eclipse.stem.ui.preferences.PreferenceConstants.SIMULATION_THREADS);
    } else num_threads = 2; // Just so we can run inside junit test

    final int c = cycle;

    // Initialize latches
    stepSizeBarrier =
        new CyclicBarrier(
            num_threads,
            new Runnable() {
              public void run() {
                // All threads successfully advanced time by some step h.
                // Find the smallest
                smallestH = Double.MAX_VALUE;
                maximumError = -Double.MAX_VALUE;
                for (int i = 0; i < num_threads; ++i) {
                  if (jobs[i].h <= smallestH) {
                    if (maximumError < jobs[i].maxerror) maximumError = jobs[i].maxerror;
                    smallestH = jobs[i].h;
                  }
                }
              }
            });

    updateDoneBarrier = new CyclicBarrier(num_threads);

    // Find triggers and make sure they are invoked
    for (Decorator decorator : this.getDecorators()) {
      if (decorator instanceof Trigger) {
        decorator.updateLabels(time, timeDelta, cycle);
      }
    }

    // First initialize the probe and temp label values from the current
    // label values.

    for (Decorator decorator : this.getDecorators()) {
      EList<DynamicLabel> allLabels = decorator.getLabelsToUpdate();
      for (final Iterator<DynamicLabel> currentStateLabelIter = allLabels.iterator();
          currentStateLabelIter.hasNext(); ) {
        if (decorator instanceof IntegrationDecorator) {
          // It's a standard disease model with a standard disease model label
          final IntegrationLabel iLabel = (IntegrationLabel) currentStateLabelIter.next();
          ((IntegrationLabelValue) iLabel.getProbeValue())
              .set((IntegrationLabelValue) iLabel.getCurrentValue());
          ((IntegrationLabelValue) iLabel.getTempValue())
              .set((IntegrationLabelValue) iLabel.getCurrentValue());
          ((IntegrationLabelValue) iLabel.getTempValue()).prepareCycle();
          ((IntegrationLabelValue) iLabel.getProbeValue()).prepareCycle();
        } else currentStateLabelIter.next();
      }
    }

    if (jobs == null || jobs.length != num_threads) {
      // Initialize the jobs if not done yet or of the number of threads changes
      jobs = new RkJob[num_threads];

      for (short i = 0; i < num_threads; ++i) {
        final short threadnum = i;
        jobs[i] = new RkJob("Worker " + i, threadnum, this);
      } // For each job
    } // If not initialized

    // Initialize
    int thread = 0;
    for (RkJob j : jobs) {
      j.cycle = c;
      j.time = time;
      j.timeDelta = timeDelta;
    }
    // Schedule. Jobs can be rescheduled after finished
    for (RkJob j : jobs) j.schedule();

    // Wait until all jobs completed
    for (RkJob j : jobs) {
      try {
        j.join();
      } catch (InterruptedException ie) {
        Activator.logError(ie.getMessage(), ie);
      }
    }

    // Set the common time and step size here and validate everything is right
    double minStep = Double.MAX_VALUE;
    double currentT = jobs[0].t;
    for (RkJob j : jobs) {
      // The jobs have calculated new step sizes after they finished. Pick the
      // smallest one for the next cycle
      if (j.h < minStep) minStep = j.h;
      if (j.t != currentT)
        Activator.logError(
            "Error, one thread was in misstep with other threads, its time was "
                + j.t
                + " versus "
                + currentT,
            new Exception());
    }
    return true;
  }
  protected void appendDelimBefore(ICSSNode node, CompoundRegion toAppend, StringBuffer source) {
    if (node == null || source == null) return;
    if (isCleanup() && !getCleanupStrategy(node).isFormatSource())
      return; // for not formatting case on cleanup action
    String delim = getLineDelimiter(node);

    boolean needIndent = !(node instanceof ICSSStyleSheet);
    if (toAppend == null) {
      source.append(delim);
      source.append(getIndent(node));
      if (needIndent) source.append(getIndentString());
    } else {
      String type = toAppend.getType();
      if (type == CSSRegionContexts.CSS_COMMENT) {
        RegionIterator it =
            new RegionIterator(toAppend.getDocumentRegion(), toAppend.getTextRegion());
        it.prev();
        ITextRegion prev = it.prev();
        int[] result = null;
        if (prev == null
            || (prev.getType() == CSSRegionContexts.CSS_S
                && (result =
                            TextUtilities.indexOf(
                                DefaultLineTracker.DELIMITERS,
                                it.getStructuredDocumentRegion().getText(prev),
                                0))
                        [0]
                    >= 0)) {
          // Collapse to one empty line if there's more than one.
          int offset = result[0] + DefaultLineTracker.DELIMITERS[result[1]].length();
          if (offset < it.getStructuredDocumentRegion().getText(prev).length()) {
            if (TextUtilities.indexOf(
                    DefaultLineTracker.DELIMITERS,
                    it.getStructuredDocumentRegion().getText(prev),
                    offset)[0]
                >= 0) {
              source.append(delim);
            }
          }
          source.append(delim);
          source.append(getIndent(node));
          if (needIndent) source.append(getIndentString());
        } else if (prev.getType() == CSSRegionContexts.CSS_COMMENT) {
          String fullText = toAppend.getDocumentRegion().getFullText(prev);
          String trimmedText = toAppend.getDocumentRegion().getText(prev);
          String whiteSpaces = ""; // $NON-NLS-1$
          if (fullText != null && trimmedText != null)
            whiteSpaces = fullText.substring(trimmedText.length());
          int[] delimiterFound =
              TextUtilities.indexOf(DefaultLineTracker.DELIMITERS, whiteSpaces, 0);
          if (delimiterFound[0] != -1) {
            source.append(delim);
          } else {
            appendSpaceBefore(node, toAppend.getText(), source);

            /*If two comments can't be adjusted in one line(combined length exceeds line width),
             * a tab is also appended along with next line delimiter , we need to remove that.
             */
            if (source.toString().endsWith(getIndentString())) {
              source.delete((source.length() - getIndentString().length()), source.length());
            }
          }
        } else {
          appendSpaceBefore(node, toAppend.getText(), source);
        }
      } else if (type == CSSRegionContexts.CSS_DELIMITER
          || type == CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
        RegionIterator it =
            new RegionIterator(toAppend.getDocumentRegion(), toAppend.getTextRegion());
        it.prev();
        ITextRegion prev = it.prev();

        Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences();

        if (prev.getType() == CSSRegionContexts.CSS_S
            && TextUtilities.indexOf(
                    DefaultLineTracker.DELIMITERS,
                    it.getStructuredDocumentRegion().getText(prev),
                    0)[0]
                >= 0) {
          source.append(delim);
          source.append(getIndent(node));
          if (needIndent) source.append(getIndentString());
        } else if (preferences.getInt(CSSCorePreferenceNames.LINE_WIDTH) > 0
            && (!preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR)
                || node.getOwnerDocument().getNodeType() != ICSSNode.STYLEDECLARATION_NODE)) {
          int length = getLastLineLength(node, source);
          int append = 1;
          if (length + append > preferences.getInt(CSSCorePreferenceNames.LINE_WIDTH)) {
            source.append(getLineDelimiter(node));
            source.append(getIndent(node));
            if (needIndent) source.append(getIndentString());
          }
        }
      } else if (type == CSSRegionContexts.CSS_RBRACE || type == CSSRegionContexts.CSS_LBRACE) {
        source.append(delim);
        source.append(getIndent(node));
      } else {
        source.append(delim);
        source.append(getIndent(node));
        if (needIndent) source.append(getIndentString());
      }
    }
  }
  protected String decoratedRegion(CompoundRegion region, int type, CSSCleanupStrategy stgy) {
    if (isFormat()) return region.getText();

    Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences();

    String text = null;
    if (!stgy.isFormatSource()) text = region.getFullText();
    else text = region.getText();

    String regionType = region.getType();
    if (regionType == CSSRegionContexts.CSS_URI
        || regionType == CSSRegionContexts.CSS_DECLARATION_VALUE_URI) {
      String uri = CSSLinkConverter.stripFunc(text);

      boolean prefIsUpper =
          preferences.getInt(CSSCorePreferenceNames.CASE_IDENTIFIER)
              == CSSCorePreferenceNames.UPPER;
      boolean upper =
          (type == 0)
              ? prefIsUpper
              : ((type == 1)
                  ? preferences.getInt(CSSCorePreferenceNames.CASE_PROPERTY_NAME)
                      == CSSCorePreferenceNames.UPPER
                  : preferences.getInt(CSSCorePreferenceNames.CASE_PROPERTY_VALUE)
                      == CSSCorePreferenceNames.UPPER);
      String func = text.substring(0, 4);
      if (isCleanup()) {
        upper =
            ((type == 0)
                    ? stgy.getIdentCase()
                    : ((type == 1) ? stgy.getPropNameCase() : stgy.getPropValueCase()))
                == CSSCleanupStrategy.UPPER;
        func =
            ((type == 0)
                        ? stgy.getIdentCase()
                        : ((type == 1) ? stgy.getPropNameCase() : stgy.getPropValueCase()))
                    == CSSCleanupStrategy.ASIS
                ? text.substring(0, 4)
                : (upper ? "URL(" : "url("); // $NON-NLS-2$//$NON-NLS-1$
      }
      if ((!isCleanup() && preferences.getBoolean(CSSCorePreferenceNames.FORMAT_QUOTE_IN_URI))
          || (isCleanup() && stgy.isQuoteValues())) {
        String quote = preferences.getString(CSSCorePreferenceNames.FORMAT_QUOTE);
        quote = CSSUtil.detectQuote(uri, quote);
        text = func + quote + uri + quote + ")"; // $NON-NLS-1$
      } else if (isCleanup() && !stgy.isQuoteValues()) {
        text = func + CSSLinkConverter.removeFunc(text) + ")"; // $NON-NLS-1$
      } else {
        text = func + uri + ")"; // $NON-NLS-1$
      }
    } else if (region.getType() == CSSRegionContexts.CSS_STRING
        && (!isCleanup() || stgy.isQuoteValues())) {
      String quote = preferences.getString(CSSCorePreferenceNames.FORMAT_QUOTE);
      // begginning
      if (!text.startsWith(quote)) {
        if (text.startsWith("\"") || text.startsWith("\'")) // $NON-NLS-1$ //$NON-NLS-2$
        text = quote + text.substring(1);
        else text = quote + text;
      }
      // ending
      if (!text.endsWith(quote)) {
        if (text.endsWith("\"") || text.endsWith("\'")) // $NON-NLS-1$ //$NON-NLS-2$
        text = text.substring(0, text.length() - 1) + quote;
        else text = text + quote;
      }
    }
    return text;
  }
  protected void appendSpaceBefore(ICSSNode node, CompoundRegion toAppend, StringBuffer source) {
    if (node == null || toAppend == null || source == null) return;
    if (isCleanup() && !getCleanupStrategy(node).isFormatSource())
      return; // for not formatting case on cleanup action
    String type = toAppend.getType();

    Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences();

    boolean needIndent = !(node instanceof ICSSStyleSheet);
    if (type == CSSRegionContexts.CSS_COMMENT) {
      // check whether previous region is 'S' and has CR-LF
      String delim = getLineDelimiter(node);
      RegionIterator it =
          new RegionIterator(toAppend.getDocumentRegion(), toAppend.getTextRegion());
      it.prev();
      ITextRegion prev = it.prev();
      // bug390904
      if (prev.getType() == CSSRegionContexts.CSS_LBRACE
          && TextUtilities.indexOf(
                  DefaultLineTracker.DELIMITERS,
                  it.getStructuredDocumentRegion().getFullText(prev),
                  0)[0]
              > 0) {
        source.append(delim);
        source.append(getIndent(node));
        source.append(getIndentString());
      } else if (prev.getType() == CSSRegionContexts.CSS_S
          && TextUtilities.indexOf(
                  DefaultLineTracker.DELIMITERS, it.getStructuredDocumentRegion().getText(prev), 0)[
                  0]
              >= 0) {
        source.append(delim);
        source.append(getIndent(node));
        if (needIndent) source.append(getIndentString());
      } else {
        appendSpaceBefore(node, toAppend.getText(), source);
      }
    } else if (type == CSSRegionContexts.CSS_LBRACE
        && preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_NEWLINE_ON_OPEN_BRACE)) {
      String delim = getLineDelimiter(node);
      source.append(delim);
      source.append(getIndent(node));
      // } else if (type == CSSRegionContexts.CSS_CURLY_BRACE_CLOSE) {
      // } else if (type == CSSRegionContexts.CSS_INCLUDES || type ==
      // CSSRegionContexts.CSS_DASHMATCH) {
    } else if (type == CSSRegionContexts.CSS_DECLARATION_SEPARATOR
        && node instanceof ICSSStyleDeclItem) {
      int n = preferences.getInt(CSSCorePreferenceNames.FORMAT_PROP_PRE_DELIM);
      // no delimiter case
      while (n-- > 0) source.append(" "); // $NON-NLS-1$
    } else if (type == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR
        || type == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) {
      if (preferences.getInt(CSSCorePreferenceNames.LINE_WIDTH) > 0
          && (!preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR)
              || node.getOwnerDocument().getNodeType() != ICSSNode.STYLEDECLARATION_NODE)) {
        int length = getLastLineLength(node, source);
        int append = 1;
        if (length + append > preferences.getInt(CSSCorePreferenceNames.LINE_WIDTH)) {
          source.append(getLineDelimiter(node));
          source.append(getIndent(node));
          if (needIndent) source.append(getIndentString());
        }
      }
    } else if (CSSRegionContexts.CSS_FOREIGN_ELEMENT == type
        || CSSRegionContexts.CSS_DECLARATION_DELIMITER == type) {
      return;
    } else appendSpaceBefore(node, toAppend.getText(), source);
  }
Пример #13
0
 public static int getLaunchTimeout() {
   Preferences prefs = plugin.getPluginPreferences();
   return prefs.getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT);
 }
Пример #14
0
 public static int getCommandTimeout() {
   Preferences prefs = getDefault().getPluginPreferences();
   return prefs.getInt(IMIConstants.PREF_REQUEST_TIMEOUT);
 }
Пример #15
0
 /** {@inheritDoc} */
 public int getInt(String name) {
   return fPreferences.getInt(name);
 }