예제 #1
0
		public void actionPerformed(ActionEvent evt)
		{
			JEditTextArea textArea = getTextArea(evt);

			int caret = textArea.getCaretPosition();

			int firstLine = textArea.getFirstLine();

			int firstOfLine = textArea.getLineStartOffset(
				textArea.getCaretLine());
			int firstVisibleLine = (firstLine == 0 ? 0 :
				firstLine + textArea.getElectricScroll());
			int firstVisible = textArea.getLineStartOffset(
				firstVisibleLine);

			if(caret == 0)
			{
				textArea.getToolkit().beep();
				return;
			}
			else if(!Boolean.TRUE.equals(textArea.getClientProperty(
				SMART_HOME_END_PROPERTY)))
				caret = firstOfLine;
			else if(caret == firstVisible)
				caret = 0;
			else if(caret == firstOfLine)
				caret = firstVisible;
			else
				caret = firstOfLine;

			if(select)
				textArea.select(textArea.getMarkPosition(),caret);
			else
				textArea.setCaretPosition(caret);
		}
 private static boolean isHintsAllowed(Window window) {
   if (window instanceof RootPaneContainer) {
     final JRootPane pane = ((RootPaneContainer) window).getRootPane();
     if (pane != null) {
       return Boolean.TRUE.equals(pane.getClientProperty(AbstractPopup.SHOW_HINTS));
     }
   }
   return false;
 }
예제 #3
0
 /**
  * Checks whether the specified component or one of its ancestors has the specified client
  * property set to {@link Boolean#TRUE}.
  *
  * @param c Component.
  * @param clientPropName Client property name.
  * @return <code>true</code> if the specified component or one of its ancestors has the
  *     specified client property set to {@link Boolean#TRUE}, <code>false</code> otherwise.
  */
 private boolean hasClientPropertySetToTrue(Component c, String clientPropName) {
   while (c != null) {
     if (c instanceof JComponent) {
       JComponent jc = (JComponent) c;
       if (Boolean.TRUE.equals(jc.getClientProperty(clientPropName))) return true;
     }
     c = c.getParent();
   }
   return false;
 }
예제 #4
0
    // {{{ setValueAt() method
    @Override
    public void setValueAt(Object aValue, int row, int column) {
      if (column != 0) return;

      Object obj = filteredEntries.get(row);
      if (obj instanceof String) return;

      Entry entry = (Entry) obj;
      boolean before = entry.install;
      entry.install = Boolean.TRUE.equals(aValue);
      if (before == entry.install) return;
      if (!entry.install) deselectParents(entry);

      List<PluginList.Dependency> deps = entry.plugin.getCompatibleBranch().deps;

      for (int i = 0; i < deps.size(); i++) {
        PluginList.Dependency dep = deps.get(i);
        if ("plugin".equals(dep.what)) {
          boolean found = false;
          for (int j = 0; j < filteredEntries.size(); j++) {
            Entry temp = (Entry) filteredEntries.get(j);
            if (temp.plugin == dep.plugin) {
              found = true;
              if (entry.install) {
                temp.parents.add(entry);
                setValueAt(Boolean.TRUE, j, 0);
              } else temp.parents.remove(entry);

              break;
            }
          }
          if (!found) {
            // the dependency was not found in the filtered list so we search in
            // global list.
            for (int a = 0; a < entries.size(); a++) {
              Entry temp = (Entry) entries.get(a);
              if (temp.plugin == dep.plugin) {
                if (entry.install) {
                  temp.parents.add(entry);
                  temp.install = true;
                } else temp.parents.remove(entry);
                break;
              }
            }
          }
        }
      }
      updateFilteredEntries();
    } // }}}
  public boolean isToDrawMacCorner() {
    if (!SystemInfo.isMac || myComponent.getComponentCount() <= 0) {
      return false;
    }

    if (myComponent.getComponentCount() > 0) {
      Component component = myComponent.getComponent(0);
      if (component instanceof JComponent
          && Boolean.TRUE.equals(((JComponent) component).getClientProperty(SUPPRESS_MAC_CORNER))) {
        return false;
      }
    }

    return true;
  }
예제 #6
0
		public void actionPerformed(ActionEvent evt)
		{
			JEditTextArea textArea = getTextArea(evt);

			int caret = textArea.getCaretPosition();

			int lastOfLine = textArea.getLineEndOffset(
				textArea.getCaretLine()) - 1;
			int lastVisibleLine = textArea.getFirstLine()
				+ textArea.getVisibleLines();
			if(lastVisibleLine >= textArea.getLineCount())
			{
				lastVisibleLine = Math.min(textArea.getLineCount() - 1,
					lastVisibleLine);
			}
			else
				lastVisibleLine -= (textArea.getElectricScroll() + 1);

			int lastVisible = textArea.getLineEndOffset(lastVisibleLine) - 1;
			int lastDocument = textArea.getDocumentLength();

			if(caret == lastDocument)
			{
				textArea.getToolkit().beep();
				return;
			}
			else if(!Boolean.TRUE.equals(textArea.getClientProperty(
				SMART_HOME_END_PROPERTY)))
				caret = lastOfLine;
			else if(caret == lastVisible)
				caret = lastDocument;
			else if(caret == lastOfLine)
				caret = lastVisible;
			else
				caret = lastOfLine;

			if(select)
				textArea.select(textArea.getMarkPosition(),caret);
			else
				textArea.setCaretPosition(caret);
		}