当前位置: 首页>>代码示例>>Java>>正文


Java Task类代码示例

本文整理汇总了Java中org.netbeans.spi.tasklist.Task的典型用法代码示例。如果您正苦于以下问题:Java Task类的具体用法?Java Task怎么用?Java Task使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Task类属于org.netbeans.spi.tasklist包,在下文中一共展示了Task类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CountStatusBar

import org.netbeans.spi.tasklist.Task; //导入依赖的package包/类
/** Creates a new instance of StatusBar */
public CountStatusBar( TaskList tasks ) {
    this.tasks = tasks;
    listener = new TaskList.Listener() {
        public void tasksAdded(List<? extends Task> tasks) {
            updateText();
        }

        public void tasksRemoved(List<? extends Task> tasks) {
            updateText();
        }

        public void cleared() {
            updateText();
        }
    };
    
    updateText();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:CountStatusBar.java

示例2: getValueAt

import org.netbeans.spi.tasklist.Task; //导入依赖的package包/类
@Override
public Object getValueAt(int row, int col) {
    Task t = getTaskAtRow( row );
    if( null != t ) {
        switch( col ) {
            case COL_GROUP: //group icon
                return Accessor.getGroup( t );
            case COL_DESCRIPTION:
                return Accessor.getDescription( t );
            case COL_FILE: {
                return Accessor.getFileNameExt( t );
            }
            case COL_LOCATION: {
                return Accessor.getLocation( t );
            }
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:TaskListModel.java

示例3: tasksAdded

import org.netbeans.spi.tasklist.Task; //导入依赖的package包/类
@Override
public void tasksAdded( final List<? extends Task> tasks ) {
    if( tasks.isEmpty() )
        return;
    final int startRow;
    final int endRow;
    synchronized (lock) {
        startRow = taskList.getTasks().indexOf(tasks.get(0));
        endRow = taskList.getTasks().indexOf(tasks.get(tasks.size() - 1));
        listOfTasks = taskList.getTasks();
    }
    if( startRow > -1 && endRow > -1 ) {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                fireTableRowsInserted(startRow, endRow);
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:TaskListModel.java

示例4: tasksRemoved

import org.netbeans.spi.tasklist.Task; //导入依赖的package包/类
@Override
public void tasksRemoved( final List<? extends Task> tasks ) {
    if( tasks.isEmpty() )
        return;

    final int startRow;
    final int endRow;
    synchronized (lock) {
        startRow = listOfTasks.indexOf(tasks.get(0));
        endRow = listOfTasks.indexOf(tasks.get(tasks.size() - 1));
        listOfTasks = taskList.getTasks();
    }
    if( startRow > -1 && endRow > -1 ) {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                fireTableRowsDeleted( startRow, endRow );
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:TaskListModel.java

示例5: sortTaskList

import org.netbeans.spi.tasklist.Task; //导入依赖的package包/类
protected void sortTaskList() {
    Comparator<Task> comparator;
    switch( sortingCol ) {
    case COL_DESCRIPTION:
        comparator = TaskComparator.getDescriptionComparator( ascending );
        break;
    case COL_LOCATION:
        comparator = TaskComparator.getLocationComparator( ascending );
        break;
    case COL_FILE:
        comparator = TaskComparator.getFileComparator( ascending );
        break;
    default:
        comparator = TaskComparator.getDefault();
        break;
    }
    taskList.setComparator( comparator );
    synchronized (lock) {
        listOfTasks = taskList.getTasks();
    }
    Settings.getDefault().setSortingColumn( sortingCol );
    Settings.getDefault().setAscendingSort( ascending );

    fireTableDataChanged();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:TaskListModel.java

示例6: getTaskAtRow

import org.netbeans.spi.tasklist.Task; //导入依赖的package包/类
@Override
protected Task getTaskAtRow( int row ) {
    synchronized( groups ) {
        int groupRow = 0;
        for( FoldingGroup g : groups ) {
            synchronized (g.TASK_LOCK) {
                if( row < groupRow+g.getRowCount() ) {
                    int indexInGroup = row-groupRow-1;
                    if (indexInGroup == -1) {
                        return null;
                    }
                    return g.getTaskAt( indexInGroup);
                }
                groupRow += g.getRowCount();
            }
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:FoldingTaskListModel.java

示例7: divideByGroup

import org.netbeans.spi.tasklist.Task; //导入依赖的package包/类
private Map<FoldingGroup,List<Task>> divideByGroup( List<? extends Task> tasks ) {
    Map<FoldingGroup,List<Task>> grouppedTasksMap = new HashMap<FoldingGroup,List<Task>>( groupMap.size() );
    for( Task t : tasks ) {
        TaskGroup tg = Accessor.getGroup( t );
        FoldingGroup group = groupMap.get( tg.getName() );
        if( null == group ) {
            synchronized( groups ) {
                group = new FoldingGroup( tg );
                groupMap.put( tg.getName(), group );
                groups.add( group );
                Collections.sort( groups );
            }
        }
        List<Task> tasksInGroup = grouppedTasksMap.get( group );
        if( null == tasksInGroup ) {
            tasksInGroup = new LinkedList<Task>();
            grouppedTasksMap.put( group, tasksInGroup );
        }
        tasksInGroup.add( t );
    }
    return grouppedTasksMap;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:FoldingTaskListModel.java

示例8: testUpdates

import org.netbeans.spi.tasklist.Task; //导入依赖的package包/类
public void testUpdates() throws Exception {
    TaskProvider jtp = new TaskProvider();
    TaskManagerImpl tm = new TaskManagerImpl();
    TaskScanningScopeImpl scope1 = new TaskScanningScopeImpl(file1, file2);
    
    ErrorsCache.setErrors(src.getURL(), SPIAccessor.getInstance().create(new FileObjectIndexable(src, file1)), Arrays.asList(new DiagnosticImpl(ErrorKind.ERROR, "x", 3)), ERROR_CONVERTOR);
    
    jtp.setScope(scope1, Accessor.DEFAULT.createCallback(tm, jtp));
    jtp.waitWorkFinished();
    
    assertTasks(file1, Task.create(file1, "nb-tasklist-error", "x", 3));
    assertTasks(file2);
    
    ErrorsCache.setErrors(src.getURL(), SPIAccessor.getInstance().create(new FileObjectIndexable(src, file2)), Arrays.asList(new DiagnosticImpl(ErrorKind.ERROR, "y", 4)), ERROR_CONVERTOR);
    TaskProvider.refresh(file2);
    jtp.waitWorkFinished();
    
    assertTasks(file1, Task.create(file1, "nb-tasklist-error", "x", 3));
    assertTasks(file2, Task.create(file2, "nb-tasklist-error", "y", 4));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:TaskProviderTest.java

示例9: ScopeStatusBar

import org.netbeans.spi.tasklist.Task; //导入依赖的package包/类
/** Creates a new instance of StatusBar */
public ScopeStatusBar( TaskManagerImpl taskManager ) {
    this.taskManager = taskManager;        
    updateText();
    listener = new TaskList.Listener() {
        public void tasksAdded(List<? extends Task> tasks) {
            updateText();
        }

        public void tasksRemoved(List<? extends Task> tasks) {
            updateText();
        }

        public void cleared() {
            updateText();
        }
    };
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ScopeStatusBar.java

示例10: compare

import org.netbeans.spi.tasklist.Task; //导入依赖的package包/类
public int compare( Task t1, Task t2 ) {
    int result = 0;
    
    String f1 = Accessor.getFileNameExt(t1);
    String f2 = Accessor.getFileNameExt(t2);
    if( null == f1 && null != f2 )
        result = -1;
    else if( null != f1 && null == f2 ) 
        result = 1;
    else if( null != f1 && null != f2 ) {
        result = f1.compareTo( f2 );
    }
    
    if( 0 == result )
        result = getDefault().compare( t1, t2 );
    else if( !asc )
        result *= -1;
    
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:TaskComparator.java

示例11: clear

import org.netbeans.spi.tasklist.Task; //导入依赖的package包/类
void clear( PushTaskScanner scanner ) {
    lock.writeLock().lock();
    List<Task> toRemove = pushScanner2tasks.get( scanner );
    pushScanner2tasks.remove( scanner );
    if( null != toRemove ) {
        for( List<Task> groupTasks : group2tasks.values() ) {
            groupTasks.removeAll( toRemove );
        }
        removeTasks( toRemove );
    }
    lock.writeLock().unlock();
    
    if( null != toRemove && !toRemove.isEmpty() ) {
        fireTasksRemoved( toRemove );
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:TaskList.java

示例12: create

import org.netbeans.spi.tasklist.Task; //导入依赖的package包/类
public static List<Task> create(TextlintJsonResult[] results, FileObject fileObject) {
    List<Task> tasks = new ArrayList<>();
    final DataObject dataObject = getDataObject(fileObject);
    if (results != null && dataObject != null) {
        Line.Set lineSet = getLineSet(dataObject);
        if (lineSet != null) {
            for (TextlintJsonResult result : results) {
                result.getMessages().forEach((message) -> {
                    Line line = getCurrentLine(lineSet, message.getLine());
                    OpenAction defaultAction = line != null ? new OpenAction(line) : null;
                    Action[] popupActions = createPopupActions(dataObject, fileObject, message.getFix());
                    String description = String.format(MESSAGE_FORMAT,
                            message.getRuleId(),
                            message.getMessage(),
                            message.getLine(),
                            message.getIndex());
                    String groupName = message.getFix() != null ? TEXTLINT_FIXABLE_GROUP_NAME : TEXTLINT_GROUP_NAME;
                    tasks.add(Task.create(fileObject.toURL(), groupName, description, defaultAction, popupActions));
                });
            }
        }
    }
    return tasks;
}
 
开发者ID:junichi11,项目名称:netbeans-textlint-plugin,代码行数:25,代码来源:TextlintPushTaskScanner.java

示例13: getLocation

import org.netbeans.spi.tasklist.Task; //导入依赖的package包/类
public static String getLocation( Task t ) {
    URL url = getURL(t);
    if( null != url ) {
        return url.toString();
    }
    FileObject fo = getFile(t);
    String location = fo.getPath();
    int line = getLine(t);
    if( line >= 0 )
        location += ":" + line;
    return location;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:Accessor.java

示例14: cancelAllCurrent

import org.netbeans.spi.tasklist.Task; //导入依赖的package包/类
private static void cancelAllCurrent() {
    synchronized (TASKS) {
        clearing = true;
        try {
            for (final Iterator<Map.Entry<RequestProcessor.Task,Work>> it =  TASKS.entrySet().iterator();
                 it.hasNext();) {
                final Map.Entry<RequestProcessor.Task,Work> t = it.next();
                t.getKey().cancel();
                t.getValue().cancel();
                it.remove();
            }
        } finally {
            clearing = false;
        }
    }
    synchronized (root2FilesWithAttachedErrors) {
        root2FilesWithAttachedErrors.clear();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:WhiteListTaskProvider.java

示例15: getErrors

import org.netbeans.spi.tasklist.Task; //导入依赖的package包/类
private List<Task> getErrors(FileObject file, String ext) {
    LOG.log(Level.FINE, "getErrors, file={0}, ext={1}", new Object[] {FileUtil.getFileDisplayName(file), ext}); //NOI18N
    
    try {
        File input = computePersistentFile(file, ext);
        
        LOG.log(Level.FINE, "getErrors, error file={0}", input == null ? "null" : input.getAbsolutePath()); //NOI18N
        
        if (input == null || !input.canRead())
            return Collections.<Task>emptyList();
        
        input.getParentFile().mkdirs();
        
        return loadErrors(input, file);
    } catch (IOException e) {
        LOG.log(Level.FINE, null, e);
    }
    
    return Collections.<Task>emptyList();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:TaskCache.java


注:本文中的org.netbeans.spi.tasklist.Task类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。