This repository has been archived by the owner on Jul 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,687 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...radle.core/src/org/springsource/ide/eclipse/gradle/core/util/RestrictedCapacityStack.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2014 Pivotal Software, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Pivotal Software, Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.springsource.ide.eclipse.gradle.core.util; | ||
|
||
import java.util.Collection; | ||
import java.util.LinkedList; | ||
|
||
/** | ||
* Linked list based implementation of a capacity restricted stack/queue | ||
* | ||
* @author Alex Boyko | ||
* | ||
* @param <E> | ||
*/ | ||
public class RestrictedCapacityStack<E> extends LinkedList<E> { | ||
|
||
private static final long serialVersionUID = 7642692882661680882L; | ||
|
||
private static final int DEFAULT_CAPACITY = 30; | ||
|
||
private int maxCapacity = DEFAULT_CAPACITY; | ||
|
||
public RestrictedCapacityStack() { | ||
super(); | ||
} | ||
|
||
public RestrictedCapacityStack(int maxCapacity) { | ||
this(); | ||
this.maxCapacity = maxCapacity; | ||
} | ||
|
||
@Override | ||
public boolean addAll(int index, Collection<? extends E> c) { | ||
boolean added = super.addAll(index, c); | ||
adjustSize(); | ||
return added; | ||
} | ||
|
||
@Override | ||
public void add(int index, E element) { | ||
super.add(index, element); | ||
adjustSize(); | ||
} | ||
|
||
@Override | ||
public boolean add(E e) { | ||
boolean added = super.add(e); | ||
if (added) { | ||
adjustSize(); | ||
} | ||
return added; | ||
} | ||
|
||
final protected void adjustSize() { | ||
while (size() > maxCapacity) { | ||
removeLast(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...e.ui.taskview/src/org/springsource/ide/eclipse/gradle/ui/taskview/TasksConsoleAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2014 Pivotal Software, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Pivotal Software, Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.springsource.ide.eclipse.gradle.ui.taskview; | ||
|
||
import org.eclipse.jface.action.Action; | ||
import org.eclipse.jface.viewers.ISelection; | ||
import org.springsource.ide.eclipse.gradle.ui.GradleUI; | ||
import org.springsource.ide.eclipse.gradle.ui.actions.ConsoleInplaceDialogActionDelegate; | ||
|
||
/** | ||
* A proxy action to {@link ConsoleInplaceDialogActionDelegate} | ||
* | ||
* @author Alex Boyko | ||
* | ||
*/ | ||
public class TasksConsoleAction extends Action { | ||
|
||
private ConsoleInplaceDialogActionDelegate delegateAction; | ||
|
||
public TasksConsoleAction() { | ||
super(null); | ||
this.delegateAction = new ConsoleInplaceDialogActionDelegate(); | ||
setDescription("Tasks Quick Launcher"); | ||
setToolTipText("Displays Tasks Quick Launcher to launch multiple tasks"); | ||
setImageDescriptor(GradleUI.getDefault().getImageRegistry().getDescriptor(GradleUI.IMAGE_LAUNCH)); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see org.eclipse.jface.action.Action#run() | ||
*/ | ||
@Override | ||
public void run() { | ||
delegateAction.run(this); | ||
} | ||
|
||
public void selectChanged(ISelection selection) { | ||
delegateAction.selectionChanged(this, selection); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
50defd3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BoykoAlex
That is great feature. Thanks so much.
Please take look at #33 #34 #36